atime, relatime and noatime

Most filesystems take note of the last time a file was accessed, this is known as atime. The downside of always knowing when the file was last accessed is that even if you don't change any of the data within the file, the disk still has to write the new atime information. Atime updates are a terrible waste of time. It turns read-only operations into writes just to keep atime up to date. So with the release of the 2.6.20 Linux kernel relatime was introduced. relatime only updates whenever the file data is changed. Atime was still default until the recent release of the 2.6.30 kernel where relatime became the default.

But you can save yourself even more IO operations with the noatime mount option. It turns out that very few programs actually care when the file was last accessed (according to Theodore Tso, mutt is pretty much the only one and there are workarounds).

To switch to noatime, open up a terminal and enter:

sudo nano /etc/fstab

Replace relatime or atime with noatime. Save and close. Pretty simple. A side note: a lot of other tutorials will also suggest that you add nodiratime (stops the atime update of accessing a directory). This is unnecessary as the noatime option also includes nodiratime (see these comments)


Post a Comment