Hard disk performance on linux

Measuring the speed of a hard drive

The performance of hard disks varies from one model to the other. Hard drives from two years ago are a lot slower than current models.

To measure the speed of a hard disk under Linux, you can use the hdparm command.

Example:

hdparm -tT /dev/sda

Hdparm’s output:

/dev/sda:
Timing cached reads:   1570 MB in  2.00 seconds = 785.11 MB/sec
Timing buffered disk reads:  252 MB in  3.02 seconds =  83.53 MB/sec

This was run on a Western Caviar Green edition (1Tb) which runs at 5900rpm. The same test on a Western Digital @7200rpm (250gigs) gives the following:

Hdparm’s output:

/dev/sdb:

Timing cached reads:   1724 MB in  2.00 seconds = 862.42 MB/sec

Timing buffered disk reads:  186 MB in  3.02 seconds =  61.67 MB/sec

List mounted partitions

If you’re not sure about the name of the devices/partitions in your system, run the following command:

mount | grep ext

Hard drive optimization

To speed up access to your files and folders you can tweak a few settings.

  1. Turn off Last Access Date

Every time you list the content of a directory or every time you read a file, the filesystem will update the directory entries and update the time stamp. For read access, this is pretty much useless. You can disable this and it won’t affect the time stamp when the file is updated.

Make a backup of your old configuration

sudo cp /etc/fstab  /etc/fstab.bk

sudo pico  /etc/fstab

for every hard disk partitions that you find (except swap), add the following options :

noatime, nodiratime

Example before:

dev/sda1            /data1            ext3 rw 0 0

Example after

dev/sda1            /data1            ext3 rw,noatime,nodiratime 0 0

You can use the editor of your choice.. mine is Pico  (apt-get install pico)

  1. Optimize Samba

To come