From 82ec52d25b19977ce4618dc1ce7fa50eef6b406f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20St=C3=BChmer?= Date: Thu, 30 Apr 2015 14:33:43 +0200 Subject: [PATCH] Explaining shadow copies. --- Samba.md | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 Samba.md diff --git a/Samba.md b/Samba.md new file mode 100644 index 0000000..8285895 --- /dev/null +++ b/Samba.md @@ -0,0 +1,56 @@ +Make ZFS Snapshots work with Samba as Windows Shadow Copies +=========================================================== + +You may expose snapshots to Windows users as *shadow copies* via Samba's [vfs_shadow_copy2](https://www.samba.org/samba/docs/man/manpages/vfs_shadow_copy2.8.html). + +Install `zfs-auto-snapshot` +--------------------------- + +Some changes need to be made to `zfs-auto-snapshot` first for proper snapshot naming (see [issues/10](/zfsonlinux/zfs-auto-snapshot/issues/10) and [pull/22](/zfsonlinux/zfs-auto-snapshot/pull/22)). + + $ cd /usr/src (or wherever you want to build the .deb) + $ git clone https://github.com/zfsonlinux/zfs-auto-snapshot.git + $ git checkout leecallen + $ git merge master + $ editor src/zfs-auto-snapshot.sh (manually fix a conflict) + $ git add . + $ git commit -a + +Then continue using `make install` or `dpkg-buildpackage ...` if you're on Debian as explained [here](Debian). + +Configure ZFS +------------- + +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` + +Configure Samba +--------------- + +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 + shadow: format = zfs-auto-snap_%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 +---------- + +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. \ No newline at end of file