默认的fstab安装选项


18

在干净的Ubuntu 11.04(Natty Narwhal)安装中,我仅使用一个分区来存储所有内容。在fstab文件中添加的行是这个

UUID=xxx     /      ext4    errors=remount-ro    0    1

那里不应该有“ 默认值 ”吗?

我在尝试将主文件夹移动到另一个分区时碰到了这一点。我已经做到了,一切工作正常。我仅errors=remount-ro在的fstab行中添加了/home。

现在,我正在“保护”它的过程中,并更加明智地选择这些选项(例如添加nodev和nosuid)。那么,是否需要添加“默认值”?为什么不添加?

Natty Narwhal中的“默认”到底是哪些特定选项?

我需要添加吗

UUID=xxx /home ext4 nodev,nosuid,errors=remount-ro 0 2

要么

UUID=xxx /home ext4 defaults,nodev,nosuid,error=remount-ro 0 2

或者是其他东西?

另外,我已经看到Natty Narwhal的默认设置为relatime。但是,如果在fstab中没有提及defaults关键字和“ mount”输出,则默认值是否正在运行?

Answers:


17

按照man mount(如果使用选项defaults):

   defaults
          Use default options: rw, suid, dev, exec, auto, nouser, and async.

当您使用矛盾的选项(例如defaults,noexec)时,后面者优先。

如果您未指定任何选项,则Ubuntu中的默认选项为rw,relatime。


2
因此,为了更好地理解它:当一个条目刚刚被errors=remount-ro翻译成rw,relatime, errors=remount-roor时rw,suid,dev,exec,auto,nouser,async,errors=remount-ro?我开始给人的印象是,如果未明确提及“默认值”,则无论如何都暗含了它,并且由于存在其他选项而存在冗余,因此已将其从fstab默认配置中删除。
— george_k 2011年

1
前者,即rw,relatime,errors=remount-ro。挂载某些内容时,可以通过发出命令mount或来检查其挂载选项cat /proc/mounts。
— 安排

2
有点不对劲。我刚刚测试了它:当我的fstab具有nodev,nosuid,errors=remount-ro/ home时,然后作为选项cat /proc/mounts返回rw,nosuid,nodev,relatime,errors=remount-ro,barrier=1,data=ordered。如果我编辑fstab并添加defaults关键字,那么它defaults,nodev,nosuid,errors=remount-ro在重新引导后将cat /proc/mounts返回与之前完全相同的内容。将defaultswhen添加到fstab至少在/ proc / mounts中没有任何变化。到底是怎么回事?
— george_k 2011年

2
嗯,你是对的。由于每man mount一次:一些选项可以允许或默认在系统内核被禁用。要检查当前设置,请参阅/ proc / mounts中的选项。最好一一列出所需的选项并检查其可用性。
— 安排

1
也man 8 mount说了error可供属性ext2是The default is set in the filesystem superblock, and can be changed using tune2fs(8)
— 安东尼Bardazzi
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.