Disk Speed Test (Read/Write): HDD, SSD Performance in Linux

文摘 Linux 2021-04-1 阅读:6653

dd: TEST Disk WRITE Speed

Run the following command to test the WRITE speed of a disk:

$ sync; dd if=/dev/zero of=tempfile bs=1m count=1024; sync
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB) copied, 3.28696 s, 327 MB/s

dd: TEST Disk READ Speed

The file tempfile, that has just been created by the previous command, was cached in a buffer and its read speed is much higher then the real read speed directly from the disk.

To get the real speed, we have to clear cache.

Run the following command to find out the READ speed from buffer:

$ dd if=tempfile of=/dev/null bs=1m count=1024
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB) copied, 0.159273 s, 6.7 GB/s

Clear the cache and accurately measure the real READ speed directly from the disk:

$ sudo /sbin/sysctl -w vm.drop_caches=3  或 echo 3 > /proc/sys/vm/drop_caches
vm.drop_caches = 3

$ dd if=tempfile of=/dev/null bs=1m count=1024
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB) copied, 2.27431 s, 472 MB/s

hdparm: Test HDD, SSD, USB Flash Drive's Performance

hdparm is a Linux command line utility that allows to set and view hardware parameters of hard disk drives.

And it can also be used as a simple benchmarking tool that allows to quickly find out the READ speed of a disk.

hdparm is available from standard repositories on the most Linux distributions.

Install hdparm depending on your Linux distribution.

Cool Tip: Troubleshooting an issue with a hard drive performance? It will be a good idea also to test download/upload Internet speed. It can be easily done from the Linux command line! Read more →

On Linux Mint, Ubuntu, Debian:

$ sudo apt-get install hdparm

On CentOS, RHEL:

$ sudo yum install hdparm

Run hdparm as follows, to measure the READ speed of a storage drive device /dev/sda:

$ sudo hdparm -Tt /dev/sda
/dev/sda:
 Timing cached reads:   16924 MB in  2.00 seconds = 8469.95 MB/sec
 Timing buffered disk reads: 1386 MB in  3.00 seconds = 461.50 MB/sec

0条评论

© 2024 芯缘异码. Powered by Typecho