hfs+ on linux

I got a new MacBook from work and need to migrate files from my old Dell notebook running Xubuntu Linux.  Luckily, I had recovered a drive from a bricked machine that was donated to pages that I could use to transfer the files.

I don’t like the Fat32 file system, so I formatted the external drive as hfs+.  My workstation, running Debian, mounted the drive fine, but I couldn’t write.  I found that I had to disable journaling on the drive before I could write it in Linux:

$ diskutil disableJournal /Volumes/ghingexternal

Note: that command has to be run on the Mac.

Once I did this, I could write to the disk, but only as root.  Permissions of hfsplus partition, a thread on the Ubuntu message boards, provides this insight which is likely the case:

I got a new MacBook from work and need to migrate files from my old Dell notebook running Xubuntu Linux.  Luckily, I had recovered a drive from a bricked machine that was donated to pages that I could use to transfer the files.

I don’t like the Fat32 file system, so I formatted the external drive as hfs+.  My workstation, running Debian, mounted the drive fine, but I couldn’t write.  I found that I had to disable journaling on the drive before I could write it in Linux:

$ diskutil disableJournal /Volumes/ghingexternal

Note: that command has to be run on the Mac.

Once I did this, I could write to the disk, but only as root.  Permissions of hfsplus partition, a thread on the Ubuntu message boards, provides this insight which is likely part of the problem (since the mountpoint of the hfs+ formatted drive has uid:gid 99:99 on my Linux box):

I have to preface my entry with the warning that I am a complete newbie. I was having the same problem with accessing my files on my hfs+ partition. What I discovered is that by default OSX doesn’t allow any access for the gid for files and folders in your User’s folders. I don’t know if this is the wisest thing, but I went into the Finder, did a “Get Info” on all the files/folders I wanted to access in Ubuntu, I then went under permissions and switched the Group ID to something I could use in Ubuntu. I then made sure that the line in the fstab that mounts my hfs+ partition had a “gid=XXX” statement that matched what I set in OSX. I also made sure that the user I was using in Ubuntu was part of the group mentioned above. If this doesn’t make sense, let me know and I will clarify. Also, if you need help with OSX permissions, here is a link to an Apple KB article: http://docs.info.apple.com/article.html?artnum=107039

HFS filesystem woes

So I had this external firewire drive that I use both on my Linux box and my OS X box.  When I try to mount it under linux, I get an error saying “HFS-fs warning: Filesystem was not cleanly unmounted, running fsck.hfs is recommended.  mounting read-only”.  However, the drive works fine under OS X, and running fsck on my OS X box reports no problems.  I even tried running the linux port of the OS X fsck for HFS (afaik there is no native Linux version of the utility) as described at http://gentoo-wiki.com/HOWTO_hfsplus.  This reports no problems either, but it still doesn’t set that unclean flag back.  The only solution I can think of at this point is to modify the hfs kernel module to not do that chek so it will mount the drive read-write, set the bit back, and let me cleanly unmount the drive.  Then I can replace my modded module with the original, safety-conscious one.  This seems like a bad way to do it, but I couldn’t find a better alternative.