digint / btrbk

Tool for creating snapshots and remote backups of btrfs subvolumes
https://digint.ch/btrbk/
GNU General Public License v3.0
1.69k stars 122 forks source link

btrbk + samba shadow_copy2 + windows clients #243

Open KlausWichtig opened 6 years ago

KlausWichtig commented 6 years ago

Hello together,

I just startet a project containing a samba server on a btrfs filesystem. Because of the windows-users the server must be a shadow-copy system supported by Windows. The btrbk script is working fine and creates snapshots and backups, but the Windows clients can't see the shadow-copies.

Current configuration: subvolume in /samba/dateiserver/filespace - with the data for samba subvolume in /samba/dateiserver/snapshots - with the snapshots

in btrbk.conf I am using: timestamp_format long-iso

btrbk is saving the snapshots in the directory in the following format (e.g.): filespace.20180710T090515+0200

I tried the Help from another Issue in smb.conf: vfs objects=shadow_copy2 shadow:snapdir=/samba/dateiserver/snapshots shadow:format=filespace.%Y%m%dT%H%M%S%z

but I can't see any shadow copies with Windows clients.

I would be very happy about any help. Thanks a lot Klaus

ghost commented 6 years ago

Try using basedir directive like this:

vfs objects = shadow_copy2 shadow:snapdir = /mnt/storagePool/snapshots/ shadow:basedir = /mnt/storageData shadow:sort = desc shadow:format = storageData.%Y%m%dT%H%M shadow:localtime = yes

KlausWichtig commented 6 years ago

Thank You for your help.

I am currently testing some other things and don't have a lot of time for the shadow copy. I'll reply as soon as I tested the basdir directive.

Thanks a lot Klaus

KlausWichtig commented 6 years ago

Hello again,

I tested the basedir but without any luck. Could there any problem with the location of the snapshots? Currently the snapshots and the data for the samba share are in different subvolumes and seperated from each other: /mnt/file/data/ - subvolume for samba share /mnt/file/snapshots/ - subvolume for snapshots

Thanks a lot Klaus

ghost commented 6 years ago

I think there was something with the time format to get it to work with Windows. Try the format I used.

Samba version 4.8.3.

KlausWichtig commented 6 years ago

Thank you for your support. Either there is a compability issue with time format or I am making a stupid mistake all the time. I am running Samba 4.7.6 with Ubuntu 18.04. There is no official upgrade for 4.8.3 available.

btrfs-subvolumes in /samba

ID 257 gen 534 top level 5 path dateiserver ID 258 gen 545 top level 257 path dateiserver/filespace ID 259 gen 545 top level 257 path dateiserver/snapshots

btrbk.conf (nearly the same as in Example: laptop with usb-disk for backups)

snapshot_dir snapshots timestamp_format long-iso snapshot_preserve_min 2d snapshot_preserve 30d target_preserve_min no target_preserve 20d 10w *m volume /samba/dateiserver subvolume filespace target send-receive /mnt/usb/backup

smb.conf

[public] comment=smbtest path=/samba/dateiserver/filespace browsable=yes writable=yes guest ok=yes vfs objects=shadow_copy2 shadow:snapdir=/samba/dateiserver/snapshots

shadow:basedir=/samba/dateiserver

shadow:format=filespace.%Y%m%dT%H%M shadow:localtime=yes shadow:sort=desc

Thanks a lot Klaus

ghost commented 6 years ago

Were you able to fix your issue? About a year ago I also had issues, but they turned out to be a windows issue. Look at #170 and also https://wiki.gentoo.org/wiki/Samba_shadow_copies

KlausWichtig commented 6 years ago

I've tried a lot of workarounds with the smb.conf but without success. :-(

If I make a manual Snapshot with sudo btrfs subvolume snapshot /samba/dateiserver/filespace /samba/dateiserver/snapshots/@GMT_date +%Y.%m.%d-%H.%M.%S everything is ok.

1n5aN1aC commented 5 years ago

I don't use timestamp_format long-iso but instead use timestamp_format long

With this configuration, I use the following samba config which works for me:

    vfs objects = shadow_copy2
    shadow:format = subvolumename.%Y%m%dT%H%M
    shadow:localtime = yes
    shadow:sort = desc
    shadow:snapdir = .btrbk_snapshots

I had problems until I specified shadow:localtime = yes