首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为什么我的命令不重新安装我的分区为只读?

为什么我的命令不重新安装我的分区为只读?
EN

Ask Ubuntu用户
提问于 2016-02-23 00:19:22
回答 1查看 330关注 0票数 -1

通过终端,我使用mount命令找到一个磁盘分区,我想要重新装入为只读。我正在使用的具体内容是/dev/sdb2

我试图使用以下命令将磁盘重新装入为只读,希望磁盘被重新装入为只读磁盘:

代码语言:javascript
复制
mount -o remount,r /dev/sdb2

没有错误输出。

但是,当我进入磁盘时,我能够在上面创建文件,这意味着磁盘没有以只读方式挂载。为什么是这种情况?

EN

回答 1

Ask Ubuntu用户

回答已采纳

发布于 2016-02-23 00:23:48

-o或挂载选项的上下文中,r并不等同于“只读”;事实上,它甚至不存在。您需要使用ro --完整的命令如下:mount -o remount,ro /dev/sdb2

r作为mount的选项存在的唯一位置是作为参数,而不是挂载选项。

mount上的手册中,我为您提供了一些信息部分。#-preceeded注释是我自己的,而不是从手册中得到的。

代码语言:javascript
复制
# '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.
票数 3
EN
页面原文内容由Ask Ubuntu提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://askubuntu.com/questions/737919

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档