Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

migrated from stackoverflow.com Oct 5 '12 at 23:21

This question came from our site for professional and enthusiast programmers.

add comment

1 Answer

up vote 1 down vote accepted

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.

share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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