[Samba] vfs_shadow_copy2 cannot read/find snapshots

Alexander Harm || ApfelQ alexander.harm at apfelq.com
Mon May 22 13:13:53 UTC 2023


Hi Sebastian,

why are you using shadow:snapprefix if this is just “snap”?

Does it work using ONLY shadow:format = snap_GMT-%Y.%m.%d-%H.%M.%S ?

If you use snapprefix you also need to use shadow:delimiter (in your case this would be “_”). However, I never managed to get it working with snapprefix on my machines.

Alexander

> On Monday, May 22, 2023 at 2:52 PM, Sebastian Neustein via samba <samba at lists.samba.org (mailto:samba at lists.samba.org)> wrote:
> Hi
>
> I am trying to get shadow_copy2 to read gluster snapshots and provide
> the users with previous versions of their files.
>
> Here is my smb.conf:
>
> [global]
> security = ADS
> workgroup = AD
> realm = AD.XXX.XX
> netbios name = A32X
> log file = /var/log/samba/%m
> log level = 1
> idmap config * : backend = tdb
> idmap config * : range = 10000-10100
> idmap config AD:backend = rid
> idmap config AD:range = 1000000-1999999
> vfs objects = acl_xattr
> map acl inherit = yes
> inherit acls = yes
> store dos attributes = yes
> winbind use default domain = yes
>
> [admin]
> path = /srv/glvol_samba/admin
> guest ok = no
> read only = no
> browseable = no
> administrative share = yes
> vfs objects = acl_xattr glusterfs_fuse
>
> [projects]
> path = /srv/glvol_samba/admin/projects
> comment = ARC Projekte
> guest ok = no
> read only = no
> shadow:snapdir = /srv/glvol_samba/admin/projects/.snaps
> shadow:basedir = /srv/glvol_samba/admin/projects
> shadow:sort = desc
> shadow:snapprefix = ^snap$
> shadow:format = _GMT-%Y.%m.%d-%H.%M.%S
> vfs objects = acl_xattr shadow_copy2 glusterfs_fuse
>
>
> I can go to a shared directory on the samba server and enter the .snaps
> subdirectory, in there I can see:
>
> root at XXX:~# cd /srv/glvol_samba/admin/projects/.snaps
>
> root at XXX:/srv/glvol_samba/admin/projects/.snaps# ls -ld
> drwxr-xr-x 2 root root 4096 1. Jan 1970 .
>
> root at XXX:/srv/glvol_samba/admin/projects/.snaps# ls -l
> insgesamt 28
> drwxrwx---+ 3 domadmin.sn domänen-benutzer 4096 16. Mai 16:31
> snap_GMT-2023.05.16-19.14.01
> drwxrwx---+ 3 domadmin.sn domänen-benutzer 4096 16. Mai 16:31
> snap_GMT-2023.05.17-19.14.01
> drwxrwx---+ 3 domadmin.sn domänen-benutzer 4096 16. Mai 16:31
> snap_GMT-2023.05.18-19.14.01
> drwxrwx---+ 3 domadmin.sn domänen-benutzer 4096 16. Mai 16:31
> snap_GMT-2023.05.19-19.14.01
> drwxrwx---+ 3 domadmin.sn domänen-benutzer 4096 16. Mai 16:31
> snap_GMT-2023.05.20-19.14.01
> drwxrwx---+ 3 domadmin.sn domänen-benutzer 4096 16. Mai 16:31
> snap_GMT-2023.05.21-19.14.01
>
> Until here, from my point of view, everything works as expected.
>
> But when I try to access a previous version of a file from a windows
> client, samba logs:
> [2023/05/22 10:39:52.278407, 1]
> ../../source3/modules/vfs_shadow_copy2.c:2222(shadow_copy2_get_shadow_copy_data)
> shadow_copy2_get_shadow_copy_data: SMB_VFS_NEXT_OPEN failed for
> '/srv/glvol_samba/admin/projects/.snaps' - Permission denied
> Even though the file has changed, the user cannot see a previous
> version. The list is empty.
>
> I can mount a single snapshot on a linux client into /mnt and see all
> files as expected:
> root at YYY:~# mount.glusterfs
> B741:/snaps/snap_GMT-2023.05.21-19.14.01/glvol_samba /mnt/
>
> On the samba server the gluster share is mounted with:
> root at XXX:~# mount -t fuse.glusterfs
> B741:/glvol_samba on /srv/glvol_samba type fuse.glusterfs
> (rw,relatime,user_id=0,group_id=0,allow_other,max_read=131072,_netdev)
>
> The systemd unit for this is:
> root at XXX:~# cat /etc/systemd/system/srv-glvol_samba.mount
> [Unit]
> Description=Data Dir
> After=network.target
> Requires=network-online.target
>
> [Mount]
> What=B741:/glvol_samba
> Where=/srv/glvol_samba
> Type=glusterfs
> Options=defaults,_netdev,negative-timeout=10,attribute-timeout=30,fopen-keep-cache,direct-io-mode=enable,acl
>
> [Install]
> WantedBy=multi-user.target
>
>
> The OS is debian 11.7 with sernet samba packages (4.17.8).
>
> Regards
> Sebastian
>
> --
> Sebastian Neustein
>
> Airport Research Center GmbH
> Bismarckstraße 61
> 52066 Aachen
> Germany
>
> Phone: +49 241 16843-23
> Fax: +49 241 16843-19
> e-mail:sebastian.neustein at arc-aachen.de
> Website:http://www.airport-consultants.com
>
> Register Court: Amtsgericht Aachen HRB 7313
> Ust-Id-No.: DE196450052
>
> Managing Director:
> Dipl.-Ing. Tom Alexander Heuer
> --
> To unsubscribe from this list go to the following URL and read the
> instructions: https://lists.samba.org/mailman/options/samba


More information about the samba mailing list