Check Disk Performance
There are several ways to check disk performance in Linux, I would prefer to use these tools:
- iostat
- dd
- hdparm
iostat
-x option to display extended statistics, including disk service time, average queue length, and disk utilization
1iostat -x
You can also specify how often you want the statistics to be updated and for how many times
1iostat 10 2
This will display the stats every 10 sec and will run 3 times.
dd
Check write speed:
1dd if=/dev/zero of=/tmp/file.dat bs=1G count=1 oflag=dsync
Check latency:
1dd if=/dev/zero of=/tmp/file.dat bs=512 count=2000 oflag=dsync
hdparm
1sudo hdparm -Tt /dev/nvme1n2
2
3/dev/nvme1n2:
4 Timing cached reads: 32450 MB in 2.00 seconds = 16249.12 MB/sec
5 Timing buffered disk reads: 4988 MB in 3.00 seconds = 1662.26 MB/sec
You can use the appropriate command depending on the information you want to gather and the type of storage you are working with.