为什么 mount 不显示 /etc/mtab 和 /proc/mounts 中显示的已安装文件的完整列表

为什么 mount 不显示 /etc/mtab 和 /proc/mounts 中显示的已安装文件的完整列表

我创建了一个用户有限的高山容器。
当我运行时,mount它会显示以下安装列表:

/home $ mount
overlay on / type overlay (rw,relatime,lowerdir=/var/lib/docker/overlay2/l/KCJQAGEW3UGOWIQ7UW5GDGWTOX:/var/lib/docker/overlay2/l/3JHGYTRTJDTUB7XAC2O3KY5H5V:/var/lib/docker/overlay2/l/CKRPXHOCDWFPZKZXBYX7MPUCA5:/var/lib/docker/overlay2/l/CFGI4PXVRIJRHPKXWK43PE4DZV:/var/lib/docker/overlay2/l/ZZFYGGBCUSMZ7IYP7WI6MWZFQN:/var/lib/docker/overlay2/l/33RI7BKMPTVKCWIELOGMUJ4J4N:/var/lib/docker/overlay2/l/5UVFPCW3G5AI4AV5FJPS26LBOA:/var/lib/docker/overlay2/l/AJ43E4MYURSH2SELF7GBM5V2N5:/var/lib/docker/overlay2/l/FX3YMXLJ5YQAWHGVLIEREQP6JM:/var/lib/docker/overlay2/l/I5OK5J522A4AMEDRJT4IS7C5FT:/var/lib/docker/overlay2/l/6C2J4DBBK4GUNQDQ4GO2WL7VTL:/var/lib/docker/overlay2/l/XTPDACLCJEZPLVH4I52PDC4XAL:/var/lib/docker/overlay2/l/DEHT4RSODLVYYQ65X7FNDTWUC7:/var/lib/docker/overlay2/l/J2ITJDS3MK3ZMTJKHLKAPTFZRY,upperdir=/var/lib/docker/overlay2/b8d14eb619c6fff58c9940cd78f4696975b157dffd5f6f6a6de00bca6d776c62/diff,workdir=/var/lib/docker/overlay2/b8d14eb619c6fff58c9940cd78f4696975b157dffd5f6f6a6de00bca6d776c62/work)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev type tmpfs (rw,nosuid,size=65536k,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=666)
sysfs on /sys type sysfs (ro,nosuid,nodev,noexec,relatime)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,relatime,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (ro,nosuid,nodev,noexec,relatime,xattr,release_agent=/lib/systemd/systemd-cgroups-agent,name=systemd)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (ro,nosuid,nodev,noexec,relatime,net_cls,net_prio)
cgroup on /sys/fs/cgroup/freezer type cgroup (ro,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/memory type cgroup (ro,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (ro,nosuid,nodev,noexec,relatime,cpu,cpuacct)
cgroup on /sys/fs/cgroup/pids type cgroup (ro,nosuid,nodev,noexec,relatime,pids)
cgroup on /sys/fs/cgroup/blkio type cgroup (ro,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/perf_event type cgroup (ro,nosuid,nodev,noexec,relatime,perf_event)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (ro,nosuid,nodev,noexec,relatime,hugetlb)
cgroup on /sys/fs/cgroup/devices type cgroup (ro,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/cpuset type cgroup (ro,nosuid,nodev,noexec,relatime,cpuset)
mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)
/dev/xvda1 on /etc/resolv.conf type ext4 (rw,relatime,discard,data=ordered)
/dev/xvda1 on /etc/hostname type ext4 (rw,relatime,discard,data=ordered)
/dev/xvda1 on /etc/hosts type ext4 (rw,relatime,discard,data=ordered)
shm on /dev/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=65536k)  

当我跑步时cat /etc/mtab或者/proc/mounts它向我展示了很多更大然后列出:

/home $ cat /etc/mtab
overlay / overlay rw,relatime,lowerdir=/var/lib/docker/overlay2/l/KCJQAGEW3UGOWIQ7UW5GDGWTOX:/var/lib/docker/overlay2/l/3JHGYTRTJDTUB7XAC2O3KY5H5V:/var/lib/docker/overlay2/l/CKRPXHOCDWFPZKZXBYX7MPUCA5:/var/lib/docker/overlay2/l/CFGI4PXVRIJRHPKXWK43PE4DZV:/var/lib/docker/overlay2/l/ZZFYGGBCUSMZ7IYP7WI6MWZFQN:/var/lib/docker/overlay2/l/33RI7BKMPTVKCWIELOGMUJ4J4N:/var/lib/docker/overlay2/l/5UVFPCW3G5AI4AV5FJPS26LBOA:/var/lib/docker/overlay2/l/AJ43E4MYURSH2SELF7GBM5V2N5:/var/lib/docker/overlay2/l/FX3YMXLJ5YQAWHGVLIEREQP6JM:/var/lib/docker/overlay2/l/I5OK5J522A4AMEDRJT4IS7C5FT:/var/lib/docker/overlay2/l/6C2J4DBBK4GUNQDQ4GO2WL7VTL:/var/lib/docker/overlay2/l/XTPDACLCJEZPLVH4I52PDC4XAL:/var/lib/docker/overlay2/l/DEHT4RSODLVYYQ65X7FNDTWUC7:/var/lib/docker/overlay2/l/J2ITJDS3MK3ZMTJKHLKAPTFZRY,upperdir=/var/lib/docker/overlay2/b8d14eb619c6fff58c9940cd78f4696975b157dffd5f6f6a6de00bca6d776c62/diff,workdir=/var/lib/docker/overlay2/b8d14eb619c6fff58c9940cd78f4696975b157dffd5f6f6a6de00bca6d776c62/work 0 0
proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0
tmpfs /dev tmpfs rw,nosuid,size=65536k,mode=755 0 0
devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=666 0 0
sysfs /sys sysfs ro,nosuid,nodev,noexec,relatime 0 0
tmpfs /sys/fs/cgroup tmpfs ro,nosuid,nodev,noexec,relatime,mode=755 0 0
cgroup /sys/fs/cgroup/systemd cgroup ro,nosuid,nodev,noexec,relatime,xattr,release_agent=/lib/systemd/systemd-cgroups-agent,name=systemd 0 0
cgroup /sys/fs/cgroup/net_cls,net_prio cgroup ro,nosuid,nodev,noexec,relatime,net_cls,net_prio 0 0
cgroup /sys/fs/cgroup/freezer cgroup ro,nosuid,nodev,noexec,relatime,freezer 0 0
cgroup /sys/fs/cgroup/memory cgroup ro,nosuid,nodev,noexec,relatime,memory 0 0
cgroup /sys/fs/cgroup/cpu,cpuacct cgroup ro,nosuid,nodev,noexec,relatime,cpu,cpuacct 0 0
cgroup /sys/fs/cgroup/pids cgroup ro,nosuid,nodev,noexec,relatime,pids 0 0
cgroup /sys/fs/cgroup/blkio cgroup ro,nosuid,nodev,noexec,relatime,blkio 0 0
cgroup /sys/fs/cgroup/perf_event cgroup ro,nosuid,nodev,noexec,relatime,perf_event 0 0
cgroup /sys/fs/cgroup/hugetlb cgroup ro,nosuid,nodev,noexec,relatime,hugetlb 0 0
cgroup /sys/fs/cgroup/devices cgroup ro,nosuid,nodev,noexec,relatime,devices 0 0
cgroup /sys/fs/cgroup/cpuset cgroup ro,nosuid,nodev,noexec,relatime,cpuset 0 0
mqueue /dev/mqueue mqueue rw,nosuid,nodev,noexec,relatime 0 0
/dev/xvda1 /etc/resolv.conf ext4 rw,relatime,discard,data=ordered 0 0
/dev/xvda1 /etc/hostname ext4 rw,relatime,discard,data=ordered 0 0
/dev/xvda1 /etc/hosts ext4 rw,relatime,discard,data=ordered 0 0
shm /dev/shm tmpfs rw,nosuid,nodev,noexec,relatime,size=65536k 0 0
overlay /run/docker.sock overlay rw,relatime,lowerdir=/var/lib/docker/overlay2/l/S3PCHQ53SAJYG5NZDNDQRU2XVE:/var/lib/docker/overlay2/l/62KIXQKVJBTRJ7SDUUYXZTSKCG:/var/lib/docker/overlay2/l/3725JLZLCOWYHRBEQP2J2QTNLA:/var/lib/docker/overlay2/l/VAGTKGBRCRYURRHYPLOMX6OOYS:/var/lib/docker/overlay2/l/KR6OCZTSJSXVHCKE5OVUQZRXKL:/var/lib/docker/overlay2/l/7BYHCEWKEAEE6EE5RZZ4SLDNQP:/var/lib/docker/overlay2/l/QSHWL6OBX4IRECFZEUTNTL4NC5:/var/lib/docker/overlay2/l/IEZLIF47GKVK3LXEDKTMQ3TZVG:/var/lib/docker/overlay2/l/BQ46TLLYUESHFVNKIBWHBWRSDP:/var/lib/docker/overlay2/l/IJYHXGW2NISOJTGYBST4HO2FW5:/var/lib/docker/overlay2/l/S7YI2SX46AKDOR4Y6V5N374AG4:/var/lib/docker/overlay2/l/TKTKBRROVY2AZ3SA446NJ4DC3Y:/var/lib/docker/overlay2/l/LMUO357ONLFEBEMMBMIVSYCQFO:/var/lib/docker/overlay2/l/P6VC5SYL5PJ55NABY7EKZGWUYY:/var/lib/docker/overlay2/l/I7ECJ5P5HFIPF2EUGIDQHRYELU:/var/lib/docker/overlay2/l/AUMVWZNGS3S4XNKDP4MUOD4ISJ:/var/lib/docker/overlay2/l/FDDSOXSMTMH4XZV6Q3ADNAA2VW:/var/lib/docker/overlay2/l/VAPXZHHJKAFCCIBF3RZNECEC7S:/var/lib/docker/overlay2/l/PK3TV6ZJUQYZUWA4TYZ4LQXQOT:/var/lib/docker/overlay2/l/YODPLRFWRSGNFVZ6SCQ3FVYRNS:/var/lib/docker/overlay2/l/6VCZPIJSKSLUW7ZR2OMS4OSYXW:/var/lib/docker/overlay2/l/ELLZBUAIOMXSHNCQZCGGKZYODO:/var/lib/docker/overlay2/l/HBC6DIHTS4YUQWK54KBSC6H5LM:/var/lib/docker/overlay2/l/3KKP5YZSANTIPPGCUEECHNZ52T:/var/lib/docker/overlay2/l/67BTI5QHRSVQMPSTYUHT4DMMK5:/var/lib/docker/overlay2/l/XLK6527B67ITIEEJLWCKV3YBPG,upperdir=/var/lib/docker/overlay2/d486d915eb64f61ea0d87f1fdef0ad6d092a70ec30e043c5843486131dfacf26/diff,workdir=/var/lib/docker/overlay2/d486d915eb64f61ea0d87f1fdef0ad6d092a70ec30e043c5843486131dfacf26/work 0 0
devpts /dev/console devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=666 0 0
proc /proc/bus proc ro,relatime 0 0
proc /proc/fs proc ro,relatime 0 0
proc /proc/irq proc ro,relatime 0 0
proc /proc/sys proc ro,relatime 0 0
proc /proc/sysrq-trigger proc ro,relatime 0 0
tmpfs /proc/acpi tmpfs ro,relatime 0 0
tmpfs /proc/kcore tmpfs rw,nosuid,size=65536k,mode=755 0 0
tmpfs /proc/keys tmpfs rw,nosuid,size=65536k,mode=755 0 0
tmpfs /proc/timer_list tmpfs rw,nosuid,size=65536k,mode=755 0 0
tmpfs /proc/timer_stats tmpfs rw,nosuid,size=65536k,mode=755 0 0
tmpfs /proc/sched_debug tmpfs rw,nosuid,size=65536k,mode=755 0 0
tmpfs /proc/scsi tmpfs ro,relatime 0 0
tmpfs /sys/firmware tmpfs ro,relatime 0 0  

为什么mount不向我显示已安装文件的完整列表?

答案1

问题不准确。根据手册页,挂载不反映 /proc/mounts 是预期的行为。

文件 /etc/mtab 和 /proc/mounts 可能与具有常规 mtab 文件的系统不匹配。第一个文件仅基于挂载命令选项,但第二个文件的内容还取决于内核和其他设置(例如,在远程 NFS 服务器上 - 在某些情况下,挂载命令可能会报告有关 NFS 挂载的不可靠信息)这是用 /proc/mounts 文件的符号链接替换 ​​mtab 文件的另一个原因。

关于 /etc/mtab 我可以部分回答这个问题。它是一个从 mount 维护的表,或者是 /proc/mounts 的符号链接。在第一种情况下,如果您明确指示 mount 不要写入条目(例如),则可能会出现差异。

在第二种情况下,如果 /etc/mtab 符号链接到 /proc/mounts,我没有解释为什么 mount 无法读取所有条目

相关内容