The atime and noatime attribute

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.


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.

source : http://tldp.org/LDP/solrhe/Securing-Optimizing-Linux-RH-Edition-v1.3/chap6sec73.html
$lsattr yt-chanrip
------------------- yt-chanrip
$ls -l yt-chanrip
-rw-r--r-- 1 jeffrin jeffrin 230 Sep  2 18:19 yt-chanrip
$chattr +A yt-chanrip
$lsattr yt-chanrip
-------A----------- yt-chanrip
$ls -l yt-chanrip
-rw-r--r-- 1 jeffrin jeffrin 230 Sep  2 18:19 yt-chanrip
$echo "   " >> yt-chanrip
$lsattr yt-chanrip
-------A----------- yt-chanrip
$ls -l yt-chanrip
-rw-r--r-- 1 jeffrin jeffrin 234 Nov 29 22:30 yt-chanrip
$time

real	0m0.000s
user	0m0.000s
sys	0m0.000s
$chattr -A yt-chanrip
$echo "   " >> yt-chanrip
$ls -l yt-chanrip
-rw-r--r-- 1 jeffrin jeffrin 238 Nov 29 22:31 yt-chanrip
$

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s