I needed to detect read access to certain files so I needed the file system to update the atime attribute of files the usual way.
Default mount options
In the default state the file system did not update atime as expected though I did not use the noatime option:
$ cat /etc/fstab | grep '/home '
# /home was on /dev/sda7 during installation
UUID=d7e67903-f24d-45a7-be90-6a134c9c1ae9 /home ext4 defaults 0 2
$ mount | grep '/home '
/dev/sda7 on /home type ext4 (rw)
$ cat /etc/mtab | grep '/home '
/dev/sda7 /home ext4 rw 0 0
The atime on a file was updated only sometimes. Later I realized that the file system is mounted with the new relatime option.
$ cat /proc/mounts | grep '/home '
/dev/sda7 /home ext4 rw,relatime,user_xattr,barrier=1,data=ordered 0 0
The obvious solution does not work
So it seems that the relatime option is the default on Ubuntu 12.04. The solution seemed to be easy - explicitly state the non-default atime option:
$ sudo mount -o remount,atime /home
I was suprised that the actual mount options looked exactly the same like without the atime option.
$ mount | grep '/home '
/dev/sda7 on /home type ext4 (rw)
$ cat /etc/mtab | grep '/home '
/dev/sda7 /home ext4 rw 0 0
$ cat /proc/mounts | grep '/home '
/dev/sda7 /home ext4 rw,relatime,user_xattr,barrier=1,data=ordered 0 0
In fact the system was behaving exactly the same as without the atime option.
Questions
What is going on? Why cannot I simply use the atime option? What can I do to get the normal atime functionality?