Mounting Mac HFS disks

Q I'm running Mac OS X (10.4 and 10.5) and Linux (Ubuntu and Fedora) systems at my house and I have external hard drives. My problems arise when backing up a system or files; there is plenty of information on Windows/Linux or Windows/Mac filesystem compatibility, but not on Linux/Mac options. I have a few 1TB external hard drives and need to store files over the 4GB limit of FAT32. I tried using NTFS, which works, but MacOS will start giving me an 'error 36' message. Linux used to have support for Apple filesystems but I do not see any support for Mac OS Extended (journalled) filesystems. Also Linux used to have terrible problems with Mac filesystem after the 30th mount and would then consider the drive dirty and unusable. Any recommendations on what format I should use for external drives between OSes?

A The Linux kernel does support the newer HFS+ MacOS filesystem, with some limitations. The main one is that it does not support writing to a journalled filesystem. This used to be a potential problem with earlier kernels, because it was still possible to mount a journalled filesystem read/write, write to it and cause inconsistencies between the filesystem and its journal. Newer kernels, since around 2.6.16, will mount a journalled HFS+ filesystem read-only, avoiding any potential corruption.

If you want to be able to share an external drive between Linux and Mac OS X, you should disable the filesystem's journal in OS X by selecting the device, pressing the Option key and clicking File > Disable Journalling.

Another potential problem is that Apple tries to be clever on some devices and wrap the HFS+ filesystem inside an HFS filesystem that displays a warning if you try to use the device with an older Mac OS that does not support HFS+. This can confuse the mount command's filesystem detection, causing it to recognise the drive as HFS and show you the warning message. The answer is to explicitly specify the filesystem when you mount it.

mount -t hfsplus /dev/sdb1 /mnt/external

You could also try adding the hfs module to your distro's modules blacklist file, which you will find in /etc (the exact name can vary). This may cause the system to recognise it only as an HFS+ disk, although we did not have an opportunity to test this. You would do no harm by trying this, as the drive will either mount correctly or not at all - the hfs module is not used to access HFS+ filesystems so blacklisting it cannot affect the drive contents.

The other, admittedly minor, drawback is that HFS+ filesystem tools are not easily available for Linux (it is possible to recompile the Darwin tools) so formatting and similar tasks are best done on a Mac. The warnings after 30 mounts without checking the drive should also disappear if you routinely use and check it on a Mac. There is another option, using the ext2 filesystem. There is a Mac driver for ext2 available from http://sourceforge.net/projects/ext2fsx. We haven't tried it, so test it on a drive that doesn't hold the only copy of something important, but using ext2 as a common filesystem would avoid the problems associated with HFS+, and there a Windows ext2 driver should you ever need to share the drives with a Windows system.

Follow us on Identi.ca or Twitter

Username:   Password:
Create Account | About TuxRadar