Benchmarking is hard.
This article isn’t about creating traditional benchmark data because that’s hard. It’s much more work than my typical need which is, “Nice! A new laptop. I wonder how fast the disc[sic] is”. Yeah, I know, I haven’t had a hard disk in a laptop for a while but old habits die hard.
You have plenty of options for creating getting really nice benchmark info such as the excellent fio but if I have to read a man page and some internet guides then it isn’t what I’m looking for.
This is a tool for collecting and manipulating the low-level parameters of a SATA/PATA/SAS storage devices. It’s a very powerful tool to tinker with the on-board setting of your drive and I would recommend caution if you intend to make any changes as you can cause permanent damage or data loss.
In addition to the reading and modifying settings it contains a benchmark mode. When
haparm is run in benchmark mode it will (non-destructively) write to the drive for three seconds ignoring the cache and file system. When it’s done it will print the total amount of data written and a data/sec amount.
The full command is very simple and has the following syntax:
hdparm -t /dev/<DEVICE>
Note, use the device rather than a partition as
hdparm ignores partitions and file systems.
Here it is benchmarking the NVME SDD drive on my laptop:
$ sudo hdparm -t /dev/nvme0n1
Timing buffered disk reads: 4092 MB in 3.00 seconds = 1363.77 MB/sec
And here is the DigitalOcean VM droplet that hosts this site:
$ sudo hdparm -t /dev/vda
Timing buffered disk reads: 1236 MB in 3.00 seconds = 411.90 MB/sec
hdparm isn’t included in your distro then it’s only an 80KB download from the default repos without any dependencies.