Linux – Atime value changing only once after file creation

atimefilesystemslinuxmount

I've mounted disk with explicit given value – atime:

mount -o mount -o atime /dev/disk1 /myDisk

then I've created a file by

touch file_A

after this operation stat output looks like that:

Access: 2013-08-30 11:38:48.141970758 +0200
Modify: 2013-08-30 11:38:48.141970758 +0200
Change: 2013-08-30 11:38:48.141970758 +0200

after cat /myDisk/file_A stat output changes but only once:

    Access: 2013-08-30 11:39:11.141970758 +0200
    Modify: 2013-08-30 11:38:48.141970758 +0200
    Change: 2013-08-30 11:38:48.141970758 +0200

and then doing cat multiple times doesn't change Access time value at all.
What's wrong with that? Where this behavior coming from? I would expect that access time will change after every single cat operation on this file.
Why it shows only the first access?

(Mounting disk with noatime option causes another behavior, any of cat's changes access time in stat. Still remains equal to modify and change)

Best Answer

Is it possible that you use the relatime option when mounting? It is supposed to be some middle way between atime and noatime by not causing as much I/O as atime but still not breaking tools that break with noatime.

This is the description out of man 8 mount:

   relatime
   Update  inode  access times relative to modify or change time.  
   Access time is only updated if the previous access time was 
   earlier than the current modify or change time. (Similar to noat‐
   ime, but doesn't break mutt or other applications that need to 
   know if a file has been read since the last time it was modified.)

   Since Linux 2.6.30, the kernel defaults to the behavior provided 
   by this option (unless noatime was  specified), and the 
   strictatime option is required to obtain traditional  semantics. 

   In addition, since Linux 2.6.30, the file's last access time is 
   always  updated  if  it  is more than 1 day old.
Related Question