通过终端,我使用mount命令找到一个磁盘分区,我想要重新装入为只读。我正在使用的具体内容是/dev/sdb2。
我试图使用以下命令将磁盘重新装入为只读,希望磁盘被重新装入为只读磁盘:
mount -o remount,r /dev/sdb2没有错误输出。
但是,当我进入磁盘时,我能够在上面创建文件,这意味着磁盘没有以只读方式挂载。为什么是这种情况?
发布于 2016-02-23 00:23:48
在-o或挂载选项的上下文中,r并不等同于“只读”;事实上,它甚至不存在。您需要使用ro --完整的命令如下:mount -o remount,ro /dev/sdb2
r作为mount的选项存在的唯一位置是作为参数,而不是挂载选项。
在mount上的手册中,我为您提供了一些信息部分。#-preceeded注释是我自己的,而不是从手册中得到的。
# 'mount' command arguments (NOT mount options, which are passed via `-o`!)
-r, --read-only
Mount the filesystem read-only. A synonym is -o ro.
-o, --options opts
Options are specified with a -o flag followed by a comma sepa‐
rated string of options. For example:
mount LABEL=mydisk -o noatime,nouser
# FILESYSTEM INDEPENDENT MOUNT OPTIONS
remount
Attempt to remount an already-mounted filesystem. This is com‐
monly used to change the mount flags for a filesystem, espe‐
cially to make a readonly filesystem writable. It does not
change device or mount point.
The remount functionality follows the standard way how the mount
command works with options from fstab. It means the mount com‐
mand doesn't read fstab (or mtab) only when a device and dir are
fully specified.
mount -o remount,rw /dev/foo /dir
After this call all old mount options are replaced and arbitrary
stuff from fstab is ignored, except the loop= option which is
internally generated and maintained by the mount command.
mount -o remount,rw /dir
After this call mount reads fstab (or mtab) and merges these
options with options from command line ( -o ).
ro Mount the filesystem read-only.
rw Mount the filesystem read-write.https://askubuntu.com/questions/737919
复制相似问题