Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

6.11. The atime and noatime attribute

Linux records information about when files were created and last modified as well as when it was last accessed. There is a cost associated with recording the last access time. The ext2 file system of Linux has an attribute that allows the super-user to mark individual files such that their last access time is not recorded. This may lead to significant performance improvements on often accessed frequently changing files such as the contents of the /var/spool/news directory.

To set the attribute to a file, use:
           [root@deep] /#chattr +A filename	 (1)
           

(1)
For a specific file

For a whole directory tree, do something like:
           [root@deep /root]#chattr -R +A  /var/spool/	  (1)
           [root@deep /root]#chattr -R +A  /cache/		  (2)
           [root@deep /root]#chattr -R +A /home/httpd/ona/   (3)
           

(1)
For a news and mail
(2)
For a proxy caches
(3)
For a web pages

Linux has a special mount option for file systems called noatime that can be added to each line that addresses one file system in the /etc/fstab file. If a file system has been mounted with this option, reading accesses to the file system will no longer result in an update to the atime information associated with the file like we have explained above. The importance of the noatime setting is that it eliminates the need by the system to make writes to the file system for files which are simply being read. Since writes can be somewhat expensive, this can result in measurable performance gains. Note that the write time information to a file will continue to be updated anytime the file is written to. In our example below, we will set the noatime option to our /chroot file system.

Edit the fstab file vi /etc/fstab and add in the line that refer to /chrootfile system the noatime option after the defaults option as show below:
            /dev/sda7          /chroot          ext2          defaults,noatime          1  2
           

You need not reboot your system for the change to take effect, just make the Linux system aware about the modification you have made to the /etc/fstab file. This can be accomplished with the following commands:
           [root@deep] /#mount -oremount /chroot/
           

Then test your results with the flowing command:
           [root@deep]# cat /proc/mounts
           

/dev/root / ext2 rw 0 0 /proc /proc proc rw 0 0 /dev/sda1 /boot ext2 rw 0 0 /dev/sda8 /cache ext2 rw 0 0 /dev/sda7 /chroot ext2 rw,noatime 0 0 /dev/sda6 /home ext2 rw 0 0 /dev/sda11 /tmp ext2 rw 0 0 /dev/sda5 /usr ext2 rw 0 0 /dev/sda9 /var ext2 rw 0 0 none /dev/pts devpts rw 0 0

If you see something like: /dev/sda7 /chroot ext2 rw,noatime 0 0, congratulations!

 
 
  Published under the terms of the Open Publication License Design by Interspire