Which numbers should I measure?
- Random IOPS at a 4 KiB block size: how many small reads or writes per second. This is what databases, mail servers and package caches live on.
- Sequential throughput at 1 MiB blocks: how many megabytes per second for big files such as backups, media and logs.
- Latency, especially the 99th and 99.9th percentile: how long the slow requests take. Averages hide the stalls users notice.
Each depends on queue depth and number of jobs. A single thread with one request in flight shows latency; many jobs with deep queues show the drive's ceiling. Test both.
How do I install fio and prepare a safe test?
sudo apt install -y fio # or: sudo dnf install -y fio sudo mkdir -p /srv/fiotest && cd /srv/fiotest df -h /srv/fiotest
Always benchmark against a file on a mounted filesystem unless the device is empty. Pointing fio at a raw device such as /dev/nvme1n1 with a write job destroys whatever is on it. Make sure the test file fits comfortably in free space; 16 GiB is a good size, large enough to beat most caches.
What does a random 4K test look like?
fio --name=rand4k --directory=/srv/fiotest --size=16G \
--rw=randrw --rwmixread=70 --bs=4k --ioengine=io_uring \
--direct=1 --iodepth=32 --numjobs=4 --group_reporting \
--time_based --runtime=90 --ramp_time=10
This mixes 70 percent reads with 30 percent writes, a fair stand-in for an OLTP database. --direct=1 bypasses the page cache so you measure the drive, not RAM. io_uring is the fastest engine on current kernels; use libaio on older ones. In the output, read the IOPS= value for reads and writes and the clat percentiles block.
How do I measure sequential throughput?
fio --name=seqread --directory=/srv/fiotest --size=16G --rw=read \
--bs=1M --ioengine=io_uring --direct=1 --iodepth=16 --numjobs=2 \
--group_reporting --runtime=60 --time_based
fio --name=seqwrite --directory=/srv/fiotest --size=16G --rw=write \
--bs=1M --ioengine=io_uring --direct=1 --iodepth=16 --numjobs=2 \
--group_reporting --runtime=60 --time_based --end_fsync=1
Look at bw= in MB/s. A current datacenter NVMe drive reads several gigabytes per second sequentially; SATA SSDs top out near 550 MB/s because of the interface. On a model like S3 with 2x 1 TB NVMe, testing each drive separately before you build an array tells you whether both behave the same.
How do I measure latency properly?
fio --name=lat --directory=/srv/fiotest --size=4G --rw=randread \
--bs=4k --ioengine=psync --direct=1 --iodepth=1 --numjobs=1 \
--runtime=60 --time_based --percentile_list=50:99:99.9
One job with one request at a time shows the bare cost of a single read. Good NVMe drives answer in well under 100 microseconds at the median. Compare the 99.9th percentile with the median; a huge gap means occasional stalls, often from garbage collection or thermal throttling.
Can I save tests as a job file?
; /srv/fiotest/db.fio [global] directory=/srv/fiotest size=16G ioengine=io_uring direct=1 time_based runtime=120 group_reporting [oltp] rw=randrw rwmixread=75 bs=8k iodepth=16 numjobs=8
Run it with fio db.fio --output-format=json --output=db.json. JSON output is easy to diff between runs, so you can compare before and after a filesystem change or a kernel upgrade. Match bs to your workload: 8 KiB for PostgreSQL pages, 16 KiB for InnoDB.
Why are my numbers lower than the spec sheet?
- Spec sheets quote the best case at very deep queues on an empty drive.
- Filesystem overhead, journaling and encryption all cost something.
- Mixed read and write loads are always slower than pure reads.
- Sustained writes eventually slow as the drive's internal cache fills.
- A RAID 1 mirror writes twice, so write IOPS do not double the way reads can.
How do I see IOPS on a live system?
iostat -xz 2 sudo iotop -oPa
iostat from the sysstat package shows reads and writes per second, average wait and utilization per device. iotop shows which process causes the load. If production numbers come close to your fio ceiling, storage is your bottleneck and a model with more or faster drives is the next step.
How do I clean up?
rm -rf /srv/fiotest sudo fstrim -av
fstrim tells the SSD the test blocks are free again, which keeps write performance steady.
Machines Built for Fast Storage
| Server | Processor | Cores / threads | Memory | Storage | Network | Per month | Smallest order |
|---|---|---|---|---|---|---|---|
| S3 | Intel Xeon E-2356G | 6 / 12 | 64 GB DDR4 | 2x 1 TB NVMe | 2x 10 Gbps | $80.38 | $80.38 (1 month) |
| S12 | Intel Core i9-14900K | 24 / 32 | 192 GB DDR5 | 2x 4 TB NVMe | 2x 10 Gbps | $202.82 | $202.82 (1 month) |
| D20 | 2x Intel Xeon Gold 6336Y | 48 / 96 | 256 GB DDR4 | 4x 4 TB NVMe | 2x 25 Gbps | $990.36 | $990.36 (1 month) |
| D21 | 2x Intel Xeon Gold 6430 | 64 / 128 | 256 GB DDR5 | 6x 15.36 TB NVMe + 1x 1 TB NVMe (boot) | 2x 25 Gbps | $1,152.97 | $1,152.97 (1 month) |
Keep Reading
Check disk health with smartctl
Read SMART and NVMe health data with smartctl, run self tests, and spot a drive that is wearing out before it takes your data with it.
OpenNVMe endurance (TBW and DWPD)
How much data a flash drive can absorb before it wears out, and how to watch wear on your own machine.
OpenStorage servers
From 8 TB mirrors to a six-drive NVMe array of more than 90 TB raw, with ZFS or mdadm laid out by you.
OpenDatabase servers
PostgreSQL, MongoDB, ClickHouse and other engines on machines picked by working set, write rate and core count.
OpenFAQ
Quick Answers
Only for a rough sequential number. fio measures random IOPS, latency and queue depth, which dd cannot.
Not when it writes to a test file in a folder. Writing to a raw device that holds data destroys it.
It bypasses the page cache so the test measures the drive instead of RAM.
4K for general random tests, 8K or 16K to mimic databases, 1M for sequential throughput.
At least 60 seconds after a short ramp, long enough to get past caches and see steady numbers.