3

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).

  • I think I read about this, or something similar, a couple months ago. So probably yes. Sorry can not remember anything more. Was reading about new kernel features regarding SSDs. – ctrl-alt-delor Jul 25 '15 at 10:45
  • @richard: lazytime? – Tyler Jul 25 '15 at 13:08
3

I found lazytime, a mount option for ext4, that solves this satisfactorily for me.

https://lwn.net/Articles/620086/

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 strictatime AND lazytime.

  • 1
    "Data loss in of atimes (and atimes only) is acceptable in some cases (e.g. power failure)." It would be nice if this answer explicitly acknowledged that you decided it was acceptable to lose mtimes/ctimes on power loss. If you have some reasoning then it might help other readers make such a decision. – sourcejedi May 27 '18 at 17:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.