I want to clone my internal drive to an external one, byte for byte, partition table to partition table. My MBP is using GPT with APFS, the standard now-a-days. I do not have a T2 chip, but I do have a T1 chip. My internal drive is 500GB as is the external drive. Though, I think the issue may lie in the fact that my internal drive has a sector size of 4086 bytes and my external drive has a sector size of 512 bytes.
I tried to use dd
in recovery mode using the command dd if=/dev/disk0 of=/dev/disk4 bs=100m
but it was going super slow at 18 – 19 MB/s. (USB 3.1 SSD).
I booted into Linux and did a copy of the drive (using dd if=/dev/nvme01 of=/dev/sdb
) and it was much faster at 270 MB/s. I also was able to test within a virtual machine and got the same 270 MB/s speed. I confirmed that the first 100 MB between the drives were the same (used dd
and md5sum
).
I also confirmed the same way in recovery using dd
and md5
. But the drive didn’t have a partition table and macOS just read the drive as having something like 65 GB and refused to mount it.
So I recreated the partition map using parted and then restored the partitions. But macOS still refused to do anything with it. I’m guessing I need to dd
the synthesized disk from macOS but there is obviously something wrong with the USB driver since it’s writing so slowly.
I also tried copying the partition tables using sfdisk
but it failed because “first lba specified by script is out of range”.
I've also tried using cat
(cat /dev/disk0 > /dev/disk4
) and that didn't change the speed at all, so it's not dd
.
Here is the output of diskutil list
:
-bash-3.2# diskutil list
/dev/disk0 (internal):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme 500.3 GB disk0
1: EFI EFI 314.6 MB disk0s1
2: Apple_APFS Container disk2 500.0 GB disk0s2
/dev/disk1 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme +2.1 GB disk1
1: Apple_HFS macOS Base System 2.0 GB disk1s1
/dev/disk2 (synthesized):
#: TYPE NAME SIZE IDENTIFIER
0: APFS Container Scheme - +500.0 GB disk2
Physical Store disk0s2
1: APFS Volume Macintosh HD 288.0 GB disk2s1
2: APFS Volume Preboot 64.6 MB disk2s2
3: APFS Volume Recovery 1.0 GB disk2s3
4: APFS Volume VM 1.1 GB disk2s4
/dev/disk3 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: untitled +5.2 MB disk3
/dev/disk4 (external, physical):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *500.3 GB disk4
1: EFI EFI 314.6 MB disk4s1
2: Apple_APFS Container disk5 500.0 GB disk4s2
/dev/disk5 (synthesized):
#: TYPE NAME SIZE IDENTIFIER
0: APFS Container Scheme - +ERROR disk5
Physical Store disk4s2
/dev/disk6 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: untitled +524.3 KB disk6
/dev/disk7 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: untitled +524.3 KB disk7
/dev/disk8 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: untitled +524.3 KB disk8
/dev/disk9 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: untitled +2.1 MB disk9
/dev/disk10 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: untitled +524.3 KB disk10
/dev/disk11 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: untitled +524.3 KB disk11
/dev/disk12 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: untitled +12.6 MB disk12
/dev/disk13 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: untitled +4.2 MB disk13
/dev/disk14 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: untitled +1.0 MB disk14
/dev/disk15 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: untitled +2.1 MB disk15
/dev/disk16 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: untitled +524.3 KB disk16
/dev/disk17 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: untitled +524.3 KB disk17
/dev/disk18 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: untitled +1.0 MB disk18
/dev/disk19 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: untitled +524.3 KB disk19
/dev/disk20 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: untitled +6.3 MB disk20
/dev/disk21 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: untitled +6.3 MB disk21
/dev/disk22 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: untitled +524.3 KB disk22
/dev/disk23 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: untitled +2.1 MB disk23
Best Answer
You can absolutely use
dd
to clone your MacOS disk that has an APFS partition. The issue is that your source and target do not share the same sector size. This isn't a huge issue, though, as the only thing that matters is that the partitions are aligned to the sectors, not the data within them. So if you erase the target disk in Disk Utility selecting GUID and APFS as the scheme and format, then the partitions will be aligned. Then use dd to clone the individual partitions. That's it!Also, this is weird talking to myself in the 2nd person. But whatever.