问题原文
原帖链接 · el.pescado - нет войне · CC BY-SA 3.0
I have a system with following /etc/mtab:
/dev/disk/by-label/foobar /etc/somefile ext4 rw,relatime,data=ordered 0 0
/dev/disk/by-label/foobar /var/lib/somedir ext4 rw,relatime,data=ordered 0 0
/dev/disk/by-label/foobar /mnt/foobar ext4 rw,relatime,data=ordered 0 0
/dev/disk/by-label/foobar /mnt/foobar/somedir ext4 rw,relatime,data=ordered 0 0
i.e. the same device mounted in different mount points. What's more:
- Those directories have different contents (this precludes
mount --bindcase) - Some of those mount points are regular files
Strangely enough, df -h shows only one of those mount points:
/dev/disk/by-label/foobar 2.8G 70M 2.6G 3% /mnt/foobar
How is this possible? What's going on?
已采纳解答
原帖链接 · iwaseatenbyagrue · CC BY-SA 3.0
/etc/mtab is showing the result of using bind mounts, is my guess. You can bind mount any directory, and I suspect you are seeing the result of that.
$ mkdir test/ /tmp/test
$ sudo mount --bind test/ /tmp/test
$ cat /proc/mounts
<..snip...>
/dev/root /tmp/test ext4 rw,noatime,data=ordered 0 0
This question provides a more in-depth explanation/example: https://unix.stackexchange.com/questions/128471/determine-what-device-a-directory-is-located-on
df -h is not showing these because bind mounts are 'dummy' filesystems, and df requires -a to show those.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
