0

man mount describes -o defaults as including the following set of default mount options: rw, suid, dev, exec, auto, nouser, and async.

Will mount options enabled/disabled in the system kernel be added/removed from the -o defaults set of default mount options? Does the same apply to filesystem-specific default options?

How can I check the current -o defaults set of default mount options by inspecting /proc/mounts? It only lists all currently mounted filesystems.

man mount

FILESYSTEM-INDEPENDENT MOUNT OPTIONS
       Some of  these  options  are  only  useful  when  they  appear  in  the
       /etc/fstab file.

       Some  of  these  options could be enabled or disabled by default in the
       system kernel.  To  check  the  current  setting  see  the  options  in
       /proc/mounts.   Note that filesystems also have per-filesystem specific
       default mount options (see for  example  tune2fs  -l  output  for  extN
       filesystems).

        ...

        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.
Shuzheng
  • 4,411
  • -o defaults is something internal to the mount(8) utility. What has /proc/mounts to do with it? Why should you be able to inspect the defaults of a user-land utility via a kernel interface? –  Apr 22 '20 at 08:21
  • @mosvy - what about the sentence: Some of these options could be enabled or disabled by default in the system kernel. To check the current setting see the options in /proc/mounts.? – Shuzheng Apr 22 '20 at 08:49
  • That's alluding to the fact that the kernel may turn on some options by default, but it will show them explicitly in /proc/mounts, even if they're defaults. Eg. relatime (there was a recent discussion about it). If you mount a fs without any special options (no matter if you use the mount(8) program or use the mount(2) syscall directly), it will still have the relatime option in /proc/mounts or /proc/mountinfo. Maybe that manpage should be clearer and do less hedging around the facts -- go submit a documentation patch ;-) –  Apr 22 '20 at 08:56

1 Answers1

0

Simply check mount output ?

For example, given ~/tmpfile a file where i created a ext4 filesystem:

~$ sudo mount -t ext4 -o defaults tmpfile /media/cdrom
~$ mount|grep /media/cdrom
tmpfile on /media/cdrom0 type ext4 (rw,relatime)
binarym
  • 2,649
  • Shouldn’t it include all of defaults mount options given above? Yours only include real from that list. – Shuzheng Apr 22 '20 at 10:50