Score:1

Does `mount -a` make sure that I have a correct /etc/fstab file

in flag

Once a while, I need to adjust mountpoints of a server and it is not always possible for me to reboot the system right away. Therefore, to check if my revision to /etc/fstab is correct, usually I do mount -a to see if there are any complaints. If there are no complaints, I believe my /etc/fstab is okay and let the server team to reboot the server whenever they want.

However, I am keep wondering, is this really a very safe and reliable way? Let's say the external environment is the same (i.e., no broken hard drive or down remote sftp/NFS server), will mount -a always guarantee that the next reboot will NOT be interrupted because of incorrect /etc/fstab configuration?

Edit:

As pointed out by the comment from @GeraldSchneider, there is a pretty similar question being answered here: How do you validate fstab without rebooting?. However, I would like to add one more observation--hopefully this could differentiate my question from the previous one:

Say mount -a is going to mount all devices according to /etc/fstab and I want to remove noexec from one particular entry in fstab. It seems that mount -a will NOT make this removal effective and I have to actually restart the system to execute command inside the mountpoint.

This causes my concern on whether or not mount -a can really replicate everything that is going to happen after a real reboot.

in flag
Does this answer your question? [How do you validate fstab without rebooting?](https://serverfault.com/questions/174181/how-do-you-validate-fstab-without-rebooting)
Alex Kong avatar
in flag
ah @GeraldSchneider yes this basically answered my question. But I have a minor observation. Say `mount -a` is going to mount all devices according to `fstab` and I want to remove `noexec` from one particular entry of `fstab`, it seems that `mount -a` will NOT make this removal effective and I have to actually restart the system to execute command inside the mountpoint. This causes my concern if `mount -a` can really replicate everything that is going to happen after a real reboot.
Michael Hampton avatar
cz flag
The man page says you should use `findmnt --verify` instead. That aside, if you really intend an immediate change to mount options, just do it yourself.
Alex Kong avatar
in flag
Hi @MichaelHampton , what do you mean by "just do it yourself"?
Michael Hampton avatar
cz flag
I mean remount the mount with the new options. `mount -o remount /mountpoint` or `mount -a -o remount`
Alex Kong avatar
in flag
But sometimes the old mountpoint is being used...so usually I wait for a system reboot--not sure if this is the "correct way".
Michael Hampton avatar
cz flag
EIther way could be "correct". It depends on your specific circumstances.
Alex Kong avatar
in flag
For those who recommended `findmnt --verify`, I just tried on RHEL 7 and it turns out that...its `findmnt` (2.23.2) does not have a `--verify` option lol
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.