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?
You can easily make a full disc image of your Ubuntu install using Clonezilla as described in this answer. You can then install/restore that image onto your SSD.– larouxnAug 20, 2014 at 16:12
How would I then make Ubuntu pick up my home directory off the Hard disk rather than the ssd?– John RoseAug 20, 2014 at 17:24
Do you have a separate home partition?– larouxnAug 20, 2014 at 17:45
Also, the sdd is much smaller than the hard disk i.e. it will containn the system but not the data (on /home).– John RoseAug 20, 2014 at 17:46
Well, will your Ubuntu install fit on the SSD by itself? (without Home)– larouxnAug 20, 2014 at 17:48
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:
sudo rsync -av --exclude=/home/* /media/$mountpoint_of_old_drive/ /media/$mountpoint_of_new_drive/
Install the bootloader to the new drive
sudo grub-install --boot-directory /media/$mountpoint_of_new_drive/boot /dev/sdX
/dev/sdXshould 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-directoryoption, have a look at the grub-install manpage).
Update the configuration
You need to update the UUID in
/. Get the UUID of the new operating system partition by executing
sudo blkid /dev/sdXY, copy the UUID without quotation marks, run
sudo nano /media/$mountpoint_of_new_drive/etc/fstaband replace the existing UUID in a line that looks like this:
# / was on /dev/sda2 during installation UUID=a7aea81b-0e7f-4ec0-8be4-b0ec75c13fdc / ext4 errors=remount-ro 0 1
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
$your_usernamewith the name of your user's home directory) and some options (pay attention to
2at the end):
# Mountpoint for home or user partition UUID=063a996a-0303-42b2-b719-af920fd105fa /home/$your_username ext4 relatime,acl 0 2
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
fstab, you can use
sudo rsync -avagain 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:
# SSD swap UUID=b7c315cb-cf89-463b-888a-185a1faa8250 none swap sw 0 0
Additionally you need to update the UUID of the swap partition in
sudo update-initramfs -k all -uafter 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.
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 about
- You copied the content of your root (
/) partition including
You copied the content of your ESP? Do that if you havent.
EFI/ubuntu/grub.cfgon the new ESP. Replacing the UUID with the UUID of the new root partition should be sufficient, if not change the
hd0,gpt2part from this example accordingly too. This is how the content of file usually looks like:
search.fs_uuid a7aea81b-0e7f-4ec0-8be4-b0ec75c13fdc root hd0,gpt2 set prefix=($root)'/boot/grub' configfile $prefix/grub.cfg
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.
- Boot this new entry.
- You should be booting now from the SSD, run
sudo update-grubhere 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/sdXis the device name of the new harddrive,
Ythe partition number.
Thanks for the info: very clear & extensive. I shall now order the ssd, drive bay mounting bracket, data & power cables. Aug 21, 2014 at 7:12
I don't understand the use of /media/$mountpoint_of_old_drive/ in step 1. If booted from the old drive, then the old drive will not have a mountpoint for itself. Therefore, the command should be: sudo rsync -av --exclude=/home/* / /media/$mountpoint_of_new_drive/ Am I correct? Aug 22, 2014 at 7:55
@JohnRose The instructions should be followed while booting from live media. Aug 22, 2014 at 7:58
Apologies: I didn't notice the "booting from live media". I've created a GPT Partition Table on the SSD using gparted. Should I create a partition and if so what type? I'm using EFI in the BIOS. On my HDD (using GPT & EFI), there are 3 partitions (using GPT): fat32 of size 512MiB with boot set, ext4 of size 690.24GiB, linux-swap of size 7.90GiB. Aug 22, 2014 at 15:11
I've created partitions on the SDD as per the HDD (but with the ext4 one smaller as it doesn't contain /home) i.e fat32, linux-swap & ext4, and done step 1 (rysnc) OK. See next comment. Aug 22, 2014 at 17:17