Share ZFS partition on OS X host with an xhyve Linux Guest
I have a shared ZFS partition between OS X and Ubuntu 16.04. However, sometimes, I must stay on OS X and use xhyve
to run Linux guests.
When that happens, I want to mount my shared ZFS partition with my Linux guest. In my case, the Linux guest is a Scientific Linux 7.1 installation.
So how to go about doing this?
We begin by checking first if the sharenfs
property is enabled on OS X:
zfs get sharenfs
NAME PROPERTY VALUE SOURCE
data sharenfs on local
data/aj sharenfs on local
If not, you must run zfs set sharenfs=on ZPOOL_NAME
(where ZPOOL_NAME
is the name of the zpool you'd like to share over NFS, and then zfs share -a
. I had to reboot OS X for changes to apply.
Still in OS X, you'll want to set /etc/exports
to contain an entry like the one below:
# /etc/exports on OS X
/Volumes/data/aj -mapall=501 -network 192.168.64.0 -alldirs -mask 255.255.255.0
Then sudo nfsd restart
to apply the changes.
In my example above, data
is the zpool
, and data/aj
is the ZFS file system.
In the guest, you can then mount the NFS-shared ZFS file system with something like below:
sudo mount -o nolock -t nfs 192.168.64.1:/Volumes/data/aj/Developer/src ~/src