I would like to transfer my existing Ubuntu Trusty (14.04.1) system (including installed apps from PPAs) to an SSD. I want to retain my existing home directory on hard disk). What is the best method, preferably ones that doesn't involve reinstalling Ubuntu?
When booting from live media, this can be broken down into 3 steps:
Copying the operating system data to the new drive
Before you start, make shure that the new drive has the correct partition table. GPT is (mostly) for EFI and requires a special partition for the bootloader. Don't forget to mark the new operating system partition as bootable on MBR installs.
Using rsync from live media should be the most practical solution to copy the files:
Install the bootloader to the new drive
/dev/sdX
should be changed to the actual device name of the new drive.If you have an EFI installation instead of MBR you should make sure that you booted the live media in EFI mode, ran
sudo apt-get install grub-efi-amd64
, have created an EFI System Partition (ESP) on the new drive and that the ESP is mounted to/media/$mountpoint_of_new_drive/boot/efi
(or use the--efi-directory
option, have a look at the grub-install manpage).Update the configuration
You need to update the UUID in
/etc/fstab
for/
. Get the UUID of the new operating system partition by executingsudo blkid /dev/sdXY
, copy the UUID without quotation marks, runsudo nano /media/$mountpoint_of_new_drive/etc/fstab
and replace the existing UUID in a line that looks like this:But before you replace the line you may want to make a copy of it by pressing Ctrl+K and Ctrl+U. As your home is still on the old drive, the old UUID should be correct and you would just need to update the mountpoint to
/home/$your_username
(replace$your_username
with the name of your user's home directory) and some options (pay attention torelatime,acl
and2
at the end):Save with Ctrl+O and exit with Ctrl+X.
You should think about moving the individual home directories to a separate
home
-partition (it's just a partition with user's home directories mounted as/home
infstab
, you can usesudo rsync -av
again to copy data, see How can I move my /home directory to another partition if it's already part of the / partition?), as you would have to create a new line for each user this way.If you created a new swap partition on the SSD you have to update the UUID for this too:
Additionally you need to update the UUID of the swap partition in
/media/$mountpoint_of_new_drive/etc/initramfs-tools/conf.d/resume
, runsudo update-initramfs -k all -u
after booting from the new drive the first time and reboot to have hibernation working again.Remember to also update the mountpoint for the ESP in fstab too for EFI installs.
Looks complicated, but it's simple to do, just difficult and lengthy to describe in detail.
Troubleshooting
grub-install somehow fails to install with UEFI
Hint: You probably forgot to run
sudo apt-get install grub-efi-amd64
when GRUB says something abouti386-pc
./
) partition including/boot
, right?You copied the content of your ESP? Do that if you havent.
Edit
EFI/ubuntu/grub.cfg
on the new ESP. Replacing the UUID with the UUID of the new root partition should be sufficient, if not change thehd0,gpt2
part from this example accordingly too. This is how the content of file usually looks like:Boot from your old installation, run
sudo update-grub
, os-prober should find the new installation on the other partition and add a GRUB entry.sudo update-grub
here again to update and fix the GRUB configuration on the SSD.efibootmgr -c -d /dev/sdX -p Y -l \EFI\ubuntu\grubx64.efi -L "Ubuntu"
to add the boot loader for new/transferred installation as a new boot option to UEFI NVRAM./dev/sdX
is the device name of the new harddrive,Y
the partition number.