Install fio
On Ubuntu and Debian:
sudo apt install fioOn AlmaLinux and Rocky Linux:
sudo dnf install fioOn these, fio comes from the AppStream repository and some I/O engines are separate packages. If fio later reports that the libaio engine cannot be loaded, install fio-engine-libaio as well.
Test on a File, Never on a Disk with Data
Warning: fio can write to a raw device such as /dev/sdb or /dev/nvme0n1. A write test on a device overwrites whatever is on it, including the file system. Always give fio a file name inside a directory on the file system you want to measure, and check with lsblk and df -h which disk that directory lives on and that it has room for the test file.
The examples use /var/tmp/fio.test, which is on the system disk on most servers. Do not test in /tmp if it is a tmpfs: that measures memory, not the disk.
The Four Standard Tests
The options shared by all four go into a shell variable. Set --size larger than the server's memory:
COMMON="--filename=/var/tmp/fio.test --size=10G --direct=1 --ioengine=libaio --runtime=60 --time_based --group_reporting"
# 1. 4k random read
fio --name=randread $COMMON --rw=randread --bs=4k --iodepth=32 --numjobs=4
# 2. 4k random write
fio --name=randwrite $COMMON --rw=randwrite --bs=4k --iodepth=32 --numjobs=4
# 3. mixed 70% read, 30% write
fio --name=mixed $COMMON --rw=randrw --rwmixread=70 --bs=4k --iodepth=32 --numjobs=4
# 4. 1M sequential read, then write
fio --name=seqread $COMMON --rw=read --bs=1M --iodepth=16 --numjobs=1
fio --name=seqwrite $COMMON --rw=write --bs=1M --iodepth=16 --numjobs=1The first run lays out the 10G test file before it measures, so it takes a little longer.
What the Options Mean
| Option | Meaning |
|---|---|
--direct= | Bypasses the page cache |
--ioengine= | Asynchronous I/O |
--iodepth | Requests in flight per job |
--numjobs | Parallel workers |
--runtime | Test length in seconds |
--time_ | Runs for the full runtime |
--group_ | One total for all jobs |
--bs | Block size per request |
On current kernels --ioengine=io_ is an alternative to libaio. Queue depth has no effect with synchronous engines, and with libaio it only takes effect together with direct I/O, because buffered I/O is not asynchronous on Linux.
Reading the Results
- IOPS: operations per second, on the line that starts with
read:orwrite:. The figure to compare for the 4k tests. - BW: throughput. The figure to compare for the 1M tests.
- Latency: the completion latency (clat) block shows the average and a list of percentiles. Look at the 99th and 99.9th percentile: a database feels the slow tail, not the average.
IOPS and throughput are linked by the block size: 25,000 IOPS of 4 KiB are 100,000 KiB per second, about 98 MiB/s. The background is in what is IOPS.
Why the Page Cache Must Be Bypassed
Linux keeps recently used file data in memory. Without --direct=1, reads come from memory and writes are only queued there, so fio reports the speed of RAM. A test file larger than the memory of the server adds a second safeguard against caching, also in layers below the virtual server. Find the memory size with grep MemTotal /proc/meminfo.
Results Change Over the Day
On a virtual server the disk is part of shared storage. Results can differ between runs and between morning and evening. Run each test several times at different hours and compare the median, and always compare servers with the same commands. To see what the disk is doing during a test, run iostat in a second session, as in how to check disk I/O in Linux.
Remove the Test File
rm /var/tmp/fio.testThe file is as large as --size and stays until you delete it.
Updated:
Linux VPS with Full Root Access
MUVCloud cloud servers run on KVM with Enterprise NVMe SSD storage and full root access, in Turkey, the Netherlands, and the USA.
More Guides
No Limits on Service or Support
You are not on your own as your projects grow. Our support engineers are ready 24/7, on several channels, whenever you need them.

- 100% customer satisfaction goal
- Our own hardware
- 24/7 ticket and email support
- 4 countries with locations