我试过bind mount来解决在(以及and )是符号链接(跨文件系统:SSD到SATA)的系统上用pacman
(archlinux,更多有关此内容)安装某些软件包的问题。/var
/home
/usr/local
起初看起来不错,但是,正如Gilles指出的那样locate
,尽管有PRUNE_BIND_MOUNTS = "yes"
一行,但始终为单个文件给出多个结果/etc/updatedb.conf
。
$ locate \*/findutils-4.4.2 | xargs ls -ldiog
33816600 drwxr-xr-x 12 4096 Dec 3 00:05 /SHARED/LOCALS/Manjaro/src/findutils-4.4.2
33816600 drwxr-xr-x 12 4096 Dec 3 00:05 /usr/local/src/findutils-4.4.2
进一步研究,我发现可以正确地修剪更复杂的绑定安装:
$ sudo mount --bind /SHARED/LOCALS/common/ /usr/local/common
$ findmnt | fgrep -n sdb
34:├─/SHARED/LOCALS /dev/sdb5 ext4 rw,relatime,data=ordered
35:│ └─/SHARED/LOCALS/Manjaro/common /dev/sdb5[/common] ext4 rw,relatime,data=ordered
36:├─/usr/local /dev/sdb5[/Manjaro] ext4 rw,relatime,data=ordered
37:│ └─/usr/local/common /dev/sdb5[/common] ext4 rw,relatime,data=ordered
38:├─/SHARED/HOMES /dev/sdb4 ext4 rw,relatime,data=ordered
39:├─/home /dev/sdb4[/Manjaro] ext4 rw,relatime,data=ordered
40:├─/SHARED/VARS /dev/sdb3 ext4 rw,relatime,data=ordered
41:├─/var /dev/sdb3[/Manjaro] ext4 rw,relatime,data=ordered
42:└─/opt /dev/sdb5[/opt] ext4 rw,relatime,data=ordered
$ sudo updatedb --debug-pruning 2>&1 >/dev/null | grep bind
prune_bind_mounts\000
Rebuilding bind_mount_paths:
Matching bind_mount_paths:
Skipping `/SHARED/LOCALS/Manjaro/common': bind mount
Skipping `/usr/local/common': bind mount
$ locate \*/mmedia
/SHARED/LOCALS/common/mmedia
没有PRUNE_BIND_MOUNT选项,我将得到3个结果:
$ sudo sed -i '1 s/yes/no/' /etc/updatedb.conf
$ sudo updatedb --debug-pruning 2>&1 >/dev/null | grep bind
prune_bind_mounts\000
$ locate \*/mmedia
/SHARED/LOCALS/Manjaro/common/mmedia
/SHARED/LOCALS/common/mmedia
/usr/local/common/mmedia
$ sudo sed -i '1 s/no/yes/' /etc/updatedb.conf
绑定安装的另一个问题:
当然,可以手动将绑定安装(mounpoint或目标)添加到
PRUNEPATHS
in中/etc/updatedb.conf
。
另外,mountpoint
各种stat
命令或功能都可以在工具中使用,以改善文件系统的遍历,如本文所述