我非常赞同这一点。我的目标是,带有可选标签的快照以及未加标签的快照在窗口中显示为先前的副本,例如文件名如下:
/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
如果我按如下方式设置 smb.conf,则 Windows 将按预期看到未标记的卷影副本。
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
我已经尝试了所有我能想到的正则表达式和设置的组合,但找不到阴影:snapprefix和阴影:分隔符实现此目的。以下是我尝试过的一些组合示例:
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
我已经花了几个小时研究组合和在线搜索,因此非常感谢任何帮助!
答案1
我花了很多时间才找到解决方案。详情如下:https://github.com/ArthurMitchell42/BTRFS_Snapshots包括以正确方式生成快照的示例脚本。
smbd.conf 的关键设置是:
[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-
笔记阴影:本地时间必须被注释掉,否则你将看不到任何内容,并且在每个共享中:
[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 = *,*.*,.*,.*.*