Monthly Archives: August 2007

Why I use the ‘noatime’ mount option.

Well, I’m back to posting. Hopefully, I shall continue this. The next few posts, I plan on jotting down all the little tweaks and configuration changes I make after every linux install that I do. The first of these is adding the mount option ‘noatime’.

To understand this, you need to first understand what ‘atime’ means. Traditional unix filesystems keep track of three ‘time’ attributes for every file on the system. These are:

mtime - The modification time (The time the file was last modified, duh!)
atime - The access time (The time the file was last accessed)
ctime - The change time (The time the inode of the file was last changed)

These attributes (along with others) can be viewed using the command “stat <filename>“. Among these three, having the system maintain the ‘atime’ attribute is by far the least useful.

Most applications that care about access times prefer to use the ‘inotify’ mechanism, instead of repeatedly polling the file. So, in other words, the system maintains a record that hardly anyone would look at. That, by itself, is not such a bad thing, however, if you consider the fact that the system has to write to the file’s inode every time the file is accessed ! you’d agree that having the ‘atime’ record is not only useless but also quite expensive.

So, how do you stop the system from doing this ? Well, use the ‘noatime’ option:

  • Edit the file ‘/etc/fstab’
  • Add the option ‘noatime’, separated with a comma, to the fourth field of every disk based filesystem entry
  • Save the file and reboot (or remount all the filesystems corresponding to the modified entries (using the command: mount -o remount ))

Well, all that said, here’s the article that inspired me to start this series of posts: Replacing atime with relatime

I always knew it made a difference, I just never did realize, nor care to measure how much of a difference ! Well. now I know, so do you. Thanks for reading.