我修改了/etc/fstab
。
我validation了这些新设备,并且可以使用mount
命令安装它们。
我如何validation对/etc/fstab
所作的修改?
你可以简单的运行: mount -a
-a挂载fstab中提到的所有文件系统(给定的types)。
该命令将挂载fstab中提到的所有(尚未挂载的)文件系统,并在引导过程中用于系统脚本启动。
mount命令采用--fake
或-f
简写。 以下命令应该做你需要的:
mount -fav
以下是-f
选项的文档:
Causes everything to be done except for the actual system call; if it's not obvious, this ``fakes'' mounting the filesystem. This option is useful in conjunction with the -v flag to determine what the mount command is trying to do.
我发现这个/问题/但解决scheme不符合我的要求。
使用/ etc / fstab中的任何无效条目进行重新引导时,如fsck无法检查的丢失文件系统; 系统将无法启动。 如果你有一个无头的盒子,这可能更难处理。
这是我的解决scheme来检查/ etc / fstab以避免这种启动问题:
# cat /usr/local/bin/check-fstab-uuid-entries.sh #!/usr/bin/env bash for x in $(grep ^UUID /etc/fstab|cut -d \ -f 1|cut -d = -f 2) do if [ ! -h /dev/disk/by-uuid/$x ];then echo $(grep $x /etc/fstab) ..... not found fi done
mount -a是检查/ etc / fstab的安全方法,否则错误的input可能会破坏系统
还build议保留原始/ etc / fstab文件的备份副本。 它可以被复制到根目录的主目录