Monday, June 8, 2009

Mounting Linux (ext2/ext3) partitions under Mac OS X

Ever tried accessing files under OS X from that external hard drive that used to be connected to your NAS or Linux box? Chances are you might have encountered one of these (Disk Insertion: The disk you inserted was not readable by this computer):



That's right, even though Mac OS X incorporates certain parts from FreeBSD's and NetBSD's implementation of Unix, it certainly doesn't have kernel support for the default file systems used by many popular Linux distributions. Luckily during Macworld 2007 Google introduced MacFUSE, a loadable kernel module for Mac OS X, that allows non-privileged users to create their own file systems without editing the kernel code. The project was based on FUSE a GPLed Linux module that provides a "bridge" to the kernel interfaces and allowing file system code to run in user space. Unfortunately neither projects supported the ext filesystem and it took until early 2008 before a guy named Alper Akcan finally introduced Fuse-ext2. 

With those two software packages we can now easily access drives containing ext2 (and ext3) partitions. Here's how:

  1. Download the latest MacFUSE binaries (MacFUSE-2.0.3,2.dmg) from the website at: http://macfuse.googlecode.com/.

  2. Mount the MacFUSE-2.0.3,2.dmg volume and install the MacFUSE package by double clicking its icon (MacFUSE.pkg).


  3. After the installation download the latest Fuse-ext2 binaries (fuse-ext2-0.0.5.dmg) from the website at: http://sourceforge.net/projects/fuse-ext2/.

  4. Also mount the fuse-ext2-0.0.5.dmg volume and install the fuse-ext2 package by double clicking its icon (fuse-ext2.pkg).


  5. Now that both packages are installed it's time to plug in our external drive containing the ext partition(s).

  6. In order to mount any (or all) of them we need to find out what their device name is. This can most easily been done by launching Disk Utility from the Utilities folder under Applications. In the left column you should see your hard drive and the names of the partitions it contains.


  7. In our case we would like to mount disk2s1 (highlighted in the screenshot above).

  8. We need the Terminal application to do this, which is located under Applications.

  9. After you launched Terminal.app we will create a new directory which will be the mount point for the partition on the drive. Once that's done we can use the fuse-ext2 command to actually mount the drive name mentioned above to the mount point.

    mkdir /Volumes/myextdrive
    fuse-ext2 /dev/disk2s1 /Volumes/myextdrive



  10. Congratulations! Your external drive should now be visible in the Finder.



Post a Comment