Explaining shadow copies.

Roland Stühmer
2015-04-30 14:33:43 +02:00
parent 0e27ccf3cd
commit 82ec52d25b

56
Samba.md Normal file

@@ -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.