Fast, Easy, Cheap: Pick One

Just some other blog about computers and programming

Mounting an HFS+ Volume From Linux

Yesterday I spent some time figuring out how to mount a snapshot of one of our Mac server’s HFS+ volumes from our iSCSI SAN.
There doesn’t appear to be any clear instructions for how to use an HFS+ formatted device in Linux, but I finally figured it out.

You need the following kernel options:

(of course you can always put y where I put m, but I prefer to use modules).

Most howto’s online omit the CONFIG_EFI_PARTITION option, but it’s required for the kernel to recognize partitions on devices using the UUID partition scheme. You can tell if your device is one of these by looking at it in Disk Utility on a mac.

Now when you connect to a block device which contains an HFS+ volume, it will show up with several partitions. You can inspect them if you use parted. Typically the first one will be some kind of special EFI partition, and the second one will be the partition that contains the actual data.

You should not be able to mount it with something like
# mount -t hfsplus /dev/sdc2 /mnt/tmp

However, it appears that if you have a journaled filesystem you can only read and not write to the volume, even if mounted rw. Another thing to keep in mind is that it doesn’t appear that ACL’s or the resource fork are handled in any way at the moment…

The partition numbering is not entirely correct. After further experimentation, it appears to vary in different cases. In the case of two or three partitions, it’s the second one. In the case that four partitions appear, it’s the third.