Samba shadow copies

From Gentoo Wiki
Jump to:navigation Jump to:search

Samba has stackable VFS (Virtual File System) modules that can be used to extend with new features. One such VFS module is vfs_shadow_copy2. It is used to expose filesystem snapshots as Previous Versions to Windows clients.

This article explores using Samba to expose Shadow Copies as 'Previous Versions' to Windows clients.

Configuration

FILE /etc/samba/smb.confSamba config file
[share]
path = /mnt/pool/share
comment = Shadow Copy Enabled Share
 
vfs objects = shadow_copy2
shadow:snapdir = /mnt/pool/snapshots/
shadow:basedir = /mnt/pool/share
shadow:sort = desc
shadow:format = share_@GMT_%Y.%m.%d-%H.%M.%S
shadow:localtime = yes


shadow:format is used to match the snapshots in snapdir

user $ls -l /mnt/pool/snapshots
drwxr-xr-x 1 root    root         1252 Jan  4  2016 share_@GMT_2017.02.11-20.25.31 

Usage

Samba will automatically look for new snapshots and export them to Windows. A Windows client can then view them in the file's or folder's properties. Previous Versions as seen by a Windows client

See also

  • Btrfs snapshots — script to make automatic snapshots with Btrfs filesystem, using btrfs subvolume list-new function to create snapshots only when files have changed, so as to create fewer snapshots.
  • Samba — a re-implementation of the SMB/CIFS networking protocol, a Microsoft Windows alternative to Network File System (NFS).
  • Samba/Guide — provides a details guide showing users how to share files and printers between Windows and *nix PCs.

External resources