3

I've installed a simple LAMP system based on Debian 7.2.0 (32 bits). On my server I want to know when each of PHP files was used (accessed) by web server. When I check last access times of php files (with command ls -alu), they are wrong.

I've found that it is because of relatime option used for mounting of the root filesystem. I've tried to edit my /etc/fstab and to put norelatime,atime options there but it does not work. My current /etc/fstab is:

UUID=d4bb10f1-1428-4ee4-916c-55e800263c3f /               ext4    atime,norelatime,errors=remount-ro 0       1
UUID=6db7a3c7-6ff9-43ac-b959-5175039bb84b none            swap    sw              0       0
/dev/sr0                                  /media/cdrom0   udf,iso9660 user,noauto     0       0
/dev/fd0                                  /media/floppy0  auto    rw,user,noauto  0       0

After a reboot, when I type mount, I get:

sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,relatime,size=10240k,nr_inodes=127786,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=103240k,mode=755)
/dev/disk/by-uuid/d4bb10f1-1428-4ee4-916c-55e800263c3f on / type ext4 (rw,relatime,errors=remount-ro,user_xattr,barrier=1,data=ordered)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
tmpfs on /run/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=352700k)

All the partitions have relatime option. Any help?

Marian
  • 7,402
  • 2
  • 22
  • 34
  • There used to be a related bug, no idea if its fixed by now https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=535156.html – Ashalynd May 30 '14 at 12:30

1 Answers1

1

http://www.linux-archive.org/fedora-development/120241-why-relatime-immune-remount.html and https://bugs.launchpad.net/ubuntu/+source/util-linux/+bug/582799 indicate that this does not work on Fedora or Ubuntu, and presumably the same is true for Debian. To quote from the first linked article:

You have to:

echo 0 > /proc/sys/fs/default_relatime

and then mount/remount with 'atime' and it should work. 
mc110
  • 2,825
  • 5
  • 20
  • 21