How to move Ubuntu to an SSD
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 -Tax /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:
https://help.ubuntu.com/community/Boot-Repair
sudo add-apt-repository ppa:yannubuntu/boot-repair
sudo apt-get update
sudo apt-get install -y boot-repair && boot-repair
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.
Here is as good (for 2018) as easy how-to from 2013: http://www.sesser.eu/howtos/hdd2ssd.php by Markus Sesser.
But you should read 1st comment here about --exclude "sys"
- thanks to @em2er !
It describes migration without booting from live CD. It also respects system dirs and uses rsync, noatime, nodiratime. Just do not forget to omit discard option - it is implemented via cron since Ubuntu 14.04.
Short plan from article:
-
partition and mount the SSD. I recommend single ext4 on gpt
-
cleanup source HDD
-
sync data (rsync)
-
tune fstab. Also if you will keep HDD in system then I recommend move /home onto SSD while keep user data (~/Video, ~/Audio, etc.) on HDD
-
install grub