check_disk should look at /proc/mounts, not mtab
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
monitoring-plugins (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned | ||
Trusty |
Won't Fix
|
Undecided
|
Unassigned |
Bug Description
We have a machine in production that suffered a failure in one of its drives. We attempted unmounting the failed drive, but that only partially succeeded: the failed drive is not mounted anymore, but the umount process is stuck in D state.
$ ps aux | grep umount
root 502476 0.0 0.0 10480 2108 pts/6 S+ 22:21 0:00 grep --color=auto umount
root 3879507 0.0 0.0 19000 1492 ? D Apr08 0:07 umount /srv/ceph/ceph1
With the broken drive gone, I have then removed the (now empty) mountpoint /srv/ceph/ceph1.
Now our usual check is alerting:
$ /usr/lib/
DISK CRITICAL - /srv/ceph/ceph1 is not accessible: No such file or directory
I suspect this is due to check_disk running the -r regex against mtab[0], which umount hasn't had a chance to update yet.
Looking at /proc/mounts would better reflect the state of the system:
$ grep ceph1 /etc/mtab
/dev/bcache3 /srv/ceph/ceph1 xfs rw 0 0
$ grep ceph1 /proc/mounts
$
Changed in monitoring-plugins (Ubuntu): | |
status: | Incomplete → Invalid |
I thought /etc/mtab only exists for historical reasons.
And checking it shows:
lrwxrwxrwx 1 root root 19 Okt 12 2018 /etc/mtab -> ../proc/self/mounts
This is true at least back to Xenial (which I checked).
And for compatibility reasons programs often use /etc/mtab but it is actually the same.
Quoting the man page of mount:
"The programs mount and umount traditionally maintained a list of currently mounted filesystems in the file /etc/mtab. This real mtab file is still supported, but on current Linux systems it is better to make it a symlink to /proc/mounts instead, because a regular mtab file maintained in userspace cannot reliably work with namespaces, containers and other advanced Linux features."
So I wonder how the output can be different for you?
Do you not have that symlink set up?