Dominic Cleal's Blog

Sun Feb 22 15:09:50 GMT 2009

permalink BBS2 for a home NAS, part 3: sharing configuration

One of the niceties of the OpenSolaris ZFS integration is how easy it was to set up NFS and CIFS network file sharing. I started off with a ZFS dataset layout like this (yeah, yeah, 'tank'):

$ zfs list -r tank
NAME                USED  AVAIL  REFER  MOUNTPOINT
tank                359G  2.32T  26.9K  none
tank/home           359G  2.32T  28.4K  /export/home
tank/home/dominic   359G  2.32T   354G  /export/home/dominic
You can see in the above, the mountpoint of tank/home has been changed (zfs set mountpoint=/export/home tank/home) to replace the default rpool/export/home dataset (which I destroyed). I wanted any dataset under tank/home to be automatically available over NFS, to enable file compression and cross-protocol file locking for CIFS:
$ pfexec zfs set sharenfs=on tank/home
$ pfexec zfs set compression=on tank/home
$ pfexec zfs set nbmand=on tank/home
And then tank/home/dominic will inherit these properties:
$ zfs get sharenfs,compression,nbmand tank/home/dominic
NAME               PROPERTY  VALUE              SOURCE
tank/home/dominic  sharenfs     on                 inherited from tank/home
tank/home/dominic  compression  on                 inherited from tank/home
tank/home/dominic  nbmand       on                 inherited from tank/home
For my Linux desktop, I used autofs to mount the NFS filesystem automatically from the server ("argon") as it was needed. This simply needed two config changes (plus the installation of NFS utils and autofs itself). To /etc/auto.master, I added one line to define this set of automounts:
/home     /etc/auto.home  --timeout=60
And then the referenced /etc/auto.home config looks like:
*        -fstype=nfs,rw,nosuid,soft,intr        argon:/export/home/&
This matches any request for /home/<username> and automounts the NFS share argon:/export/home/<username>.

Lastly, I wanted the files available over CIFS as well. This was simply a matter of following these docs to get SMB connectivity working (with the exception of enabling the svc:/network/smb/server:default service, no need to import it).

Once the SMB server was running, I used the autohome share feature in Solaris to make user directories available as users identify and login to the server with their username/password. To do this, /etc/smbautohome simply contains:

*       /export/home/&

Amazingly, that's about the extent of the configuration on the system!

Other related posts:

Archives


Comments for this entry are now closed.