I am using stat to get the acess time of a file (current date is October 23, 2013)
[juan@JN-LNXSVR-02 labfiles]$ stat nursery
File: `nursery'
Size: 837 Blocks: 8 IO Block: 4096 regular file
Device: fd00h/64768d Inode: 139539 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 500/ juan) Gid: ( 500/ juan)
Access: 2013-10-22 18:03:20.703888346 -0400
Modify: 2013-10-21 16:57:07.801165793 -0400
then I edit the file and close it without any modification, and submit stat again
juan@JN-LNXSVR-02 labfiles]$ vi nursery
[juan@JN-LNXSVR-02 labfiles]$ stat nursery
File: `nursery'
Size: 837 Blocks: 8 IO Block: 4096 regular file
Device: fd00h/64768d Inode: 139539 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 500/ juan) Gid: ( 500/ juan)
Access: 2013-10-22 18:03:20.703888346 -0400
Modify: 2013-10-21 16:57:07.801165793 -0400
Change: 2013-10-21 16:57:07.801165793 -0400
but the access time did not change, why?
I could not find any noatime attribute
juan@JN-LNXSVR-02 labfiles]$ grep noatime /proc/mounts
[juan@JN-LNXSVR-02 labfiles]$
The output of the mount command is
[juan@JN-LNXSVR-02 labfiles]$ mount /dev/mapper/vg_jnlnxsvr02-lv_root on / type ext4 (rw) proc on /proc type proc (rw) sysfs on /sys type sysfs (rw) devpts on /dev/pts type devpts (rw,gid=5,mode=620) tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0") /dev/sda1 on /boot type ext4 (rw) none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw) sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw) [juan@JN-LNXSVR-02 labfiles]$
Could you include the output of mount
? Maybe your disk is mounted with noatime
?
EDIT (again): relatime
would only update it once when reading after a modification but not every time. Since Linux 2.6.30 this seems to be the standard option, so if you do write
+ read
it would update on the read. But write
+ read
+ read
would only update it for the first read (and once after every following modification).
Given that your access time is already newer than your modification time, the access time would not be updated when mounted with relatime
(or without atime
option) if you only read.
from man mount
:
noatime
Do not update inode access times on this filesystem (e.g., for faster access on
the news spool to speed up news servers).
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 noatime, 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.
And for the record, if you want to have the old behaviour back, use strictatime
.
Allows to explicitly requesting full atime updates. This makes it possible for
kernel to defaults to relatime or noatime but still allow userspace to override
it. For more details about the default system mount options see /proc/mounts.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With