Is there a way to set atime writes to be cached for a very long time? I need atime (that is to say, relatime won't cut it), but I don't want it to effect performance so much. Data loss in of atimes (and atimes only) is acceptable in some cases (e.g. power failure).
lazytime, a mount option for ext4, that solves this satisfactorily for me.
This mode causes atime, mtime, and ctime updates to only be made to the in-memory version of the inode. The on-disk times will only get updated when (a) when the inode table block for the inode needs to be updated for some non-time related change involving any inode in the block, (b) if userspace calls fsync(), or (c) the refcount on an undeleted inode goes to zero (in most cases, when the last file descriptor assoicated with the inode is closed).
This option is available since kernel 4.0.
As well, it is necessary to override the default of
relatime, otherwise you get
relatime functionality in addition to the caching functionality of
lazytime. To do this, mount with