<body><script type="text/javascript"> function setAttributeOnload(object, attribute, val) { if(window.addEventListener) { window.addEventListener('load', function(){ object[attribute] = val; }, false); } else { window.attachEvent('onload', function(){ object[attribute] = val; }); } } </script> <div id="navbar-iframe-container"></div> <script type="text/javascript" src="https://apis.google.com/js/platform.js"></script> <script type="text/javascript"> gapi.load("gapi.iframes:gapi.iframes.style.bubble", function() { if (gapi.iframes && gapi.iframes.getContext) { gapi.iframes.getContext().openChild({ url: 'https://www.blogger.com/navbar.g?targetBlogID\x3d11356004\x26blogName\x3dxception\x26publishMode\x3dPUBLISH_MODE_BLOGSPOT\x26navbarType\x3dBLUE\x26layoutType\x3dCLASSIC\x26searchRoot\x3dhttps://openrent.blogspot.com/search\x26blogLocale\x3den_US\x26v\x3d2\x26homepageUrl\x3dhttp://openrent.blogspot.com/\x26vt\x3d-4655156434419967503', where: document.getElementById("navbar-iframe-container"), id: "navbar-iframe" }); } }); </script>

Noatime explained

Linux records information about the last time a file was read (atime), the last time its contents were changed (mtime), and the last time its file permissions were changed (ctime). By default, Linux updates the last-time-read attribute of any file during a read operation. Lets watch this in operation by running the stat command against the /etc/fstab file:

# stat /etc/fstab
File: `/etc/fstab'
Size: 787 Blocks: 8 IO Block: 4096 regular file
Device: fd00h/64768d Inode: 886347 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2006-11-20 11:29:00.000000000 -0500
Modify: 2006-11-20 11:29:00.000000000 -0500
Change: 2006-11-20 11:29:00.000000000 -0500

Note the date and time of the Access field. If you immediately issue the same command again, you will note that the Access time field is not updated:

# stat /etc/fstab
File: `/etc/fstab'
Size: 787 Blocks: 8 IO Block: 4096 regular file
Device: fd00h/64768d Inode: 886347 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2006-11-20 11:29:00.000000000 -0500
Modify: 2006-11-20 11:29:00.000000000 -0500
Change: 2006-11-20 11:29:00.000000000 -0500

Now "cat" the /etc/fstab file to read its contents:

# cat /etc/fstab
/dev/VolGroup00/LogVol00 / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
none /dev/pts devpts gid=5,mode=620 0 0
none /dev/shm tmpfs defaults 0 0
none /proc proc defaults 0 0
none /sys sysfs defaults 0 0
/dev/VolGroup00/LogVol01 swap swap defaults 0 0

Now that we have read the file's contents, state the file once again:

# stat /etc/fstab
File: `/etc/fstab'
Size: 787 Blocks: 8 IO Block: 4096 regular file
Device: fd00h/64768d Inode: 886347 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2006-11-20 11:29:37.000000000 -0500
Modify: 2006-11-20 11:29:00.000000000 -0500
Change: 2006-11-20 11:29:00.000000000 -0500

See a difference? The timestamp of the Access field has changed! This update happens every time the file is read. In other words, each time a file is read, Linux makes an "expensive" write to the filesystem to update the Access time.

As you might imagine, there is generally no reason to care when a file was last read, either by a user or a system process, but the I/O cost of any disk write is high.

Fortunately, Linux lets you mount a partition with the "noatime" attribute. Noatime prevents the kernel from updating the last-time-read (atime) attribute of a file during a read operation. This boosts the performance of the filesystem, as fewer disk writes need to be done.

To set the noatime attribute to ensure no writes are generated from read accesses, edit the /etc/fstab file, and change the "defaults" directive to "rw,noatime" for a given partition. Here is what it looks like for the root partition:

/dev/VolGroup00/LogVol00 / ext3 defaults 1 1

(Note: in a long directory listing, the Modify (mtime) timestamp is displayed)
# ll /etc/fstab
-rw-r--r-- 1 root root 1.1K Nov 20 10:49 /etc/fstab