FS#71305 - [archinstall] Make btrfs mount with `noatime` instead of `relatime` in fstab

Attached to Project: Arch Linux
Opened by TheEvilSkeleton (TheEvilSkeleton) - Sunday, 20 June 2021, 00:11 GMT
Last edited by David Runge (dvzrv) - Saturday, 02 September 2023, 17:20 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To David Runge (dvzrv)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No



*Copy pasted from archlinux/archinstall#582[1]*

It's worse to use relatime with btrfs due to the nature of CoW, and is only practical in edge cases. Using atime with btrfs can bring to performance regression, excessive use of storage and more.

I highly recommend reading through the LVM article "Atime and btrfs: a bad combination?"[2] and GitHub comment[3] as they explain why using atime with btrfs is impractical for an average user.

Instead, we should be using noatime in the fstab.

P.S. Sorry if it's bad issue.

P.P.S. I was suggested to submit a ticket here: https://github.com/archlinux/archinstall/issues/582#issuecomment-863839645 .

Additional info:

[1] https://github.com/archlinux/archinstall/issues/582#issue-922040315
[2] https://lwn.net/Articles/499293/
[3] https://github.com/kdave/btrfs-progs/issues/377#issuecomment-862920890
This task depends upon

Closed by  David Runge (dvzrv)
Saturday, 02 September 2023, 17:20 GMT
Reason for closing:  Upstream
Additional comments about closing:  Please create tickets for upstream issues at https://github.com/archlinux/archinstall
Comment by Andreas Radke (AndyRTR) - Sunday, 20 June 2021, 17:57 GMT
What's the bug here? Usually the admin/user is responsible for the system administration and best settings.

If some default option is wrong please make clear if this is taken over from the installer or systemd or whatever pkg causes this issue.
Comment by TheEvilSkeleton (TheEvilSkeleton) - Sunday, 20 June 2021, 23:57 GMT
It's not a bug, but a feature request.

I think the culprit is the `genfstab` command provided by the package extra/arch-install-scripts and `mount` command. When running `mount PART DIR` where PART is a btrfs partition, the `mount` command mounts the btrfs partition with `relatime` option.

`genfstab -U /mnt >> /etc/fstab` uses the exact same mount options and pastes to fstab, including `relatime` (from what I understood, correct me if I'm wrong). However, in my opinion, using `noatime` is a better option due to the nature of CoW. relatime is best used in ext4 or other non CoW FSes, but can cause trouble on CoW FSes like btrfs and XFS as stated in [2] and [3] in the main post.

My request is to make genfstab use `noatime` on btrfs (but XFS would be nice too), as it is a CoW FS.
Comment by loqs (loqs) - Thursday, 24 June 2021, 05:11 GMT
Is there a way to determine which options are set as kernel defaults and which were explicitly specified on mount?
So genfstab would only override options that have not been specified by the user.
I can not find any mention of the issues with atime on [1]. If users as expected read the wiki page for the file-systems they intend to use and that covered mounting with the noatime option, then that would be picked up by genfstab and no change would be needed. This does not cover the case of archinstall which does not set the option and deferred the issue to this FS.

[1] https://wiki.archlinux.org/title/Btrfs
Comment by TheEvilSkeleton (TheEvilSkeleton) - Sunday, 04 July 2021, 13:28 GMT
Sorry for the later reply. From the same source you linked there is the following:

> Because of the copy-on-write nature of Btrfs simply accessing files can trigger the metadata copy and writing. Reducing the frequency of access time updates may eliminate this unexpected disk usage and increase performance. See fstab#atime options for the available options.

That being said, the LWM article and GitHub comment I mentioned above should give you sufficient information.

As for the rest, yeah, you're right.
Comment by Buggy McBugFace (bugbot) - Tuesday, 08 August 2023, 19:11 GMT
This is an automated comment as this bug is open for more then 2 years. Please reply if you still experience this bug otherwise this issue will be closed after 1 month.