Update: Starting with Samba 4.5.0 and higher, Samba can be made more permissive in snapshot names it accepts. For those versions it should be easier to only adjust Samba and **no longer necessary adjusting the snapshot names** themselves as explained below. (Cf. new Samba options `shadow:snapprefix` and `shadow:delimiter`.) Try the following:
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
zfs-auto-snapshot
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.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.3