How to reduce Disk/partition IO (access time)

Posted by HostsVault | Posted in How-To's | Posted on 10-01-2009-05-2008

1

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.

Using noatime

In this example we will set noatime for the root file system “/”

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/sd0 /boot ext3 defaults 0 0
/dev/sd1 none swap sw 0 0
/dev/sd2 / ext3 defaults,noatime 0 0

You don't have to reboot the system for the changes to take effect (and that's the beauty of Linux), just issue this command to apply the changes:

mount -o remount /

To check its active:

mount

You should see :

/dev/sd2 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/sd0 on /boot type ext3 (rw)

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
VN:F [1.9.3_1094]
Rating: 8.0/10 (3 votes cast)
VN:F [1.9.3_1094]
Rating: -1 (from 1 vote)
How to reduce Disk/partition IO (access time), 8.0 out of 10 based on 3 ratings
Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Furl
  • Slashdot
  • StumbleUpon
  • Technorati

Comments posted (1)

Thank you for that. It is very imformative read.
I really like to read http://www.hostsvault.com!

VA:F [1.9.3_1094]
Rating: 0.0/5 (0 votes cast)
VA:F [1.9.3_1094]
Rating: 0 (from 0 votes)

Write a comment