Client-Side Caching for Offline Files
With the putback of PSARC 2008/758, the CIFS service provides per-share configuration options to support client-side caching (csc) for offline files, which can be set using sharemgr or zfs. Note that client-side caching and offline files are managed entirely by clients, and the options discussed here provide per-share policy advice to clients. The csc options are shown in below.
- manual
Clients are allowed to cache files from the specified share for offline use as requested by users but automatic file-by-file reintegration is not allowed. This is the default setting.- auto
Clients are allowed to automatically cache files from the specified share for offline use and file-by-file reintegration is allowed.
- vdo
Clients are allowed to automatically cache files from the specified share for offline use, file-by-file reintegration is allowed and clients are permitted to work from their local cache even while offline.
- disabled
Client-side caching is disabled for this share.
First, we need to create a file system and share it. For use with SMB/CIFS, it's best to create a mixed-mode zfs file system. If you have both NFS and SMB clients using a mixture of different character sets on the same file system you may also want to set utf8only and consider the charset=<access-list> NFS share property that Doug described in a recent blog entry.
zfs create -o casesensitivity=mixed -o utf8only=on tank/zvol
zfs sharesmb=name=zvol tank/zvol
sharemgr show -vp
default nfs=()
zfs
zfs/tank/zvol smb=()
zvol=/tank/zvol
The default, when no specific csc option has been set, is equivalent to csc=manual.
Since this share is a member of the zfs group, share options such as client-side caching must be set using the zfs command. In the following example the csc option is set to auto.
zfs sharesmb=name=zvol,csc=auto tank/zvol
sharemgr show -vp
default nfs=()
zfs
zfs/tank/zvol smb=(csc="auto")
zvol=/tank/zvol
Note: The zfs command interprets sharesmb as a property with a single value, even though that value may contain a list of share properties. When using the zfs command to set share options, all desired share options must be set each time the property is set or modified - as illustrated above. Failure to do this may result in share properties being unset. For example, after the two commands below, the share name would be tank_zvol rather than zvol.
zfs sharesmb=name=zvol tank/zvol
zfs sharesmb=csc=auto tank/zvol <-- resets the share name to tank_zvol
Alternatively, we can use sharemgr's default group or create our own group. In this example, we add a share to zgroup and disable client-side caching for that share.
sharemgr create -P smb zgroup
sharemgr add-share -r zvol2 -s /tank/zvol2 zgroup
sharemgr set -P smb -p csc=disabled -r zvol2 zgroup
sharemgr show -vp
default nfs=()
zfs
zfs/tank/zvol smb=(csc="auto")
zvol=/tank/zvol
zgroup smb=()
/tank/zvol2
zvol2=/tank/zvol2 smb=(csc="disabled")
Note that, as illustrated above, the csc setting is per-share.
The csc options are also valid for autohome shares in the smbautohome map. As with zfs sharesmb, multiple options can be specified as a comma separated list. For example,
* /export/home/& csc=disabled,description=&
john /export/home/& csc=auto,dn=sun,dn=com,ou=users
Some useful links for managing offline files on Windows:
Posted at 07:10PM Jan 09, 2009 by Alan Wright in Sun | Comments[2]