What do people use to clone all sorts of HDDs?

Acronis Trueimage

+10000000

For windows systems, disk2vhd is a neat little tool that lets you take a set of partitions and make them into a VHD or VHDX file. The latter of the two can be mounted with a double-click in Windows 10 provided the original disk is not in the system (duplicate partition IDs upset windows). This is not intended for cloning as much as it’s for backup, but I generally prefer to do clean windows installs whenever feasible anyway.

The file size is equal to the amount of used space, not the HDD/paritition size like more primitive utilities. It’s great for when you upgrade or reinstall Windows and want to have easy access to the old HDD or install to get your saved games and such. It may be possible to use disk2vhd or similar tools to convert a real HDD to a virtual HDD and run a VM from it.

For Macs, Carbon Copy Cloner was our go-to in the computer repair shop. There may be better solutions, but it was easy and our clients’ Macs generally weren’t running exotic configurations anyway.

For Linux and Windows, dd mixed with lz4, gzip or another compression tool is a quick and dirty way to clone to drives of equal or smaller size, or to create a backup. It a good idea to copy a backup image of the source drive to another PC in case something happens during the clone or after the fact. The general format I use for backups and restores is something like this:
dd if=/dev/... bs=1M | lz4 > /file.lz4
To decompress, and image another device:
lz4 -d /file.lz4 | dd of=/dev/... bs=1M
The bs=1M is just to try to make sure that I’m not spamming anything with 512b or 4k requests if it’s avoidable by using a larger block size. You can omit this argument and it will work the same. Keep in mind that dd creates a file which is equal to the total size of the partition/drive before lz4 compresses it. If you use filesystems like zfs or btrfs with transparent compression you can skip lz4, but I generally do it anyway so I don’t accidentally queue up a multi-TB transfer to a non-compressed filesystem in the future.

If you need to change the partition layout, sizes, or anything more involved I use gparted or something similar in a bootable live linux session. Parted magic was my (nonfree) go-to and tends to work better out of the box with RAID setups and such. If you are doing basic single disk-to-disk clones, get a debian live iso with your preferred desktop environment and run that from a USB stick to get access to gparted or equivalent. Within gparted you can create, resize, verify(kinda), and copy partitions and partition tables. If you need to boot from the cloned drive, I run this before gparted:
dd if=/dev/... of=/dev/... bs=10M count=1
to copy the partition table, bootloader, gpt/mbr and all that to the new drive. The partitions will appear to have been transferred, but only the first 10 MB was moved. After that I delete the (corrupt/missing) partitions from the target drive and copy them properly with gparted, making any size or alignment modifications I like. Windows will get upset on the first boot and will want to run chkdsk, but should boot fine once that finishes. Especially if you’re using that hack to move the bootloader with dd, I would suggest running chkdsk /f /r or equivalent on all the partitions you moved as a precaution.

Fancy filesystems like btrfs and zfs might not appreciate being dd’d around and may not work, I’d suggest reading into how to your particular filesystem first in case there are special requirements.

All of the above assumes you’re not doing data recovery from a malfunctioning drive. dd and many utilities will exit as soon as they encounter an i/o error, so the transfer will never finish. If you’re in that situation, I’ve used some ancient nonfree utilities for NTFS, maybe try ddrescue?

2 Likes

Or tac, and screw with peoples heads…

partition wizard
https://www.partitionwizard.com/

Good write up!

The idea is just to have a backup set of drives for various computers, in case a drive dies or the computer is not working right. We can just drop in the spare and not lose any time.
We also have a copy of all the drive images on a NAS, so we can create a new spare as required. Ideally, it should be quite easy to use. I fear DD might be a bit too dangerous for some users, even though it’s pretty easy to use. I do like the idea of piping it through lz4, that’s pretty cool.
Of course, the operating systems vary from Windows to Redhat Server, and the drive types vary from SATA/SAS to SCSI to compact flash.

Currently booting of a Clonezilla disk, and limited to SATA drives.