Gentoo Archives: gentoo-user

From: Tom H <tomh0665@×××××.com>
To: Gentoo User <gentoo-user@l.g.o>
Subject: Re: [gentoo-user] Bind stole my /
Date: Tue, 10 Nov 2015 13:23:05
Message-Id: CAOdo=SzzrGF0ne3s3w8vLchGo-wRZH0FeBYEn_2Xkd4Jv-EM=w@mail.gmail.com
In Reply to: Re: [gentoo-user] Bind stole my / by Mike Gilbert
1 On Tue, Nov 10, 2015 at 12:32 AM, Mike Gilbert <floppym@g.o> wrote:
2 > On Mon, Nov 9, 2015 at 2:36 PM, Jarry <mr.jarry@×××××.com> wrote:
3 >> On 08-Nov-15 17:58, Mike Gilbert wrote:
4 >>> On Fri, Nov 6, 2015 at 12:19 PM, Jarry <mr.jarry@×××××.com> wrote:
5 >>>>
6 >>>> I noted one strange thing today: It seems one of my servers lost "/"!
7 >>>>
8 >>>> vs5-dns ~ # df
9 >>>> Filesystem 1K-blocks Used Available Use% Mounted on
10 >>>> /var/log/named 10138552 2223148 7377344 24% /chroot/dns/var/log/named
11 >>>> tmpfs 308196 420 307776 1% /run
12 >>>> dev 10240 0 10240 0% /dev
13 >>>> shm 1540968 0 1540968 0% /dev/shm
14 >>>> cgroup_root 10240 0 10240 0% /sys/fs/cgroup
15 >>>> none 1048576 0 1048576 0% /var/tmp/portage
16 >>>
17 >>> Is your /etc/mtab a regular file, or is it a symlink to
18 >>> /proc/self/mounts? The latter is recommended.
19 >>
20 >> It is regular file. I never changed it...
21 >>
22 >> vs5-dns ~ # ls -l /etc/mtab
23 >> -rw-r--r-- 1 root root 908 Nov 9 19:14 /etc/mtab
24 >>
25 >>> Anyway, please have a look at the contents of /etc/mtab,
26 >>> /proc/self/mounts, and proc/self/mountinfo while named is running and
27 >>> when it is stopped. If you pastebin them we can take a look for key
28 >>> differences.
29 >>
30 >> With bind running:
31 >> http://pastebin.com/wkTW6xAY
32 >>
33 >> without bind:
34 >> http://pastebin.com/JG5FPNDW
35 >>
36 >> While I can see some differences there, I still do not understand
37 >> why is "/" missing in "df" output. BTW I can not proove it, but this
38 >> was not the case all the time. At least when I was tuning monitoring
39 >> software, I'm pretty sure "/" was there...
40 >
41 > It may be a bug.
42 >
43 > Can you try replacing /etc/mtab with a symlink to /proc/self/mounts to
44 > see if it makes any difference? That triggers different code paths in
45 > several programs.
46
47 From the OP's pastebin:
48
49 vs5-dns ~ # more /etc/mtab
50 /dev/sda2 / ext4 rw,noatime,data=ordered 0 0
51 /etc/bind /chroot/dns/etc/bind none rw,bind 0 0
52 /var/bind /chroot/dns/var/bind none rw,bind 0 0
53 /var/log/named /chroot/dns/var/log/named none rw,bind 0 0
54
55 vs5-dns ~ # more /proc/self/mounts
56 /dev/sda2 / ext4 rw,noatime,data=ordered 0 0
57 /dev/sda2 /chroot/dns/etc/bind ext4 rw,noatime,data=ordered 0 0
58 /dev/sda2 /chroot/dns/var/bind ext4 rw,noatime,data=ordered 0 0
59 /dev/sda2 /chroot/dns/var/log/named ext4 rw,noatime,data=ordered 0 0
60
61 There was a blog post a few years ago by the util-linux maintainer in
62 which he was pushing for users to symlink "/etc/mtab" to
63 "/proc/self/mounts" and he was explaining that having "bind" as a
64 property in mtab doesn't make sense because you could unmount the
65 "bound-to" mount and the "bound" mount would still show "bind" as a
66 property.
67
68 Is "/" shown when you run "df -a"? If it's shown, then there's a bug
69 in coreutils (as long as they accept a bug on a system where mtab
70 isn't a symlink) because, AFAIR, "df" should show the mount with the
71 shortest mount path if a filesystem's mounted more than once.

Replies

Subject Author
Re: [gentoo-user] Bind stole my / Jarry <mr.jarry@×××××.com>