Reading a ZFS USB drive with Mac OS X Mountain Lion
By Karim Berrah-Oracle on Sep 27, 2012
I'm using a MacBook, mainly with Solaris 11 (yes it works), but something with Mac OS X (ML). The only missing thing is that Mac OS X can't read my external ZFS based USB drive, where I store all my data. So, I decided to look for a simple solution, where the whole and latest features of ZFS would be possible for free, and even being able later to benefit from any ZFS update that might be included in any Solaris 11 updates.
I decided to use VirtualBox with a Solaris 11 VM as a passthrough to my data. Here are the required steps:
Install a Solaris 11 VM
- Install VirtualBox on your Mac OS X, add the extension pack (needed for USB)
- Plug your ZFS based USB drive on your Mac, ignore it when asked to initialize it.
- Create a VM for Solaris (with a host-only adapter like vbox-net0). and before installing it, create a USB filter (in the settings of your Vbox VM, go to Ports, then USB, then add a new USB filter from the attached device "grey usb-connector logo with green plus sign")
- Install a Solaris 11 VM, boot it, and install the Guest addition
- check with "ifconfg -a" the IP address of your Solaris VM, let say 192.168.56.101
Creating a path to your ZFS USB drive
- In MacOS X, use the "Disk Utility" to unmount the USB attached drive, and unplug the USB device.
- Switch back to VirtualBox, select the top of the window where your Solaris 11 is running
- plug your ZFS USB drive, select "ignore" if Mac OS invite you to initialize the disk
- In the VirtualBox VM menu, go to "Devices" then "USB Devices" and select from the dropping menu your "USB device"
Connection your Solaris VM to the USB drive
- Inside Solaris, you might now check that your device is accessible by using the "format" cli command
- If not, repeat previous steps
- Now, with root privilege, force a zpool import -f myusbdevicepoolname because this pool was created on another system
- check that you see your new pool with "zpool status"
- share your pool with NFS: share -F NFS -o rw=192.168.56.1,root=192.168.56.1 /myusbdevicepoolname
here 192.168.56.1 is the vbox-net0 adapter IP adress, that your Mac OS will automatically have once the Solaris VM has booted, supposing that you kept the 192.168.56.0 netwpork for vbox-net0 (standard)
Accessing the USB ZFS drive from Mac OS X
- This is the easiest step: access an NFS share from mac OS
- Create a "ZFSdrive" folder on your MacOS desktop
- from a terminal under mac OS: mount -t nfs IPaddressofMySolarisVM:/myusbdevicepoolname /Users/yourusername/Desktop/ZFSdrive
et voila ! you might access your data, on a ZFS USB drive, directly from your Mountain Lion Desktop.
You can now, from inside the Solaris 11 VM:
- activate compression
- use encryption
- use dedup
- replicate your ZFS pool to a remote location by using the zfs send/receive
(Change the VM's network settings into "bridged")
- manage your file system integrity
- upgrade your ZFS pool when any Solaris 11 update is available
- ... and use all the settable ZFS native properties
You might want now to reduce the memory footprint of your Solaris VM at the minimum: this can be done in various ways before reducing the memory allocated to the VMS: You will need to keep the running Solaris services at the minimum, disable Gnome, and much more ...
You might notice that Solaris and Mac OS X do not count in the same way Gigabyte (ZFS LIST showing 287GB of available disk space, while Mac OS X seeing 307.87 GB of available network space). But this is another story.