By dougm on Nov 08, 2007
The SMB support brings a few new wrinkles to file sharing. For example, NFS requires that a given path only be shared once while SMB allows it to be shared multiple times. This is supported via the resource names as described in earlier articles. There are a couple of other differences that will be visible to administrators:
SMB shares are resource name based while NFS shares are path based
While NFS shares appear on the client relative to their paths, SMB shares end up flattening the name space and using the resource name as the way to find the data. What this means to the end user is that a file system hierarchy such as would be generated with ZFS won't appear as a directory hierarchy on the client when accessed via SMB. For example, consider the following ZFS hierarchy:
zfs create data/user1
zfs create data/user2
zfs create data/user2/database
zfs set sharenfs=on data
When seen from an NFS client using the /net/host mechanism, will appear as a full directory tree:
When using SMB, things are a bit different:
zfs set sharesmb=on data
From a Windows browser, you will see:
as three separate shares that can be mapped (or accessed). That is, they are all at the same level and attempting to go into the directory database in data_user2 won't get you to the data_user2_database share.
Sharing parent or child directories
NFS mandates that if a path is shared, then it is not also possible to share its parent or any of its subdirectories if they are on the same file system. SMB, on the other hand, expects to be able to do this. Sharemgr will allow you to share a parent or child directory if at least one protocol that is enabled for the group supports it. If not do, an error occurs.
In the case where a protocol does support it, the share will only be done for that protocol and an indication is made when the sharemgr show -vp command is run. A "not-shared-with=[protocol]" will be added to the line displaying the share/resource.
The Solaris SMB implementation concept of autohome shares can result in shares being created dynamically and not being stored in a configuration repository. While this is will appear in sharemgr output the same as a transient share for NFS (share -F nfs /path or sharemgr add-share -t -s /path group), the SMB autohome shares are not created directly by administrator action.
Share command output
The output of the share command works as it always has and shows the paths that are shared by the specified protocol. Currently, it only shows one entry for a path shared via SMB that has multiple resources asssigned. Share defaults to displaying NFS shares. To show SMB shares, use share -F smb. There is currently a limitation that only one instance of the SMB path is displayed via "share" even if there are multiple resource names defined.