Setting noatime and nodiratime for improved disk performance
August 25th, 2009
This is great if you have a server that performs plenty of disk access operations and you are interested in speeding things up a bit. Here is how to do this in three steps. First some assumptions:
- You have root access
- You are the only one that will ever need to mount or unmount this file system
- Running CentOS (this may work, but was not tested on any other linux server)
This is what we are doing:
- Editing /etc/fstab to set the noatime and nodiratime flags for the file system
- Remounting the drives/file systems (without rebooting)
- Checking our work
Step 1: Edit the /etc/fstab, type:
vi /etc/fstab
Add the noatime, nodiratime flags right after the defaults flag in the “/” root mount partition. Repeat to all the partitions that you wish to speed up. Here is how my fstab file looks like after the change (click to enlarge):
Step 2: Remount the file system:
mount -oremount /
Step 3: Check our work:
cat /proc/mounts
Tip: the following command will perform a tiny benchmark test, in case you want to see how fast your hard drives perform. If you want to compare, you should perform a before and after tests.
hdparm -tT /dev/sda
HEllo nice blog!