03 Feb 2006

hfsplus support under linux

back to some geeky programming on this blog:

i've been recently (ok, in the last 2 hours) i've been looking at the HFS+ support (mac os x default file system) support under linux. the problem is that there is no "common" file system that works on all platforms that doesn't suck.

1. FAT32 doesn't count because it barely supports files over 2G (has that changed recently, because i'm so detached from the windows world that i don't even know.)
2. NTFS has support on windows (obviously), mac (read only) and linux (read/write?) so that is one candidate.
3. Ext2/3 is supported on linux (obviously), there are third party drivers for mac and windows. I never got the mac driver to work well without running fsck over the whole fs every time it is mounted, but that was nearly a year ago.

i have a new 300G usb2 hard drive that i want to be able to use on both my mac and linux. so i can plug it in to either and share it on a network or do quick full backups on my powerbook. so the first thing i did was to format it hfs+, but i'm not quite sure that is a good idea. since i don't really care about windows support, i did some investigation into how well it is supported under linux.

so here's the current state as of 2.6.15, hfsplus is crippled to only mount journalised hfs+ as read only. before that, you could mount it, but if your partition was not cleanly umounted and the journal was not empty, the hfsplus module would ignore it and when you plug it back into a mac, it may or may not corrupt the partition, as apple explains in their technote.

a little diversion, i've been interacting with the new git repository on kernel.org, but it is actually quite a cool system. everyone can maintain their own repository with a list of patches and you can see exactly what patches each branch has applied and get the diff of it to revert on your own branch. for instance, check out the gregkh branch for the hfsplus module compared to the powerpc branch. there are some important bugfixes and even hfsx support. that is the case sensitive hfs+.

so i'm debating whether to mount hfs with --force to enable write, or just give the linux guys some time to either properly add journaling support (hint hint, here's the darwin implementation). or at least follow this guy's (who appears to be the linux-ntfs maintainer and cambridge student) recommendation and set the appropriate journaling version hack that older mac os uses to be able to mount journalising hfs+.

[UPDATE: oh yeah, i forgot to mention, hfsplusutils doesn't work at all on my usb external hard drive., and that the gentoo wiki page on hfsplus was quite informative about porting the bsd/darwin versions of mkfs.hfsplus and fsck.hfsplus. i have yet to try that, it seems a little too risky for my 300G of data at the moment. maybe if i have a spare external, i'll try that.]

You can reply to me about this on Twitter: