Will the dd disk clone commandline include partitions of various formats on macOS Catalina? [duplicate]

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.


Apple's bespoke command line utility to do disk cloning is asr.

It is tailored to the specifics of OS X needs to perform file by file as well as block based imaging and deals with differences in partition sizes, allows network streaming (and even multicast streaming) as well as copying between disks that are locally connected. Unlike dd, it knows about Apple's latest Core Storage volume management and is the program that the graphical Disk Utility calls to move data from one partition or volume to another.

You can read more at the manual page for asr.