user 是 fstab 中针对某个驱动器指定的挂载选项。但从 shell 脚本中,它需要超级用户权限

user 是 fstab 中针对某个驱动器指定的挂载选项。但从 shell 脚本中,它需要超级用户权限

我修好了它。它没有安装,因为其中的安装选项/etc/fstablogdev=带有外部日志的 xfs 选项。我使用它指定logdev=/dev/disk/by-uuid/<uuid of partition>它需要实际的设备节点,即/dev/sda2

更正后的脚本如下。


#Mount Debian mirror

if 
(( $(mount | grep -c mirror) == 0 )) && [ "$1" == "-m" ];
then
/bin/mount /home/tomas/mirror && echo "mirror has been mounted."
exit 0
elif
[ "$1" == "-m" ];
then 
echo "Mirror is already mounted."
exit 0
fi

if 
(( $(mount | grep -c mirror) == 1 )) && [ "$1" == "-u" ];
then 
sudo /bin/umount /home/tomas/mirror && echo "Umounting mirror."
exit 0
elif
[ "$1" == "-u" ] 
then
echo "Mirror is not mounted."
else
echo "Specify -m for mount or -u for umount."
fi
exit 0

相关内容