Disk cloning

About half a year ago, I needed more space for my ThinkPad x230 laptop. I had a 256 GB SSD, running Slackware 14.2, so I bought a new SSD of 1 TB. I did not want to go through all the hustle of repartitioning, reinstalling and reconfiguring, therefore I also bought a Fujitech Clone Dock 2. It is fairly simple to use, just place the disks in the correct order: Disk 1 (256 GB) to be cloned onto Disk 2 (1 TB), turn it on and click the Clone button twice. However, there is no way to tell the device to clone a specific partition only.

Therefore, I decided to use the dd tool. I have used it only for preparing a booting USB stick, so I searched a bit and found nice instructions in the excellent Arch Linux Wiki. There’s this warning, I have to quote:

As with any command of this type, you should be very cautious when using it; it can destroy data. Remember the order of input file (if=) and output file (of=) and do not reverse them! Always ensure that the destination drive or partition (of=) is of equal or greater size than the source (if=).

I used the Fujitech device to have both disks connected to my computer by USB3 and the system saw Disk1 and Disk2.

To clone a specific partition, sda1 (from Disk1) to sdb1 (from Disk2), I used the following command:

dd if=/dev/sda1 of=/dev/sdb1 bs=64K conv=noerror,sync status=progress

Then, I wanted to clone an entire hard disk (Disk 1), as well as the MBR, to another (Disk 2). That’s what the Fujitech device does, but I wanted to do it by dd. Following the instructions of the Wiki for cloning an entire hard disk, I did as root:

dd if=/dev/sda of=/dev/sdb bs=64K conv=noerror,sync status=progress

The Arch Wiki has the options explained, so let’s put them here, too:

  • bs= sets the block size. Defaults to 512 bytes, which is the “classic” block size for hard drives since the early 1980s, but is not the most convenient. Use a bigger value, 64K or 128K.
  • noerror instructs dd to continue operation, ignoring all read errors. Default behavior for dd is to halt at any error.
  • sync fills input blocks with zeroes if there were any read errors, so data offsets stay in sync.
  • status=progress shows periodic transfer statistics which can be used to estimate when the operation may be complete.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s