Checking the disk read and write speed is useful to determine the performance of your storage device. In Linux, there are various tools available to check disk read and write speed. In this guide, we will show you how to check disk read and write speed using the hdparm and dd commands.
Step 1: Install hdparm
The hdparm command is used to check the disk read speed. It is available in most Linux distributions by default, but if it is not installed on your system, you can install it using your package manager. For example, on Ubuntu, run the following command:
sudo apt-get install hdparm
Step 2: Check Disk Read Speed
[root@centos63 ~]# hdparm hdparm - get/set hard disk parameters - version v9.16 Usage: hdparm [options] [device] .. Options: -a get/set fs readahead -A get/set the drive look-ahead flag (0/1) -b get/set bus state (0 == off, 1 == on, 2 == tristate) -B set Advanced Power Management setting (1-255) -c get/set IDE 32-bit IO setting -C check drive power mode status -d get/set using_dma flag -D enable/disable drive defect management -E set cd/dvd drive speed -f flush buffer cache for device on exit -F flush drive write cache -g display drive geometry -h display terse usage information -H read temperature from drive (Hitachi only) -i display drive identification -I detailed/current information directly from drive -k get/set keep_settings_over_reset flag (0/1) -K set drive keep_features_over_reset flag (0/1) -L set drive doorlock (0/1) (removable harddisks only) -M get/set acoustic management (0-254, 128: quiet, 254: fast) -m get/set multiple sector count -N get/set max visible number of sectors (HPA) (VERY DANGEROUS) -n get/set ignore-write-errors flag (0/1) -p set PIO mode on IDE interface chipset (0,1,2,3,4,...) -P set drive prefetch count -q change next setting quietly -Q get/set DMA queue_depth (if supported) -r get/set device readonly flag (DANGEROUS to set) -R obsolete -s set power-up in standby flag (0/1) (DANGEROUS) -S set standby (spindown) timeout -t perform device read timings -T perform cache read timings -u get/set unmaskirq flag (0/1) -U obsolete -v defaults; same as -acdgkmur for IDE drives -V display program version and exit immediately -w perform device reset (DANGEROUS) -W get/set drive write-caching flag (0/1) -x obsolete -X set IDE xfer mode (DANGEROUS) -y put drive in standby mode -Y put drive to sleep -Z disable Seagate auto-powersaving mode -z re-read partition table --dco-freeze freeze/lock current device configuration until next power cycle --dco-identify read/dump device configuration identify data --dco-restore reset device configuration back to factory defaults --direct use O_DIRECT to bypass page cache for timings --drq-hsm-error crash system with a "stuck DRQ" error (VERY DANGEROUS) --fibmap show device extents (and fragmentation) for a file --fibmap-sector show absolute LBA of a specfic sector of a file --fwdownload Download firmware file to drive (EXTREMELY DANGEROUS) --fwdownload-mode3 Download firmware using min-size segments (EXTREMELY DANGEROUS) --fwdownload-mode3-max Download firmware using max-size segments (EXTREMELY DANGEROUS) --fwdownload-mode7 Download firmware using a single segment (EXTREMELY DANGEROUS) --idle-immediate idle drive immediately --idle-unload idle immediately and unload heads --Istdin read identify data from stdin as ASCII hex --Istdout write identify data to stdout as ASCII hex --make-bad-sector deliberately corrupt a sector directly on the media (VERY DANGEROUS) --prefer-ata12 use 12-byte (instead of 16-byte) SAT commands when possible --read-sector read and dump (in hex) a sector directly from the media --security-help display help for ATA security commands --trim-sectors tell SSD firmware to discard unneeded data sectors (lba and count) --verbose display extra diagnostics from some commands --write-sector repair/overwrite a (possibly bad) sector directly on the media (VERY DANGEROUS)
To check the disk read speed using hdparm, run the following command:
sudo hdparm -t /dev/sda
Replace /dev/sda with the actual device name of your storage device. This command will test the sequential read speed of your storage device and display the result in megabytes per second (MB/s).
[root@centos63 ~]# hdparm -tT /dev/sda /dev/sda: Timing cached reads: 4128 MB in 2.00 seconds = 2065.62 MB/sec Timing buffered disk reads: 276 MB in 3.06 seconds = 90.30 MB/sec
[root@centos63 ~]# hdparm -tT /dev/sdb /dev/sdb: Timing cached reads: 3410 MB in 2.00 seconds = 1705.84 MB/sec Timing buffered disk reads: 364 MB in 3.00 seconds = 121.29 MB/sec
Step 3: Check Disk Write Speed
To check the disk write speed, we will use the dd command. Run the following command:
sudo dd if=/dev/zero of=test bs=1G count=1 oflag=direct
This command will create a test file named test with a size of 1 gigabyte (GB) and write it to your storage device. The oflag=direct option tells dd to bypass the file system cache and write directly to the disk. The bs option specifies the block size.
After the test file is created, dd will display the write speed in bytes per second (B/s).
Step 4: Clean Up
After you have finished testing the disk read and write speed, you can delete the test file by running the following command:
sudo rm test
- sudo apt-get install hdparm – Install hdparm
- sudo hdparm -t /dev/sda – Check disk read speed
- sudo dd if=/dev/zero of=test bs=1G count=1 oflag=direct – Check disk write speed
- sudo rm test – Clean up
In this guide, we have shown you how to check disk read and write speed in Linux using the hdparm and dd commands. By checking the disk read and write speed, you can determine the performance of your storage device and identify any potential bottlenecks. We hope this guide has been helpful to you. If you have any comments or suggestions for improvements, please feel free to share them below.
Nice information, LG LED Tv in lahore valuable and excellent design, online Mobile Store in lahore
as share good stuff smart tv in lahore with good ideas and concepts, iphone 5S
lots of great information and LED 3D Tv in Lahore inspiration, both of which I need, Digital Camera
thanks to offer such a helpful information here
It’s nearly impossible to find educated people in this partiucular subject, however, you seem
like you know what you’re talking about! Thanks