38

The Arch Wiki on fstab specifies the options of / to be defaults,noatime, but on my installation the default fstab is created with the options of rw,relatime. The Arch Wiki covers the atime issues. What I am curious about is the defaults option. The man page for mount says:

defaults

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

Note that the real set of all default mount options depends on kernel and filesystem type. See the beginning of this section for more details.

Are the default options used only if the defaults option is provided or are they used in all cases? Do I need defaults in my fstab?

1
  • 3
    you have to specify defaults as least as place holder, however should you specify anything else (like ro or nosuid), you can forget default.
    – Archemar
    Commented Mar 20, 2015 at 12:49

1 Answer 1

56

You only need defaults if the field would otherwise be empty.

You can leave out the options field altogether if it's empty, unless the 5th or 6th fields are present. Field 5 is the dump frequency, rarely used nowadays. Field 6 fsck order, should be 1 for /, 2 for other filesystems mounted on boot and 0 otherwise. Fields 5 and 6 can be omitted if their value is 0, except that field 5 needs to be present if field 6 is.

Thus defaults is necessary in

/dev/foo /foo somefs defaults 0 1

(though you can use some other option like rw or ro instead)

But it can be omitted when you specify another option.

eg: The mounts below have the same effect.

/dev/foo /foo somefs ro            0 1
/dev/foo /foo somefs defaults,ro   0 1

But these also have the same effect.

/dev/foo /foo somefs defaults      0 0
/dev/foo /foo somefs
1
  • While a 3-field fstab entry generally works, leapp (in-place upgrade utility for RHEL-based distributions) consideres it to be invalid and refuses to upgrade.
    – Karel Vlk
    Commented Apr 26, 2023 at 23:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .