Disk read and write speed.

Being a novice user to linux i m little unaware of how would i check disk read write speed.

One of my mate is suggesting to create a file using dd command and check how much time it takes to create a 30 gb file .
I think this has a little sense however i would also like to take your reviews about the same.

This is how i m going to test the write speed.

'For write
This will create a 30 gb file in X seconds.
by calculating Diskspace in kb / Second i will get the actual write speed in kb/s .
Code:

That will be inaccurate because of cache... stuff written to disk just gets shoved into memory until the disk's ready. 30 gigs would probably fill the cache, but still, there's better ways that don't involve waiting for 30 gigs of data to be written.

Linux usually has the hdparm command. It has read tests that take just a few seconds:

hdparm -tT /dev/sda

/dev/sda:
 Timing cached reads:   1582 MB in  2.00 seconds = 791.21 MB/sec
 Timing buffered disk reads:  184 MB in  3.04 seconds =  60.61 MB/sec

There's no equivalent write-speed test but, for a traditional hard disk, read speed and write speed should be about the same.

1 Like

How would i check NFS share read speed?

i haven't tried this, but please check if fstress is helpful for you

or may be you could use the Connectathon NFS Testsuite as used here

or may be iozone is what you are looking for?

How would i make a script for checking the same.
I have created following script but There seems to be some problem with the script.
Whenever i execute it nothing get displayed.What could be the issue.

#!/bin/bash

if [ -d /dev/hda ]; then
hdparm -tT /dev/hda
fi
if [ -d /dev/sda ];then
hdparm -tT /dev/sda
fi

The "-d" flag tests for directories. I think you want either -e for "exists", or -b for block device.

1 Like