Ubuntu: How to move Ubuntu to an SSD


My current situation is:

  • One hard disk
  • Dual boot Ubuntu 11.04 and Windows 7. Partitions:
    • 100MB Windows System thingy
    • 144GB Main Windows
    • 160GB Ubuntu
    • 4GB Swap
    • 12GB System Restore stuff

Now I want to install an 80GB SSD and move Ubuntu to it. AFAIK I need to:

  • Shrink the 160GB Ubuntu partition to 80GB
  • Copy it over to the SSD
  • Change fstab to mount the SSD as /

How do I do the second? And what do I need to do about Grub?


1) Copying files

You want to copy the FILES, not the whole partition ( including its free space ), so you don't need to resize the partition first. Boot from the livecd and mount both the HD and SSD ( after formatting a partition on the SSD of course ), then copy all of the files over:

sudo cp -ax /media/hd /media/ssd  

Use the correct names for the hd and ssd mount points of course. Then you just need to edit the /etc/fstab on the ssd to point to the new fs UUID ( you can look it up with blkid ). Finally you need to install grub on the ssd.

2) Dealing with GRUB

a) Command line:

sudo -s  for f in sys dev proc ; do mount --bind /$f /media/ssd/$f ; done  chroot /media/ssd  grub-install /dev/ssd  update-grub  

Of course, use the correct device for /dev/ssd. The whole disk, not a partition number.

b) "Recommended repair" magic button in Boot-Repair:


sudo add-apt-repository ppa:yannubuntu/boot-repair  sudo apt-get update  sudo apt-get install -y boot-repair && boot-repair  

enter image description here

Finally reboot and make sure your bios is set to boot from the SSD.


I was able to do this migration successfully thanks to @psusi's instructions, however I observed one "gotcha."

After installing Grub on the new SSD, it still wouldn't boot - it was looking for the ramdisk image using the UUID of my old OS drive, which I had removed. Using the --recheck option fixed this:

$ grub-install --recheck /dev/ssd  

This encourages grub to re-scan the BIOS, identify the new drive, and presumably use its UUID when passing the "root=" parameter to the kernel.


Considering your HDD is /dev/sda and SSD is /dev/sdb and partitions are properly sized, you may use simple cp:

cp /dev/sdaX /dev/sdbY  

Where X and Y are corresponding partition numbers.

However this method will copy 80GB of data and all sectors on your SSD will be marked as "occupied" initially.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »