Do I need to restart my server after editing fstab and mtab?

Solution 1:

File /etc/mtab is maintained by the operating system. Don't edit it.

File /etc/fstab defines what should be mounted. It is read at system start.

When I add an extra disk to a system that should be mounted at system start I add it to /etc/fstab.

To check the correctness of the updated /etc/fstab I use the command mount -a. That reads /etc/fstab as system start, it mounts filesytems that aren'nt yet mounted.

It gives an error when the mountpoint is missing or the device is missing.

To answer the question on rebooting: No, there is no need to reboot after editing /etc/fstab. You can testdrive with mount -a

Solution 2:

You don't edit /etc/mtab manually.

You can, though, change your /etc/fstab to add or remove persistent mount points, i.e. the ones that will be mounted on startup. Also, the /etc/fstab file is used by the mount(8) command to refer to mount points.

You can safely define new mount points, or delete existing ones in /etc/fstab without altering the current state of the OS. You can manually mount(8) and umount(8) filesystems that reflect those changes; and you can also remount already mounted filesystems with dfferent options, e.g.:

mount -o remount,noexec /var

The question here is, why do you think you need bind mount points at all and what do you think you are going to achieve by using them? But I disgress.

When dealing with bind mount points, the steps to reconfigure your filesystems layout without restarting should be:

  1. Don't edit /etc/mtab manually
  2. stop the applications and services that use the filesystems you are going to modify. This is not always possible, but your use case seems to involve only filesystems dedicated to host log files under /var.
  3. umount all bind mount points.
  4. rewrite /etc/fstab to match your needs.
  5. manually mount the filesystems.