Do you need to specify the "defaults" option in fstab?

29,595

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
Share:
29,595

Related videos on Youtube

StrongBad
Author by

StrongBad

Updated on September 18, 2022

Comments

  • StrongBad
    StrongBad almost 2 years

    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?

    • Арсений Черенков
      Арсений Черенков over 9 years
      you have to specify defaults as least as place holder, however should you specify anything else (like ro or nosuid), you can forget default.