Adventures in ZFS: NFS Exports on Solaris 10 and 11

Adventures in ZFS: NFS Exports on Solaris 10 and 11

So with ZFS you really have two ways of configuring your NFS exports, you can do it the old fashioned way (read: /etc/dfs/dfstab and share command).  Or the super-duper easy method…  Use ZFS metadata, and allow ZFS to configure the export for you.  The reason why you might choose this approach is simple, if you don’t want to have to worry about configs, and especially if you need this export to be tied to the filesystem regardless of where you put the file system from system to system.  Pause for effect.  Your NFS exports can be TIED TO THE VOLUME AND NOT THE SERVER.  So if you have a USB drive that you are using to move data on, it can immediately share the data on another server when the pool is imported, same is true for LUNs.  This adds a lot of flexibility.

Read-Write for Everyone

solaris11~# zfs set share.nfs=on zpool/fs1
solaris11~# zfs set share=name=fs1,path=/zpool/fs1,prot=nfs zpool/fs1

 

solaris10~# zfs set sharenfs=on zpool/fs1

Read-Write for a Single IP

solaris11~# zfs set share.nfs=on zpool/fs1
solaris11~# zfs set share=name=fs1,path=/zpool/fs1,prot=nfs,sec=sys,rw=@192.168.1.1 zpool/fs1

 

solaris10~# zfs set sharenfs=sec=sys,rw=@192.168.1.1/24 zpool/fs1

Read-Write and Root for Multiple IPs

solaris11~# zfs set share.nfs=on zpool/fs1
solaris11~# zfs set share=name=fs1,path=/zpool/fs1,prot=nfs,sec=sys,rw=@192.168.1.1:@192.168.1.2,root=@192.168.1.1:@192.168.1.2 zpool/fs1

 

solaris10~# zfs set sharenfs=sec=sys,rw=@192.168.1.1/24:@192.168.1.2/24,root=@192.168.1.1/24:@192.168.1.2/24 zpool/fs1

That pretty much takes care of it.  Feel free to mix and match.  One thing to keep in mind.  If you specify it the old way and the new way, then the ZFS settings will take precedence.