SMB vs. ZFS

ZFS users can manage SMB shares similar to the way they manage NFS shares. A new ZFS property, sharesmb, has been added that can be used to enable or disable SMB sharing on ZFS datasets. In general, it works the same as it does with NFS, but a few differences will be visible to users.

The simple case

Consider a ZFS pool "homes" with homes/user01 and homes/user02.  These can be shared via SMB by setting the sharesmb property. In the simplest case, zfs set sharesmb=on homes will start sharing while zfs set sharesmb=off homes will stop sharing. Using sharemgr to display the result shows one of the differences that does occur:

$ sharemgr show -vp zfs
zfs   nfs=() smb=()
          homes
                   homes=/homes
                   homes_user01=/homes/user01
                   homes_user02=/homes/user02

 Note that there is a resource name assigned to each dataset. Since SMB requires a resource name, the simple case of sharesmb will create a name from the dataset name by replacing the disallowed characters ('/' in this case) with an underscore '_' character.

If we expand the above example by creating a new dataset under user02 with zfs create homes/user02/db, the output of sharemgr show will be:

$ sharemgr show -vp zfs
zfs   nfs=()
          homes
smb=()
                   homes=/homes
                   homes_user01=/homes/user01
                   homes_user02=/homes/user02
                   homes_user02_db=/homes/user02/db

 A more complex case

Sometimes the dataset configuration may be deeper than the previous example and the resource names can get a bit long. The sharesmb implementation allows for changing the name to be used. Datasets that inherit the sharesmb property will use the new name as a prefix that replaces the dataset prefix.  For example, if the above example used a more global zpool "data" with homes being a child of data, the resource names would be prefxed with "data_" even if the data/homes dataset was given a mountpoint of /homes.  That is, the output of show would be:

$ sharemgr show -vp zfs
zfs   nfs=()
          homes
smb=()
                   data_homes=/data/homes
                   data_homes_user01=/data/homes/user01
                   data_homes_user02=/data/homes/user02
                   data_homes_user02_db=/data/homes/user02/db

If it is preferred to have /data/homes have a resource name of homes, use sharesmb=name=homes rather than just setting sharesmb=on. For example:


$ zfs set sharesmb=name=homes data/homes
$ sharemgr show -vp zfs
zfs   nfs=()
          data/homes
smb=()
                   homes=/data/homes
                   homes_user01=data//homes/user01
                   homes_user02=/data/homes/user02
                   homes_user02_db=/data/homes/user02/db

 

It is also possible to set any SMB share specific properties via sharesmb. Multiple resource names are also supported for SMB shares. The basic syntax for the sharesmb property is:

sharesmb=on|off|<property-lists>

where <property-lists> is a comma separated list of <property-list>. A <property-list> is a comma separted list of SMB share properties with an optional name=resource pseudo-property in front of it. So, if you use sharesmb=name=homes,name=maisons,ad-container=cn=Other when setting up the SMB sharing, each dataset will be shared with two resource names, homes and maisons.

 

$ sharemgr show -vp zfs
zfs   nfs=()
          homes
smb=()
                homes=/homes
                homes_user01=/homes/user01
                homes_user02=/homes/user02
                homes_user02_db=/homes/user02/db
                   maisons=/homes   smb=(ad-container=cn=Other)
                   maisons_user01=/homes/user01 
smb=(ad-container=cn=Other)
                   maisons_user02=/homes/user02 
smb=(ad-container=cn=Other)
                   maisons_user02_db=/homes/user02/db    smb=(ad-container=cn=Other)

 

Comments:

Thanks. This is great! Has this dropped already? If not when will this be widely available?

Posted by Tim Kennedy on November 07, 2007 at 08:16 AM MST #

This went back into build 77 of Solaris is in the current OpenSolaris source base.

Posted by Doug McCallum on November 08, 2007 at 12:07 PM MST #

Question: Does this share information stay with the zpool as it is exported around the world? For instance, if I share some datasets giving some users access to some things, how much of that information is portable with the pool?

A+ feature addition!

Posted by MC on November 08, 2007 at 01:27 PM MST #

Post a Comment:
Comments are closed for this entry.
About

dougm

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today