Skip to main content

Getting Started With Fio


Fio is easily the most powerful benchmarking tool available today. Because of its flexibility, it has a reputation for being difficult to use. Actually, using it is pretty easy and reading the output is hard, so I started with explaining the output.

In order to run fio, you have to get fio. This is trivial on most Linux distributions.

sudo pacman -S fio
sudo apt-get install fio
sudo yum install fio
sudo emerge -av fio

It's also fairly easy on OSX if you use Homebrew, but does not appear to be available in Macports. Installing from source is covered below.

brew install fio

I did a quick search for Windows binaries of fio and found MSI installers offered at So far, so good

And as always, you can build from source. You will need build tools installed, of course. If your current distro has old fio packages, this might be the best way to go.

git clone --branch fio-2.1.8 fio-2.1.8
# or
wget && \
tar -xjvf fio-2.1.8.tar.bz2

cd fio-2.1.8
make install

Now that you have fio installed, it's time to run a benchmark. The first test runs 1 gigabyte of IO on a subdirectory in $HOME. First create the test directory. Fio will create some files in this directory and will perform all IO on files under it.

mkdir $HOME/fio # Unix: this directory will written to by fio
mkdir C:\fio    # Windows PowerShell

Next, create your configuration file. I've been calling this file simply 'trivial.fio'. In the Unix example, I'm using the HOME environment variable to specify the IO path as ~/fio.



On Windows, I created the file using Notepad. The ioengine needs to change to windowsaio or another engine supported on Windows and the colon in the path must be escaped since fio uses it as a separator. Finally, tell fio to use threads instead of processes since that's how Things Are Done on Windows. The Unix test was switched to use threads on all platforms since it's needed on OSX as well.



Finally, it's time to run the test. The command is the same on all platforms. You will need your shell to be in the same directory as the trivial.fio file for this to work. All three of these commands run the same benchmark, but differ in how output is delivered. You only need the first one most of the time. The next two are useful if you want to save data for later comparison.

fio trivial.fio
fio trivial.fio --output=trivial.txt # write output to a file
fio trivial.fio --output-format=json --output=trivial.json

And that's it. For comparison, I've uploaded the the output from some of my machines. A couple were run in mmap mode before I switched to posixaio to keep closer to the Windows config.

Now you've run your first benchmark with fio. Head over to Fio Output Explained to find out what all those numbers mean.

Keep in mind that this trivial test only does 1 gigabyte of IO. The numbers in the gist quoted above should not be used to make any real-world decisions.

In my next post, I will be showing how to parse and plot the JSON output of fio.