Move linux system from one SSD to another

What We Need To Transfer The System

  • Ubuntu Live CD/USB

  • A new HD/SSD at lease equal to the size of the original HD/SSD

Copy The Partitions

Plug in the USB/CD and the new SSD. Boot the system, adjust the BIOS setting and move the the live USB up to the top. After restart, select “Try Ubuntu”. After login, open one terminal window and use lsblk to locate the current system.

Now, open gparted in the applications list or type sudo gparted in the terminal window. Assuming the new SSD is empty, we can now copy the partitions on the old SSD/HD to new SSD/HD by:

  1. Select the old SSD/HD from the drop down menu on the right.

  2. Right the partitions you want to copy and select copy from the menu.

  3. Select the new SSD/HD from the drop down menu on the right. Right click the unallocated partition in the bar and select paste.

  4. Repeat this process until all the partition you want are copied. (It can take fairly long depending on how big those partitions are)

For me, I have boot/efi and /recovery partitions on the original SSD to support my dual boot windows. So I also copy them to the new drive. I have a cryped swap partition on the old drive and I copy that one too.

UUID Modification

Next thing to do is to modify the UUID listed on the /etc/fstab. Since the UUID of the system partition on the new drive is diffrent from the original, we need to rectify this so we can load the system from the new SSD/HD.

  1. Type in blkid in terminal. A list of partitions and their UUIDs will show in the screen. This can also be done by right click the partiton in gparted.

  2. Open the /etc/fstab, there is a partition mounted to /. Modify its UUID so it is the UUID of the new partition. Save the change and reboot. You should be able to login to the system on the new drive.

Issues I Saw

I have a crypted swap partition on the old drive and I did copy that one over to the new drive. Every time before I log-in the ubuntu, I have to type in the password. This bothers me a lot. So, I remove that swap partition and re-create one. Here are few steps I made after creating the new swap partition.

  1. sudo mkswap /dev/the_swap_partition

  2. A new UUID shows on the screen

  3. Update the swap partition in the fstab

  4. Reboot. The swap should be automatically mounted. No more password typing for the swap partition.