A few weeks ago there was a thread on the Samba mailing list regarding some difficulties in getting my shadow copy patches to work with newer versions of Samba. These patches were originally written for Samba 3.0.25, and since then, Samba has moved up to version 3.4.3, with the 3.5.0 release on the horizon. The more recent Samba versions also include a shadow_copy2 module that will likely be replacing the shadow_copy module in the future.
I spent some time today adapting the original patches to the shadow_copy2 module. This patch was made against Samba 3.4.3, and I will be working on a version for Samba 3.5.x over the next couple days. I hope to get this integrated into Samba, but for now, it’s available below:
Creating a patched Samba source tree can be done with:
$ gzcat samba-3.4.3.tar.gz | tar -xf - $ cd samba-3.4.3 $ gzcat ../samba-3.4.3-shadowcopy.patch.gz | patch -p1
The parameters added with this patch, as shown at the top of the source file, are:
shadow:sort = asc/desc, or blank for unsorted (default) This is an optional parameter that specifies that the shadow copy directories should be sorted before sending them to the client. This is beneficial for filesystems that don't read directories alphabetically (e.g. ZFS). If enabled, you typically want to specify descending order. shadow:format = <format specification for snapshot names> This is an optional parameter that specifies the format specification for the naming of snapshots. The format must be compatible with the conversion specifications recognized by str[fp]time. The default value is "@GMT-%Y.%m.%d-%H.%M.%S". shadow:localtime = yes/no (default is no) This is an optional parameter that indicates whether the snapshot names are in UTC/GMT or the local time.
Example usage with ZFS for the
[homes] share is:
[homes] comment = Home Directories browseable = no writable = yes vfs objects = shadow_copy2 shadow: snapdir = .zfs/snapshot shadow: sort = desc shadow: localtime = yes shadow: format = %Y%m%d-%H%M%S
Where the snapshots would be taken with:
# zfs snapshot -r tank/home@`date +%Y%m%d-%H%M%S`
Recent versions of OpenSolaris allow ZFS snapshots to be created remotely over SMB/CIFS by simply creating a directory in the
.zfs/snapshot subdirectory. To see how this can be used, see my Windows Backups to ZFS post. Though referring to the SMB/CIFS server built into OpenSolaris, the concept works equally as well with Samba and the shadow copy patch.