You are not logged in.
Pages: 1
Background:
The creation of partitions and their mounting commands (in fstab) during a typical installation, chronologically, looks like this:
1. we format a partition: mkfs.ext4 /dev/x
2. we mount it: mount /dev/x /mnt
3. we genfstab: genfstab -U /mnt >> /mnt/etc/fstab
After all that, in fstab we do see some options listed. Investigating the genfstab script on github, I see that genfstab mainly reads the options of the currently mounted mountpoint and simply copies them into the fstab file. This means that the options could only be made in step 2, when we mount the partition for the first time. The man page for mount does not say anything about how the default options are derived when only the device and mountpoint are given as arguments. My question is, how does the "-o" command-line option affect the default options?
Concrete question:
The current default options for my / mountpoint (ext4) are: rw,relatime. I want to replace relatime with noatime and keep the rest of default options. How do I do it in the most safe way?
Comment:
I already have a functional system installed. I am asking this for my installation script/tutorial, so that I know what to do when I need to install the system again.
Last edited by donaastor (2024-03-13 02:35:09)
Offline
If you pick an option that conflicts with a default your option takes precedence. You can just try and see the effect.
As for the manpage not mentioning anything in this regard the header of the filesystem-independent mount options mentions the following
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).The options nosuid, noexec, nodiratime, relatime, noatime, strictatime, and nosymfollow are interpreted only by
the abstract VFS kernel layer and applied to the mountpoint node rather than to the filesystem itself. Try:findmnt -o TARGET,VFS-OPTIONS,FS-OPTIONS
to get a complete overview of filesystems and VFS options.
The read-only setting (ro or rw) is interpreted by VFS and the filesystem and depends on how the option is
specified on the mount(8) command line. The default is to interpret it on the filesystem level. The operation
"-o bind,remount,ro" is applied only to the VFS mountpoint, and operation "-o remount,ro" is applied to VFS and
filesystem superblock. This semantic allows create a read-only mountpoint but keeps the filesystem writable from
another mountpoint.Since v2.39 libmount can use a new kernel mount interface to set the VFS options recursive. For backward
compatibility, this feature is not enabled by default, although recursive operation (e.g. rbind) has been
requested. The new option argument "recursive" could be specified, for example:mount -orbind,ro=recursive,noexec=recursive,nosuid /foo /bar
recursively binds filesystems from /foo to /bar, /bar, and all submounts will be read-only and noexec, but only
/bar itself will be "nosuid". The "recursive" optional argument for VFS mount options is an EXPERIMENTAL
feature.
Last edited by V1del (2024-03-13 03:01:22)
Online
Thank you, V1del, for pointing out to some details of the manual page. Unfortunately, I didn't find much use of it, here are the details:
If you pick an option that conflicts with a default your option takes precedence.
I already knew that, I just don't know what the defaults are.
You can just try and see the effect.
If I could do this easily, it would be great. However, I don't yet want to download and burn arch installation usb. (Let's search online first)
Some of these options are only useful when they appear in the /etc/fstab file.
To check the current setting see the options in /proc/mounts.
Since the mount happens for the first time right after the formatting, there is nothing in these two files.
Note that filesystems also have per-filesystem specific default mount options (see for example tune2fs -l output for extN filesystems).
I checked this, it doesn't list any of the options that end up in fstab.
Some of these options could be enabled or disabled by default in the system kernel.
Seems like this is the only place to look at (ugh).
After all, I think the only option left is to test these two lines on a real system and see what happens:
mount -o noatime /dev/... /mnt
mount -o defaults,noatime /dev/... /mnt
Offline
The defaults are defined on a per filesysterm basis and dependant on kernel config/version/how you formatted. For ext4 it's rw,relatime in "most" cases. The only way you can be sure is running the kernel, formatting something and seeing what happens, or reading through source code and then combining all possible combinations depending on the source you're looking at...
FWIW sicne noatime is filesystem agnostic, that's one you can always add.
Online
Pages: 1