I've used dd
on Linux to make a block for block bootable copy of a LUKS encrypted volume which created a bootable encrypted clone. I'm trying to achieve the same on a Filevault2 volume, disk0
as internal disk. I want to write this to an identically sized partition on an external USB disk.
I made the destination partition a GUID Journaled extended HFS+ journaled to match the original volume. The dd
finished but the partition is unusable, doesn't unlock, mount or boot.
I'm thinking of reformatting the partition as DOS and writing over it with dd
again. Would it be safe to hope the partition will inherit the desired scheme from the source? It takes 4 hours to write 250GB and wanted to see if anyone else had done this before.
Filevault2 reconfigures the single partition on disk0, to add the recovery partition after 10.7 giving you something like this:
/dev/disk0
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *250.1 GB disk0
1: EFI 209.7 MB disk0s1
2: Apple_CoreStorage 249.2 GB disk0s2
3: Apple_Boot Recovery HD 650.0 MB disk0s3
/dev/disk1
#: TYPE NAME SIZE IDENTIFIER
0: Apple_HFS Macintosh HD *248.9 GB disk1
disk1
is the encrypted data of the core storage logical volume. This is similar to what happens in LUKS on Linux.
So my hope is to get this into a partition on a shared 1 TB external drive. Any thoughts on what format to make that partition would be appreciated.
Best Answer
Just to rectify one thing: disk1 is not the encrypted data. Disk1 is a mounted "virtual" volume with its own disk identifier. This volume is unlocked and as such unencrypted if you are a legitimate user. It's based on inferior encrypted data structures residing in disk0s2.
To clone (and subsequently decrypt) FileVault2 volumes successfully three objects/data structures are important:
To clone a FileVault2 volume you may either
dd
the CoreStorage LVG and the Recovery HD or copy the unlocked FileVault2 volume to a second volume with rsync or Disk Utility/a disk cloner like Carbon Copy Cloner.dd:
diskutil list
.sudo gpt -r -vv show /dev/diskX
with diskX: the disk with the CoreStorage LVG containing the FileVault2 Logical Family/Volumegpt
.dd if=/dev/rdiskXs1 of=/dev/rdiskYs1
to copy the EFI partitiondd if=/dev/rdiskXs2 of=/dev/rdiskYs2
to copy the CoreStorage LVGdd if=/dev/rdiskXs3 of=/dev/rdiskYs3
to copy the Recovery HDDisk Cloner
This will not create an identical disk (same intermediate/final keys etc.) but a volume containing identical data.