Saturday, June 15, 2013

Mounting Linux Partitions in OS X

So I'm dual booting Tiger and Debian on a Powerbook, and miserly me, I didn't set up an extra sharing partition to transfer files between the two. I didn't want that extra hard drive space to go mostly to waste, so I just decided not to deal with it. So where does that leave me now? I could SFTP to another computer and then back again. I could mount the OS X volume in Linux and read from its ~/Public folder. But what if I'm in OS X and want to mount my Linux partition and copy files over from there? I'm SOL, right? Not so fast.

With the install of a couple of tools, MacFUSE and fuse-ext2, you can mount ext2/ext3/ext4 filesystems in OS X. First caveat: I haven't had the guts to write to my Linux partition from OS X. I'm not sure how stable it is and I had no pressing need to experiment. But feel free to be your own guinea pig! That being said, I've had no problems mounting as read-only and copying files from Linux to OS X. So here's a quick how-to.

After you've installed MacFUSE and fuse-ext2, reboot unless you're one of those smartypants who knows you don't have to. I didn't want to find out if I was wrong, so I wimped out and rebooted. This is already going off on a tangeant. I'm also being distracted by pianobar running on Tiger (more on that later). I'll try to be better.

Anyway, once all that's done, fire up Terminal.app and create a new directory in your /Volumes folder with this command:

mkdir /Volumes/your_folder_name

(UPDATE: For some reason the folder disappears on me after reboot. I can just create it again as needed, but I don't know why it does this.)

I named mine /Volumes/Linux, but you can choose your own. Then you want to find out the identifier of your Linux partition. So run diskutil list and you should see your Linux partition among the output. The right column gives the identifier, in my case disk0s5. Now with that handy info you can mount your Linux partition with:

sudo fuse-ext2 /dev/disk0s5 /Volumes/Linux

Obviously replace disk0s5 and Linux with your own particulars. Only there's a bit of a problem here. In Tiger, and I think this is only an issue in Tiger, when you open /Volumes/Linux in the Finder, the folder disappears. Rather vicious bug, but you can still access it in the Terminal with standard commands like ls, cd, and cp, etc.

Also, the above mount command is read-only. If you want to try read/write and see how that goes, add "-o force" to the command.

Unmounting is a simple sudo umount /Volumes/Linux.

If you want the reverse, say total access to your OS X volume while booted in Linux, that involves a couple of issues. First, it'll be read-only unless you disable journaling in OS X. You also won't have access to OS X's home folder (except ~/Public) due to permissions issues. You can read all about how to get around that here and here. I haven't gotten around to experiencing this firsthand, so I'll farm it out to those links. Have fun!

6 comments:

  1. Thanks for the tips. In dual-triple boot configs in ATA drives it is logical to not have a partition to share things because it is to loose space for free.
    I like to write from windows in mac partitions and viceversa. Macdrive on windows let me do that. On iAtkos S3 (Snow Leopard Hackintosh) there is an option to do that and I always check for It. I think is based on Macfuse, but dont have a clue on it.
    Now I do not have any excuses for installing Linux on PowerPC!
    Before I said "I will not install linux because I cant share files between systems". Until today.

    ReplyDelete
  2. Zen put me onto the little trick of installing Netatalk on my PPC Linux installations. I can mount my Linux home directories on any OS X Mac from Tiger to Mountain Lion.

    ReplyDelete
  3. Then, I can share files from that machine with the dual-boot Mac once it is booted into OS X.

    ReplyDelete
  4. Thank You Dan! Finally a way to mount a Linux partition in OSX.

    ReplyDelete
  5. No link, but search mu commander to browse files graphically nothing hidden

    ReplyDelete
  6. It's worth noting that, if you're on Leopard, you can also use MacFUSE's successor, Fuse for OSX....err, macOS. Believe it or not but they're still building it for PPC!
    There's also a fuse filesystem project out there that allows you to mount exfat (aka FAT64) volumes in 10.5. Long story short, exfat is an upgrade Microsoft made to the old FAT32 filesystem that allows it to be used more efficiently on SD-cards (and other media where NTFS is useless). Only 10.6 and later have native support for exfat, which means PPC never got the official driver. If you use cameras or other media that run this new fs, this project might be useful to you. Here's the link: https://github.com/osxfuse/osxfuse/wiki/exFAT
    unfortunately they don't have binaries available, so you must compile from source.

    ReplyDelete