How to image OS for transfer?

       Hello, I am a novice with Linux. 

I have a nice installation of Ubuntu Mate 16.04 on my laptop HDD.
I just bought my first SSD, and would like to transfer my
installation intact from my old drive, to my new SSD.
What is the best way to do this? What are all of the steps
to accomplish this perfectly, with no bugs or flaws? Thanks guys.

Well first off: do you have an adapter so you can connect your SSD drive to your machine via USB?
Edit: alternatively, do you have an external USB drive for backups?

I do not expect the physical aspect of the transfer method to be an issue. I can use an SSD bay inside the laptop, and the normal slot for the old HDD. I do have external backup drives.

Your response is surprisingly simple, if your answer is going to be “transfer it”, then you miss the point of my post. I know how to move a file from A to B. My question is how to transfer the partition using the correct proper method, not merely transfer the files.

Yeah here's the thing though.
Copy is gonna happen at some point so how you connect your drives is important.

So let's assume you're using the "SSD bay".

First off, assuming your SSD has less capacity than your spinning drive, you're gonna have to reduce the size of the partitions on the spinning drive.
Start by transferring heavy files (movies and such) to your external backup, to free up space.
Then shut down the machine, and boot into an Ubuntu MATE Live session from an USB stick.

From the USB stick, use "gparted" to reduce the size of your partitions on the spinning drive.

Once that's done, verify the used space on sda is less than the free space on your SSD.
The following command is useful:

lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT

This command will list your drives and partitions.
Drives are: sda, sdb, sdc, etc while partitions are for example sda1, sdc2, sdd7, etc...

Assuming sdb is your SSD drive,
The sum of your sdaX partitions should be less than the size of sdb.

Once you've verified that's the case, you can "burn" your old drive to the SDD using:

Before you do this, make sure all partitions on sda are unmounted.

sudo dd if=/dev/sda of=/dev/sdb bs=4M && sync

It's important that you do not mistake drive identifiers or the above command will nuke your system.

Once the command returned to the prompt, your system should have been copied onto your SSD.

But if you reboot, the grub on sdb won't find the cloned install yet, because you have to edit drive labels and such in grub conf and fstab, see here:

https://help.ubuntu.com/community/DriveImaging#Restoring_a_drive_image

Once you edited those, change the boot order of your machine so it starts on the SSD, and once booted into the SSD use gparted to re-purpose your spinning drive.

Have fun.

1 Like

Thank you for those instructions. Is that a better solution than this?

http://www.fsarchiver.org/Main_Page

1 Like