Sometimes you just need to do a quick sanity check on the filesystem mount status to make sure everything in fstab is mounted and everything’s that mounted is in the fstab. If, like myself, you’re a fan of NFS and bind mounts, getting a clear picture can get a bit hairy. So here’s an easy command making use of comm and the excellent findmnt utility to show any filesystems that should be mounted according to fstab but for some reason are not mounted:

To see any active mounts that are not in fstab you can use the following command:

The first findmnt gives you a list of what’s mounted according to the kernel. And the second part gives you a list of what should be mounted according to the fstab. Pretty simple. However, findmnt may not be available on older Linux versions. A viable alternative is the monutpoint command. Here’s a quick script that will list any filesystems from the fstab that are not mounted:

And here’s something extra: it may also be useful to make sure that whatever is listed in fstab and mtab as read-write actually is:

 

Leave A Reply

Please enter your comment!
Please enter your name here