最近因为工作需要,配置了大量的服务器,在批量挂载NFS&SMB的时候,总是会遇到需要修改fstab,然后重启,再等待数分钟(内存自检速度极慢)进入服务器的痛苦过程。但其实和source命令类似,有这样一个命令能让我们不重启也能挂载fstab。

这个命令就是

mount -a

只需要在修改/etc/fstab文件后执行该命令,即可在不重启的情况下挂载fstab!

Ref:
(from linux man page)

The /etc/fstab, /etc/mtab and /proc/mounts files.
              The file /etc/fstab (see fstab(5)), may contain lines describing what devices are usually mounted where, using which options. The default  location  of  the  fstab(5)  file
              could be overridden by --fstab <path> command line option (see below for more details).
              The command
                     mount -a [-t type] [-O optlist]
              (usually  given  in  a bootscript) causes all filesystems mentioned in fstab (of the proper type and/or having or not having the proper options) to be mounted as indicated,
              except for those whose line contains the noauto keyword. Adding the -F option will make mount fork, so that the filesystems are mounted simultaneously.
              When mounting a filesystem mentioned in fstab or mtab, it suffices to give only the device, or only the mount point.