Книга: Fedora™ Unleashed, 2008 edition

Disabling File Access Time

Disabling File Access Time

Whenever Linux reads a file, it changes the last access time — known as the atime. This is also true for your web server: If you are getting hit by 50 requests a second, your hard disk updates the atime 50 times a second. Do you really need to know the last time a file was accessed? If not, you can disable the atime setting for a directory by typing this:

$ chattr -R +A /path/to/directory

The chattr command changes file system attributes, of which "don't update atime" is one. To set that attribute, use +A and specify -R so that it is recursively set. /path/to/directory gets changed, and so do all the files and subdirectories it contains.

If you want to change a whole drive so that it never updates the atime, edit the file /etc/fstab as root and look for the part that says defaults for the drive you want to change. It might say defaults or something more complex like defaults,errors=remount-ro; you need to change that to add noatime, as in defaults,noatime. Make sure you don't put any extra spaces in there!

Оглавление книги


Генерация: 1.191. Запросов К БД/Cache: 3 / 0
поделиться
Вверх Вниз