Search This Blog

Wednesday, July 13, 2011

Hdparm for beginners.

There are numerous Harddisk monitoring utilities are available and Hdparm is one of them.

Why use Hdparm?
Its a most commonly found utility on most of the linux distribution.
Simple and Easy to understand.

In this article we are going to see only two options available with Hdparm .
you may find following link useful to understand the definitions given below.

http://linux.about.com/od/lsa_guide/a/gdelsa44.htm

1) -t

Perform timings of device reads for benchmark and comparison purposes. For meaningful results, this operation should be repeated 2-3 times on an otherwise inactive system (no other active processes) with at least a couple of megabytes of free memory. This displays the speed of reading through the buffer cache to the disk without any prior caching of data. This measurement is an indication of how fast the drive can sustain sequential data reads under Linux, without any filesystem overhead. To ensure accurate measurements, the buffer cache is flushed during the processing of -t using the BLKFLSBUF ioctl. If the -T flag is also specified, then a correction factor based on the outcome of -T will be incorporated into the result reported for the -t operation.(Source Man pages)

If above definition is little difficult to understand ,see if this helps.
As you know for the very first read the data is first read from Disk and stored into RAM .For the next read for same data instead of taking the data from disk the data in RAM is read for faster reading.
Well -t option make sure only the timing between data being read from disk and stored into ram is calculated.

2) -T

Perform timings of cache reads for benchmark and comparison purposes. For meaningful results, this operation should be repeated 2-3 times on an otherwise inactive system (no other active processes) with at least a couple of megabytes of free memory. This displays the speed of reading directly from the Linux buffer cache without disk access. This measurement is essentially an indication of the throughput of the processor, cache, and memory of the system under test. If the -t flag is also specified, then a correction factor based on the outcome of -T will be incorporated into the result reported for the -t operation.

If above definition is little difficult to understand ,see if this helps.

Well -T option make sure only the timing between data being read from RAM is calculated.In this process Actual Disk read doesn't happen.

There are many options available but the options described in this article are very commonly used for storage monitoring.

hdparm output for my machine:
# hdparm -t /dev/sda

/dev/sda:
Timing buffered disk reads: 108 MB in 3.04 seconds = 35.51 MB/sec

# hdparm -T /dev/sda

/dev/sda:
Timing cached reads: 3496 MB in 1.99 seconds = 1756.56 MB/sec

No comments:

Post a Comment