我正在使用 Samba 设置 Ubuntu 服务器。文件系统是 BTRFS,我似乎无法让 Windows 从快照中查看以前的版本。
我的 smb.conf 有这个共享:
[Backup]
path = /mnt/pool1/backup
comment = Share for backups
writeable = yes
delete readonly = yes
browseable = yes
vfs object = recycle shadow_copy2
recycle:repository = /mnt/pool1/backup/.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:snapdir = /mnt/pool1/snapshots/backup
shadow:basedir = /mnt/pool1/backup
shadow:sort = desc
shadow:format = GMT-%Y.%m.%d-%H.%M.%S
目录结构如下:BTRFS卷挂载在/mnt/pool1,共享和快照目录位于该级别:
ll /mnt/pool1
total 20
drwxr-xr-x 1 root root 98 Jul 14 09:14 ./
drwxr-xr-x 4 root root 4096 Jul 14 09:13 ../
drwxrwxr-x 1 root users 74 Jul 14 11:28 backup/
drwxrwxr-x 1 root users 0 Jul 13 16:50 docker/
drwxrwxr-x 1 root users 0 Jul 13 16:49 homes/
drwxrwxr-x 1 root users 0 Jul 13 16:51 install/
drwxrwxr-x 1 root users 0 Jul 13 16:51 media/
drwxrwxr-x 1 root users 80 Jul 13 16:58 snapshots/
drwxrwxr-x 1 root users 0 Jul 13 16:51 timemachine/
ll /mnt/pool1/snapshots
total 16
drwxrwxr-x 1 root users 80 Jul 13 16:58 ./
drwxr-xr-x 1 root root 98 Jul 14 09:14 ../
drwxrwxr-x 1 root users 184 Jul 14 11:55 backup/
drwxrwxr-x 1 root users 0 Jul 13 16:58 docker/
drwxrwxr-x 1 root users 0 Jul 13 16:58 homes/
drwxrwxr-x 1 root users 0 Jul 13 16:58 install/
drwxrwxr-x 1 root users 0 Jul 13 16:58 media/
drwxrwxr-x 1 root users 0 Jul 13 16:58 timemachine/
使用的结构是快照目录每个共享都有一个子目录。您可以在我已有的快照上看到文件名:
tree -a
.
├── backup
│ ├── .recycle
│ │ └── ubuntu
│ │ └── File from windows - Copy.txt
│ ├── File from windows.txt
│ └── test.txt
├── docker
├── homes
├── install
├── media
├── snapshots
│ ├── backup
│ │ ├── GMT-2023.07.14-09.19.31
│ │ │ └── test.txt
│ │ ├── GMT-2023.07.14-09.30.57
│ │ │ └── test.txt
│ │ ├── GMT-2023.07.14-09.57.41
│ │ │ └── test.txt
│ │ └── GMT-2023.07.14-10.48.31
│ │ └── test.txt
│ ├── docker
│ ├── homes
│ ├── install
│ ├── media
│ └── timemachine
└── timemachine
我在日志中找不到任何内容可以帮助调查此问题,并且似乎没有任何方法可以从服务器端诊断问题所在。谁能建议这里可能出了什么问题或者我如何获得更多诊断信息?非常感谢,亚瑟
我在这个问题上花了很多时间,终于找到了解决方案。详细信息位于: https: //github.com/ArthurMitchell42/BTRFS_Snapshots,包括一个以正确方式生成快照的示例脚本。
smbd.conf 的关键设置是:
注意Shadow:localtime必须被注释掉,否则您将看不到任何内容,并且在每个共享中: