I know that by changing something in 'etc/fstab' I can activate atime for every file in the system. But what I need, or rather want, is to activate it for a specific directory, say 'var/www/vhosts/myfiles'. Is it possible? What would I need to add to the fstab file in order to do that? Thanks in advance.


Unfortunately you cannot. You only disable atime for specific items, not enable it.

So maybe, if your /var/www is on a separate partition, you can enable atime (in fstab) for everything on this mountpoint, then recursively disable atime for every root folder of this mountpoint minus 'var/www/vhosts/myfiles' using:

chattr -R +A /path/to/your/folder

the '+A' is the 'disable atime' attribute.

But it can only be a real alternative if there is not too many changes inside your FS directories / files (newly created items won't have the 'disable atime' attribute set.

Sorry for not being able to help more, but I really think it's a system limitation.

Note that on recent kernel versions, you can use the mount option 'relatime' (it is even the default I think), which still updates atime but far less often, so you don't notice the performance impact of it.

  • Thanks, I solved it by forcing every user who opens a file go through a PHP script first, and there I call the touch() function. – Felipe Schenone Oct 5 '12 at 18:39
  • Yes, that's a very good compromise. – mbarthelemy Oct 5 '12 at 19:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.