Reducing Disk IO By Mounting Partitions With noatime
Version 1.0
Author: Falko Timme
Linux has a special mount option for file systems called noatime. If this option is set for a file system in /etc/fstab, then reading accesses will no longer cause the atime information (last access time - don't mix this up with the last modified time - if a file is changed, the modification date will still be set) that is associated with a file to be updated (in reverse this means that if noatime is not set, each read access will also result in a write operation). Therefore, using noatime can lead to significant performance gains.
I do not issue any guarantee that this will work for you!
Using noatime
In this example I want to use noatime for my root file system - /. Therefore I open /etc/fstab...
vi /etc/fstab
... and add noatime to the options of the / file system, e.g. like this:
proc /proc proc defaults 0 0 none /dev/pts devpts gid=5,mode=620 0 0 /dev/md0 /boot ext3 defaults 0 0 /dev/md1 none swap sw 0 0 /dev/md2 / ext3 defaults,noatime 0 0 |
You don't have to reboot the system for the changes to take effect - the following command will do:
mount -o remount /
That's it. You can run
mount
to check if the partition really got mounted with noatime:
server4:/home/admin# mount
/dev/md2 on / type ext3 (rw,noatime)
tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
procbususb on /proc/bus/usb type usbfs (rw)
udev on /dev type tmpfs (rw,mode=0755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)
/dev/md0 on /boot type ext3 (rw)
server4:/home/admin#
A Quick Note For OpenVZ VMs
OpenVZ containers (virtual machines) don't have an /etc/fstab file because the partitioning is controlled from the host system. To set noatime for a VM, you can run
vzctl set veid --noatime yes --save
on the host system and restart the VM (replace veid with the ID of the container; for example, if the container has the ID 101, run
vzctl set 101 --noatime yes --save
and restart the container:
vzctl restart 101
).