Freebsd – Reading FreeBSD UFS formatted external drive in Mac OS X

filesystemsfreebsdosxufs

I have an external USB drive with backup files formatted in FreeBSD's UFS file system. When I plug it into a computer running Mac OS X 10.9.4, I cannot read the drive's contents, and I don't have physical access to a machine running FreeBSD.

Is there a way to read this drive on a Mac? I only need read-only mode to copy the files to the local filesystem.

Thanks.

Best Answer

I found this tutorial. It's untested by me but several commenters to the article attested to it working. The article is titled: Mount a ufs2 Volume in MacOS/X 10.7 (Lion).

excerpt

If you have to mount an ufs2 volume (for example an external FreeNAS disk) in MacOS/X Lion, you can do the following:

  1. Download and install OSXFUSE from http://osxfuse.github.com/. Reboot the system.
  2. Download this ZIP file from https://github.com/osxfuse/filesystems.
  3. Download and install XCode from http://developer.apple.com/xcode/. This is a prerequisite for step 10.
    • Download and install XCode.
    • Launch XCode.
    • Open XCode preferences.
    • Go to tab "Downloads".
    • Locate "Command Line Tools".
    • Click "Install" and enter your credentials.
  4. Locate the directory unixfs in the unzipped source code downloaded in step 2.
  5. Open a terminal window.
  6. Enter sudo -s and supply your admin password.
  7. Copy unixfs (see step 4) to /usr/local/include/osxfuse/ (cp -R unixfs /usr/local/include/osxfuse/).
  8. Enter cd /usr/local/include/osxfuse/unixfs/ufs.
  9. Enter ln -s /usr/local/include/osxfuse/fuse.
  10. Enter make.
  11. Create a mount point, for example mkdir usb.
  12. Enter diskutil list and look for the identifier of the external drive containing the UFS volume (for me it was "disk1s1").
  13. Enter ./ufs --dmg /dev/disk1s1 --type ufs2 usb, replacing "disk1s1" with the actual identifier under "usb" with the mount point created in step 11.
  14. Enter df -h to see if the volume has been mounted.
Additional Notes
  • The ufs2 volume will be mounted read-only.

  • I didn't find a way to see the volume in the Finder, not even with "Go to Folder...", so I had to copy the files I wanted to work with using a command like cp -R macHOTEL /Users/gutzmtho/Downloads. It didn't help to create the mount point in /Volumes. As pointed out in one of the comments below: "You can see it in Finder, when you are logged in as root user." (thanks to the contribution!)

  • Another option is to set up a virtual machine inside the Mac, for example FreeBSD or Ubuntu. There you see the files in the Finder equivalent of Linux, but copying files across is awkward because ".AppleDouble" files will not be copied - at least using drag and drop, unless you make files starting with a "." visible.

Related Question