Cloning my system from HDD to SSD

Hi folks,

Here's my problem : installed Zorin OS on my faithfull laptop, but it's time to muscle it a bit, meaning more ram and SSD. Done that on different computers, not really a problem.

My question is : how can I clone my existing Zorin (software + user) to my future SSD. What I want to avoid is a full reinstall of everything I use. Not complicated to do, but long and bothersome, and time is an expensive commodity these days.

Any suggestion on how to proceed (software + hardware required) ? I've read some posts here and elsewhere on the net, but it's not really enlightening.

Cheers.

As long as the SSD is the same size or larger than the HDD, you can use the Disks application to create an image.

Open the Disks application, select the drive you want to create an image of.

In the upper-right, you'll see a 'three-vertical-dots' button. Click that and select "Create Disk Image". Select somewhere that's not on the disk being backed up to save the .IMG file.

Now that the .IMG file is created, plug in your SSD and in the Disks application, select the SSD, select the 'three-vertical-dots' button, then select "Restore Disk Image". Navigate to the .IMG file you just made, then set it to running.

When it's done, the SSD will be an exact duplicate copy of the HDD. Then it's just a matter of getting it to boot from the SSD, which you'd do in the BIOS / UEFI.

You likely would want to do all of this from the Zorin OS Boot USB stick, so no files on the HDD are in use. That way, you can create the .IMG file (saving it to a third drive), shut down the machine, unplug the HDD, plug in the SSD, boot the Zorin OS Boot USB stick again, then restore that .IMG file to the new SSD.

Then you'd shut down again, and on the next startup, go into the BIOS / UEFI to set it so the SSD boots.

I wrote a script that backs up a drive to a .IMG file and compresses it... basically, it chains dd to 7z:

clear; echo "NOTE: THIS SHOULD ONLY BE RUN WHEN BOOTED FROM THE ZORIN OS USB STICK AND WITH ALL SOURCE DRIVE PARTITIONS UNMOUNTED!"; echo "$(read -r -p "Press Enter to continue..." key)"; clear; echo "Are you certain that all partitions on the source drive are unmounted?\nStarting Disks application... please wait..."; sleep 3; gnome-disks; clear; echo "$(read -r -p "Press Enter to continue..." key)"; clear; echo "Backing up. Please wait...\nEnter source drive (for instance: sda)..."; read source; echo "Enter destination path (for instance: /media/zorin/Storage/) ONLY... file is automatically named."; read destination; clear; echo "Backing up. Please wait..."; sudo dd if="/dev/"$source ibs=512 obs=512 iflag=fullblock,nonblock,noatime oflag=direct conv=noerror status=progress | sudo 7z a -mx9 -bd -si -mmt12 "$destination""$source""""$(date +%Y-%m-%d%H%M).img.7z"; echo "$(read -r -p "Backup complete. Press Enter to exit..." key)"; exit

4 Likes

Be aware: the disk and disk image may need to match size. If you create an image with a 500GB drive, it'll make a 500GB .img file. Moving to a larger disk isn't bad, Disks will just tell you the disk is larger than the image file size; usually need to extend the partition afterwards.. But, if it's a smaller disk than the image file size, you'll have to trim the disk image down to fit; as it doesn't differentiate between a full partition vs empty.

Just FYI! :grin:

This is how I backup my RPI images though, with Disks. Super easy. I don't know if PiShrink would work for the image files off an HDD/SSD vs an RPI image though - have gotten it to work on some non-RPI images in the past, has to be a .img to work.

2 Likes

(still had this in the clip board from another answer)
Really: USE DD!
You don't need any additional software that has a fancy gui.

dd if=/dev/XXX of=/dev/XXX status=progress

Just be really sure you have named the devices correctly. "dd" can't be made undone.
The last time I tried it on a Win11 hard disk. After swapping the disks, Win booted from the new hard disk without even noticing it.
The script above you only would need to do a backup, not a whole disk cloning.

And yes, dd only works if the new disk is at least as big as the old one. You can't clone a 2 TB HDD on a 1 TB SSD.

And yes, it needs TIME. The bigger the disk, the longer it takes (think twice about getting 4 TB).

1 Like

Thank you to all of you for those nice and precise pointers.

One remaining question though : how to connect HDD and SSD at the same time ? There's only one connector for the HDD, where I'll set the SSD in the end, but while cloning ? Is it possible to use the connector used by the DVD burner ?

1 Like

If you don't need the DVD drive in the meantime, yep - you can use that spot for sure. Then revert the DVD back in place after the transfer is complete. You may need to set the boot options afterwards to point to the new SSD for first boot.

1 Like

Thank you again. Just need to get the hardware now.

1 Like

No worries! :grin:

Well, you'd be surprised to read certain answers that newbies or less knowledgable members get on certain forums (concerning Linux or not). I'm in favour of mild mannered atmospheres (that must be the Calvin in me).

1 Like

Not surprised actually haha I've seen some pretty bad ones - not in the Zorin forums though, that's for sure.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.