Score:0

Can't get Samba smv.conf shadow copy snapprefix to recognise snaps

tc flag

I'm really with this one. What I'm aiming for is that snpshots with an optional tag at the front, as well as untagged snaps are seen in windows as previous copies, e.g. file names such as:

/mnt/pool1/.snapshots/Backup/GMT-2023.07.16-12.53.26
/mnt/pool1/.snapshots/Backup/Sometagname_GMT-2023.07.16-12.53.26
/mnt/pool1/.snapshots/Backup/anothertagname23_GMT-2023.07.16-12.53.26

If I set the smb.conf up as follows the untagged shadow copies are seen by windows as expected.

shadow:snapdir = /mnt/pool1/.snapshots/Backup
shadow:basedir = /mnt/pool1/Backup  
shadow:sort = desc
shadow:format = GMT-%Y.%m.%d-%H.%M.%S
shadow:localtime = yes

I've tried every combination of regex and setting I can imagine but I can't find values for shadow:snapprefix and shadow:delimiter that achieve this. Here are some combinations I've tried for example:

shadow:format = %Y.%m.%d-%H.%M.%S
shadow:localtime = yes
shadow:snapprefix = ^[A-Za-z0-9]\{0,\}\(_\)\{0,1\}\(GM\)\{1\}
shadow:delimiter = T-
shadow:format = %Y.%m.%d-%H.%M.%S

shadow:format = GMT-%Y.%m.%d-%H.%M.%S
shadow:localtime = yes
shadow:snapprefix = ^[A-Za-z0-9]*\(_\)?
shadow:delimiter = GMT-
shadow:format = GMT-%Y.%m.%d-%H.%M.%S

Any help would be really appretiated as I've already spent several hours working through combinations and searching on line!

Score:0
tc flag

I've spent a lot of time on this and finally got to a solution. Details are here:https://github.com/ArthurMitchell42/BTRFS_Snapshots including an example script to generate he snapshots in the correct way.

The key settings for smbd.conf are:

[global]
   vfs object = recycle shadow_copy2 btrfs fruit cap catia

   recycle:repository = /mnt/pool1/%S/.recycle/%U 
   recycle:touch = Yes 
   recycle:keeptree = Yes 
   recycle:versions = Yes 
   recycle:noversions = *.tmp,*.temp,*.o,*.obj,*.TMP,*.TEMP 
   recycle:exclude = *.tmp,*.temp,*.o,*.obj,*.TMP,*.TEMP 
   recycle:excludedir = /.recycle,/tmp,/temp,/TMP,/TEMP 

;   shadow:localtime = yes
   shadow:sort = desc
   shadow:format = GMT-%Y.%m.%d-%H.%M.%S
   shadow:snapprefix = ^[A-Za-z0-9_]\{0,\}$
   shadow:delimiter = GMT-

NOTE shadow:localtime must be commented out or you will see nothing and in each share:

[Media]
   path = /mnt/pool1/Media
   shadow:snapdir = /mnt/pool1/.snapshots/Media
   shadow:basedir = /mnt/pool1/Media
    comment = Music, video and books
    writeable = yes 
    delete readonly = yes 
    browseable = yes
;    recycle:exclude = *,*.*,.*,.*.* 
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.