You can use the dd command to make a bit-perfect clone of a drive. It's a command line tool that ships with OS X. In order to make the clone perfect you'll need to ensure the source and the destination aren't actively in use.
To prepare for the clone I recommend creating a secondary boot disk that you can boot from. Your source for the clone should be an offline volume, not in use, when you're making the copy. Otherwise you risk copying things that are in incomplete states on disk.
With your machine booted to your secondary boot disk, log in and fire up a Terminal or iTerm window.
Run diskutil to get a list of your available drives. One of them will be your target drive you're trying to clone. The other will be your source drive. For example:
> diskutil list
/dev/disk0
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *320.1 GB disk0
1: EFI 209.7 MB disk0s1
2: Apple_HFS Macintosh HD 319.2 GB disk0s2
3: Apple_Boot Recovery HD 650.0 MB disk0s3
/dev/disk1
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *500.1 GB disk1
1: EFI 209.7 MB disk1s1
2: Apple_HFS Backup 499.8 GB disk1s2
/dev/disk2
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *500.1 GB disk2
1: EFI 209.7 MB disk2s1
2: Apple_HFS Clone 499.8 GB disk2s2
Let's say that Macintosh HD (disk0) is the source and Clone (disk2) is the target for our dd operation. Start the clone with:
> sudo dd if=/dev/rdisk0 of=/dev/rdisk2 bs=1m conv=noerror,sync
When dd finishes you may see an error like this:
dd: /dev/rdisk2: short write on character device
dd: /dev/rdisk2: Input/output error
3726+1 records in
3726+1 records out
500107862016 bytes transferred in 14584.393113 secs (34290619 bytes/sec)
That last error message is actually okay. The last block written was a short block because there wasn't a full 1MB block to copy. No worries.
Now you've got a bit-wise perfect clone of your Macintosh HD drive. Reboot your system using the Macintosh HD drive and enjoy your clone! And when we say bit-wise perfect we mean it. The disk structure is copied block-by-block so this dd approach works to copy data from a disk that uses a partitioning scheme that macOS doesn't natively support.
bs, as going above 1m actually makes it slower. (At least over USB. I can't tell if it's an external USB drive or a direct SATA connection.) – Nick ODell Dec 27 '12 at 22:18ddfor a given transfer without having to resort to trusting internet searches or doing trail-and-error runs? – Ian C. Aug 09 '14 at 16:32dd: /dev/rdisk2: Resource busyTrydiskutil unmountDisk /dev/rdisk2(or whatever your disk number is) – Bruno Bronosky May 15 '17 at 15:11ddshows you run time at the end of the run. It's not a "test" -- you have to actually copy the data to get the timing output. – Ian C. May 17 '18 at 18:59status=progressoption ofddto see the progress and transfer rate. Then you can abort withCRTL+Cand try with another value forbs– Wlad Aug 26 '18 at 14:26ddwill create a bit-for-bit perfect copy of your disk. Even if the content of the disk is a file system that macOS cannot read natively. It even copies the empty blocks from source to destination. One important point to remember is that the disk, and its partitions, should not be in use when you run theddcall to copy it. – Ian C. Aug 06 '21 at 00:29bs=1m conv=noerror,syncThanks ahead and your efforts – BabyBoy Aug 06 '21 at 06:49man CMDNAME, in this caseman dd. It explains the various options available, including the ones you ask about. – nohillside Aug 06 '21 at 18:53rdisk vs diskinfo from Archive: https://web.archive.org/web/20140209121637/http://lists.apple.com/archives/filesystem-dev/2012/Feb/msg00015.html – A.D. Feb 06 '23 at 08:46