---
title: "Test disk speed on Linux with fio, and read the results · CloudSat"
description: "Test disk speed on Linux with fio instead of dd or hdparm, read IOPS and latency percentiles, and check that an NVMe drive runs at full PCIe link speed."
url: https://cloudsat.io/learn/benchmark-disk-speed-on-linux-with-fio
updated: 2026-11-18T12:00:00Z
source: CloudSat (https://cloudsat.io/). Prices in USD.
---

[Linux](https://cloudsat.io/learn/topic/linux)

# Test disk speed on Linux with fio, and read the results

Test disk speed on Linux with fio instead of dd or hdparm, read IOPS and latency percentiles, and check that an NVMe drive runs at full PCIe link speed.

CloudSat team November 18, 2026 6 min read

Most quick disk tests measure the wrong thing: the page cache in RAM, a single stream of zeros, or a read pattern no application uses. A useful test reproduces what your workload does. Databases care about small random reads and writes and about how long each commit waits. Backups and media care about sequential throughput. This guide shows how to measure both with `fio`, how to read the numbers, and how to check that an NVMe drive is not held back by its slot.

## Why dd and hdparm mislead

`dd` writes one sequential stream with one request in flight at a time. Without `oflag=direct` it mostly measures how fast Linux copies into memory, and zeros from `/dev/zero` flatter any storage that compresses data. If you must use it, this form at least bypasses the cache, and it still only tells you about sequential writes:

```bash
dd if=/dev/zero of=/root/ddtest bs=1M count=2048 oflag=direct status=progress
rm /root/ddtest
```

`hdparm -t /dev/vda` reads the raw device sequentially for a few seconds, and `hdparm -T` measures the memory cache, not the disk. Both are harmless, and both say nothing about the random I/O that decides how a database or a busy web server feels.

## Set up fio safely

```bash
sudo apt install fio        # Debian and Ubuntu
sudo dnf install fio        # RHEL family and Fedora
df -h /root                 # make sure the test file fits
```

Always test against a **file** on the filesystem you care about. Pointing a write test at a device name such as `/dev/vda` or `/dev/nvme0n1` overwrites whatever is on it, partition table included. Make the file a few gigabytes, so that caches in a controller or on the host cannot hold all of it and flatter the result.

## Four tests that cover most workloads

Save this job file as `disk.fio`. `direct=1` bypasses the page cache, and `stonewall` makes each test wait for the previous one to finish.

```ini
[global]
ioengine=libaio
direct=1
filename=/root/fio-test.bin
size=4G
runtime=60
time_based
group_reporting

[randread-4k]
rw=randread
bs=4k
iodepth=32
numjobs=4

[randwrite-4k]
stonewall
rw=randwrite
bs=4k
iodepth=32
numjobs=4

[seqread-1m]
stonewall
rw=read
bs=1M
iodepth=8

[seqwrite-1m]
stonewall
rw=write
bs=1M
iodepth=8
```

```bash
fio disk.fio | tee fio-$(date +%F-%H%M).txt
rm /root/fio-test.bin
```

The run takes about four minutes plus the time to lay out the file. `io_uring` is a valid alternative to `libaio` on current kernels; keep the same engine when you compare machines.

### A mixed workload

Real applications rarely only read or only write. A 70/30 mix of random reads and writes is a fair stand-in for a busy application database. The 8k block size matches PostgreSQL's page size; use 16k for MySQL and MariaDB with InnoDB:

```bash
fio --name=mixed --filename=/root/fio-test.bin --size=4G --rw=randrw --rwmixread=70 \
    --bs=8k --iodepth=16 --numjobs=4 --ioengine=libaio --direct=1 \
    --runtime=60 --time_based --group_reporting
```

fio reports the read and write halves separately, so you can see whether the writes drag read latency up.

### The sync-write test for databases

A database commit is a small write followed by a flush that must reach stable storage before the transaction counts as done. This test measures exactly that delay:

```bash
fio --name=commit --filename=/root/fio-sync.bin --size=256M --rw=write --bs=4k \
    --ioengine=sync --fdatasync=1 --runtime=60 --time_based
rm /root/fio-sync.bin
```

Look at the `fsync/fdatasync` latency percentiles in the output. They predict commit latency far better than any throughput figure.

## Read the output

| Field | What it tells you |
| --- | --- |
| `IOPS` | operations per second, the headline for 4k random tests |
| `BW` | bandwidth, the headline for 1M sequential tests |
| `clat` | completion latency: time from submission to completion |
| `clat percentiles` | the spread; `99.00th` and `99.90th` show the slow tail |
| `lat (usec)` distribution | what share of requests landed in each latency band |
| `util` (disk stats) | device busy time; not a saturation measure on NVMe or virtual disks |

Averages hide the pauses users notice. Two disks with the same mean latency can feel very different if one has a long 99.9th percentile tail. Compare percentiles, and run every test at least three times, at different hours, before drawing a conclusion. Shared hosts, background jobs and heat all move the numbers.

The interface sets a hard ceiling on sequential throughput, which helps you judge a result:

| Interface | Theoretical ceiling |
| --- | --- |
| SATA III (6 Gb/s) | about 600 MB/s |
| PCIe 3.0 x4 NVMe | about 3.9 GB/s |
| PCIe 4.0 x4 NVMe | about 7.9 GB/s |
| PCIe 5.0 x4 NVMe | about 15.8 GB/s |

A drive cannot beat its link, and reaching it needs deep queues and large blocks. Random 4k results sit far below these figures on every kind of drive.

## NVMe or SATA? Check what you really have

On a physical machine, a dedicated server or your own PC, the kernel tells you how each drive is connected:

```bash
lsblk -d -o NAME,TRAN,ROTA,MODEL,SIZE      # TRAN shows nvme, sata or usb
sudo nvme list                             # from the nvme-cli package
```

### Is the drive running at full link speed?

A PCIe 4.0 drive in a PCIe 3.0 slot, or in a slot wired with two lanes instead of four, loses half its sequential ceiling without any error message. Compare what the device supports with what it negotiated:

```bash
lspci | grep -i 'non-volatile'                       # note the address, for example 01:00.0
sudo lspci -vv -s 01:00.0 | grep -E 'LnkCap:|LnkSta:'
```

`LnkCap` is the capability and `LnkSta` the current state. `Speed 16GT/s` means PCIe 4.0, `8GT/s` PCIe 3.0 and `32GT/s` PCIe 5.0; `Width x4` is the full lane count for most NVMe drives. Some platforms lower the link speed at idle to save power, so check again while a test runs.

### Heat and wear

M.2 drives slow themselves down when they overheat, which shows up as sequential writes that start fast and then fall off. `sudo nvme smart-log /dev/nvme0` reports the temperature, the time spent above the warning threshold, `percentage_used` (wear) and media errors. A heatsink or better airflow often fixes a drive that looked slow.

If an NVMe drive does not appear at all, the firmware's storage mode is the usual suspect: see [AHCI, RAID or VMD](https://cloudsat.io/learn/ahci-raid-vmd-bios-storage-modes).

## Inside a virtual server

A VPS sees a virtual disk such as `/dev/vda`. `TRAN` stays empty and `nvme list` shows nothing, even when the host uses NVMe underneath, so the fio results are the only honest measure. Every CloudSat server runs on NVMe storage, and the same job file gives you a fair before-and-after comparison when you resize a plan or move to another region.

While a test runs, `iostat -xz 1` in a second terminal shows per-device request rates and wait times, and `ioping -c 20 -D /root` gives a quick latency reading in the style of `ping`.

## FAQ

### Why do my results change from run to run?

Caches, background jobs, heat and, on shared hosts, other tenants' load all play a part. Run each test three times and keep the median. A spread that stays wide is itself a finding: it means latency will be unpredictable for your application too.

### Is it safe to run fio on a production server?

Against a test file, your data is safe, but the test competes with real traffic for disk time. Run it off-peak, keep the runtime short, and never aim a write test at a raw device.

### Which numbers should I compare between machines?

The 4k random read and write IOPS at the same queue depth, the 99th percentile completion latency, and for databases the fdatasync latency. Sequential bandwidth matters only for backups, media and large file transfers.

**Run it on CloudSat.** Cloud VPS on AMD EPYC and NVMe from $1.98/mo in 13 regions, delivered in under 5 minutes and paid in crypto. [See plans](https://cloudsat.io/plans) or [deploy a server](https://dash.cloudsat.io/console/deploy).

## Keep reading

[All guides in Linux](https://cloudsat.io/learn/topic/linux)

- [LVM or ZFS on Linux: picking a storage layer for a server](https://cloudsat.io/learn/lvm-or-zfs-for-linux-storage): Linux LVM or ZFS on Linux: picking a storage layer for a server 6 min read
- [AHCI, RAID or VMD and how BIOS storage modes affect Windows](https://cloudsat.io/learn/ahci-raid-vmd-bios-storage-modes): Windows Server AHCI, RAID or VMD and how BIOS storage modes affect Windows 7 min read
- [Linux monitoring tools, matched to the question you have](https://cloudsat.io/learn/linux-server-monitoring-tools-by-question): Linux Linux monitoring tools, matched to the question you have 6 min read
- [LVM on Linux: create, mount and grow logical volumes](https://cloudsat.io/learn/set-up-lvm-on-linux-create-mount-extend): Linux LVM on Linux: create, mount and grow logical volumes 7 min read
