在 btrfs 上使用snapper时,是否有标准方法来排除用户主文件夹下的目录?说...~/.cache/yay
在拱门上。或者甚至可能~/.cache
作为一个整体。
当然,我知道 SOP 是在您希望将文件夹的内容从已安装文件夹层次结构中较高的子卷的快照中排除时创建一个子卷。但这意味着在~/
每次添加用户时为每个排除的文件夹创建一个子卷。也就是说,除了维护起来很麻烦之外,在正常用户创建之上还有很多额外的步骤。
我想我可以为它们创建包装脚本useradd
并将userdel
它们扔进去,/usr/local/sbin
以便它们优先。但我想我会看看是否有更优雅的方法。
语境
这并不重要。我目前部署了 snapper 的唯一系统是家庭网关,而且不太可能拥有多个非 root 用户。但很高兴知道未来。
子卷(不包括现有快照):
$ sudo btrfs subvolume list /
ID 258 gen 33625 top level 5 path home
ID 262 gen 33553 top level 5 path opt
ID 264 gen 33555 top level 5 path var-www
ID 266 gen 33630 top level 5 path arch
ID 267 gen 33631 top level 5 path var-log
ID 268 gen 33566 top level 5 path pacman-cache
ID 270 gen 45 top level 266 path var/lib/portables
ID 271 gen 46 top level 266 path var/lib/machines
ID 274 gen 33566 top level 266 path .snapshots
ID 276 gen 33556 top level 258 path home/.snapshots
ID 278 gen 33556 top level 262 path opt/.snapshots
ID 279 gen 33556 top level 264 path var-www/.snapshots
/etc/fstab:
# /dev/sda6 LABEL=system
UUID=18f47506-31c6-4d22-939d-684ace61301f / btrfs rw,noatime,compress=zstd:3,ssd,space_cache,subvolid=266,subvol=/arch,subvol=arch 0 0
# /dev/sda6 LABEL=system
UUID=18f47506-31c6-4d22-939d-684ace61301f /.snapshots btrfs rw,nodev,noexec,noatime,compress=zstd:3,ssd,space_cache,subvolid=274,subvol=/arch/.snapshots,subvol=arch/.snapshots 0 0
# /dev/sda1
UUID=27d5943f-e74d-480f-be46-a370c5b1f37f /boot ext4 rw,noatime,nodev,nosuid,noexec 0 2
# /dev/sda6 LABEL=system
UUID=18f47506-31c6-4d22-939d-684ace61301f /home btrfs rw,noatime,nodev,compress=zstd:3,ssd,space_cache,subvolid=258,subvol=/home,subvol=home 0 0
# /dev/sda6 LABEL=system
UUID=18f47506-31c6-4d22-939d-684ace61301f /home/.snapshots btrfs rw,nodev,noexec,noatime,compress=zstd:3,ssd,space_cache,subvolid=276,subvol=/home/.snapshots,subvol=home/.snapshots 0 0
# /dev/sda6 LABEL=system
UUID=18f47506-31c6-4d22-939d-684ace61301f /opt btrfs rw,noatime,nodev,nosuid,compress=zstd:3,ssd,space_cache,subvolid=262,subvol=/opt,subvol=opt 0 0
# /dev/sda6 LABEL=system
UUID=18f47506-31c6-4d22-939d-684ace61301f /opt/.snapshots btrfs rw,nodev,noexec,noatime,compress=zstd:3,ssd,space_cache,subvolid=278,subvol=/opt/.snapshots,subvol=opt/.snapshots 0 0
# /dev/sda6 LABEL=system
UUID=18f47506-31c6-4d22-939d-684ace61301f /var/log btrfs rw,noatime,nodev,nosuid,noexec,compress=zstd:3,ssd,space_cache,subvolid=267,subvol=/var-log,subvol=var-log 0 0
# /dev/sda6 LABEL=system
UUID=18f47506-31c6-4d22-939d-684ace61301f /var/www btrfs rw,noatime,nodev,nosuid,noexec,compress=zstd:3,ssd,space_cache,subvolid=264,subvol=/var-www,subvol=var-www 0 0
# /dev/sda6 LABEL=system
UUID=18f47506-31c6-4d22-939d-684ace61301f /var/www/.snapshots btrfs rw,nodev,noexec,noatime,compress=zstd:3,ssd,space_cache,subvolid=279,subvol=/var-www/.snapshots,subvol=var-www/.snapshots 0 0
# /dev/sda6 LABEL=system
UUID=18f47506-31c6-4d22-939d-684ace61301f /var/cache/pacman/pkg btrfs rw,noatime,nodev,nosuid,noexec,compress=zstd:3,ssd,space_cache,subvolid=268,subvol=/pacman-cache,subvol=pacman-cache 0 0
# /dev/sda5
UUID=5415bf33-0a89-4a36-a224-27dbb4c43977 none swap defaults 0 0