Is there a fast way I can clone a partition on to another drive using a sector by sector copy, instead of copying individual files?

Solution 1:

Use dd to clone your drive/partition.

The syntax is simple:

dd if=inputfile.foo of=outputfile.bar bs=blockSize

This will do a bit for bit copy of your drive. Whatever your drive "looks like", including partition tables, will be copied.

For example, assuming your Time Machine drive's identifier is /dev/disk3 and your second USB drive's identifier is /dev/disk4, your command would be:

dd if=/dev/disk3 of=/dev/disk4 bs=1M

You can also write directly to the raw device by using /dev/rdiskX

sudo dd if=/dev/rdisk3 of=/dev/rdisk4 bs=1M

Keep in mind, you will need to unmount the devices first with the command sudo diskutil unmountDisk diskX

Copy Speed

You are correct in assuming that there is some overhead associated with copying files. However, what you may not be aware of is that USB 3 speeds aren't what they are cracked up to be. USB 3 is upto 5Gbs (gigabits per second)... in a lab, on a clear day, with a really strong tail wind, going downhill.

The actual speed of USB 3.0 is closer to 100Mbps1

So, doing a little calculation, we find that to transfer a 4TB file at 100Mbps means it will take roughly 10 and a half hours at best (it could go slower!)

What I have found to be the most reliable for me is that I copy the file to an internal drive (or a network share as a 1Gbs wired connection is significantly faster than USB will ever be) and once I have the image, I then copy it to my target.

Breaking it up into two separate processes:

sudo dd if=/dev/rdisk3 of=/Volumes/Some/Network/Share/file.img bs=1M

sudo dd if=/Volumes/Some/Network/Share/file.img of=/dev/rdisk4  bs=1M

This has the added benefit that if anything happens, there is a copy in a safe place.


1 PC World: USB 3.0 speed: real and imagined