-
Notifications
You must be signed in to change notification settings - Fork 244
Samba
vfs objects = shadow_copy2
shadow: snapdir = .zfs/snapshot
shadow: sort = desc
shadow: format = -%Y-%m-%d-%H%M
shadow: snapprefix = ^zfs-auto-snap_\(frequent\)\{0,1\}\(hourly\)\{0,1\}\(daily\)\{0,1\}\(monthly\)\{0,1\}
shadow: delimiter = -20
- You may expose snapshots to Windows users as shadow copies via Samba's vfs_shadow_copy2.
Some changes need to be made to zfs-auto-snapshot
first for proper snapshot naming (see issues/10 and pull/22).
$ cd /usr/src (or wherever you want to build the .deb)
$ git clone https://github.com/zfsonlinux/zfs-auto-snapshot.git
$ cd zfs-auto-snapshot
$ git merge origin/leecallen
$ editor src/zfs-auto-snapshot.sh (manually fix some code conflicts and change `sh` to `bash` first line)
$ git add .
$ git commit -a
Then continue using make install
or dpkg-buildpackage ...
if you're on Debian as explained here.
After making the above changes, zfs-auto-snapshot
honors a ZFS property defining where snapshots are created and where not. Set the property accordingly:
$ zfs set com.sun:auto-snapshot=true tank/data
$ zfs set com.sun:auto-snapshot=false tank/var
NB: The snapdir .zfs/snapshot
may remain hidden and Samba can still access them. Optionally hide them (from ls
, etc.) using $ zfs set snapdir=hidden tank
To expose shadow copies to Windows users, Samba needs its vfs_shadow_copy2
module.
On Debian do:
$ apt-get install samba-vfs-modules
Then configure smb.conf
by configuring your shares:
[global]
shadow: snapdir = .zfs/snapshot
shadow: sort = desc
# Specify snapshot name: frequent, hourly, daily... as desired
shadow: format = zfs-auto-snap_frequent-%Y-%m-%d-%H%M
[myshare]
path = /my/tank/data
read only = No
comment = ZFS dataset with Previous Versions enabled
vfs objects = shadow_copy2
On Windows check the "Previous Versions" of your share. There should be new elements in the list after some automatic snapshots are created by cron.