The first thing to know is that FileVault is essentially an encrypted DMG file. The DMG is also "sparse," which means that it looks really big to the computer (to get around being limited to a fixed-size), but only stores blocks which haven't been allocated.
This sparse DMG image essentially looks like a physical disk. It's then formatted with a partitioning scheme, and the primary partition is attached to the filesystem at your home path, e.g. /Users/jon, not unlike how a normal /home partition would be mounted under Linux.
The cool thing is that the encryption/decryption happens at the physical device layer, not at the partition layer. So, if you happen to lose a file in OS X in a FileVault-protected directory, here's what you should do:
1. Open the terminal
2. Run "hdiutil info". This will spit out information about any mounted DMGs you have open:
framework : 283
driver : 10.6v283
================================================
image-path : /Users/.jon/jon.sparsebundle
image-alias : /Users/.jon/jon.sparsebundle
shadow-path :
icon-path : /System/Library/PrivateFrameworks/DiskImages.framework/Resources/CDiskImage.icns
image-type : sparse bundle disk image
system-image : TRUE
blockcount : 1258291200
blocksize : 512
writeable : TRUE
autodiskmount : TRUE
removable : TRUE
image-encrypted : TRUE
mounting user : root
mounting mode : -rwx------
process ID : 646
/dev/disk1 Apple_partition_scheme
/dev/disk1s1 Apple_partition_map
/dev/disk1s2 Apple_HFS /Users/jon
driver : 10.6v283
================================================
image-path : /Users/.jon/jon.sparsebundle
image-alias : /Users/.jon/jon.sparsebundle
shadow-path :
icon-path : /System/Library/PrivateFrameworks/DiskImages.framework/Resources/CDiskImage.icns
image-type : sparse bundle disk image
system-image : TRUE
blockcount : 1258291200
blocksize : 512
writeable : TRUE
autodiskmount : TRUE
removable : TRUE
image-encrypted : TRUE
mounting user : root
mounting mode : -rwx------
process ID : 646
/dev/disk1 Apple_partition_scheme
/dev/disk1s1 Apple_partition_map
/dev/disk1s2 Apple_HFS /Users/jon
You can see here that /dev/disk1 is the "physical" device associated with the DMG, and that the second partition, /dev/disk1s2 is formatted Apple_HFS and mounted at /Users/jon. Make a note of the path of this partition. It's a valid HFS+ partition, by the way; running the sleuthkit on it works just fine.
3. cd to somewhere that's outside of the mount point, e.g., /Users.
4. Run "sudo hdiutil unmount -force
5. Now you can do whatever you'd like with /dev/disk1s2, or /dev/disk1. You can dd it, grep it, run recovery tools against it, whatever. You should be warned, however, that because it's a sparse image, it will be appear much bigger than what it is. But it will be decrypted.
Nota Bene: All of this information is based on my own experimentation yesterday. Please let me know if I've made any mistakes.
No comments:
Post a Comment