How to Test Disk Speed Using the Linux Command Line?|(Measure Disk Performance with fio,dd and Graphical Method)🏎️

Test Disk Speed Using the Linux Command Line?|(Measure Disk Performance with fio,dd and Graphical Method)

0 Comment

6 mins Read

Test Disk Speed Using the Linux Command Line?|(Measure Disk Performance with fio,dd and Graphical Method)

💡 Note: Slow disk speeds affecting your Linux operations? Upgrade to our SSD-powered Linux VPS for unmatched speed and efficiency. Experience rapid data access and elevate your server’s performance. Transform your Linux environment today.

Let’s talk about storage tech and disk speed. The invention of SSD showed everyone just how much difference a faster storage disk can make. And when it comes to speed, there is also the matter of measuring disk speed. You may be interested in testing your PC storage device or perhaps you want to know if your VPS provider actually delivers on their promises of SSD storage — for these and many other reasons, you can use this guide to measure disk speed. Instead of obtaining a single number as ‘speed’, we are interested in measuring what better represents the real-world speed of storage devices such as Hard Disk Drive (HDD), Solid State Drive (SSD), SD cards, and USB memory stick/flash drives, etc. Every storage device provides a certain level of efficiency at a certain financial cost and we’ll run different disk speed tests to discover just how fast each of them is.

As a case in point, HDDs are rather more affordable but also are only appropriate for transferring bulk files to/from disks which has a sequential read/write pattern as opposed to having a random read/write pattern. Accordingly, not every speed measurement method may be good for every disk.

Also Read: HDD vs SSD Server Comparison

In this article, I will walk you through how to use the “dd”, hdparm” utility, and “fio” methods to test disk speed in Linux.

We’re also going to cover Linux disk speed test using the Graphical Method. Also, I will be elaborating on why the first two mentioned approaches provide rather poor estimates in certain use cases.

Linux Hosting Simplified Linux Hosting Simplified

Want a better way to host your websites and web apps? Developing something new? Simply don’t like Windows? That’s why we have Linux VPS.

Get your Linux VPS

Test disk speed in Linux using commands

Well, there are multiple approaches to do this and you can use any of them.

Test Disk Speed in Linux using dd

dd is a Linux built-in tool and can be used to generally indicate how much time it takes to complete an operation.

Step 1: Getting Disk Speed Test Result

To obtain a single digit as Write speed of the disk, you are supposed to run the following command and the output will look like the one in the picture below.

use dd to test disk speed

Also, you may use the two following commands to first delete the cached-in temporary file created in a buffer by our previous command, and then to measure the Read speed of the disk.

Step 2: Clearing Cache and Re-testing

test disk speed in linux

If you run the above commands repeatedly, you will see different results. To extract a better result, you can calculate the average of 4 measurements. Yet, the final result is far off the experience a user might have with the disk.

Also Read: How to delete a directory in Linux?

Test your HDD, SSD Read Speed using Hdparm

“hdparm” is another Linux command-line tool that can be used to derive a sequential read speed of a storage device.

Step 1: Install hdparm

First, you need to install “hdparm” on your Linux, and following that you may run a command to get a digit as the reading speed of the disk.

To install “hdparm” on CentOS, RHEL distributions:

sudo yum install hdparm

To install “hdparm” on Mint, Ubuntu, Debian:

sudo apt-get install hdparm

Step 2: Run hdparm

Run the hdparm utility by entering the command below into the Linux Terminal

sudo hdparm -Tt/dev/sda

The output should look like this:

Better Test Disk Speed in Linux via fio

The previous benchmarks only account for sequential read/write speed tests. In practice, read/write interaction with the disk more often than not follows a random access pattern. This unqualifies sequential-based methods from estimating the real-world write/read speed of a disk. To overcome this shortcoming, “fio” has been developed.

Also Read: What is Linux bashrc and How to Use It?

Please note that speed is basically calculated in MBps. In this method, IOPS (Input/Output operations Per Second) is introduced for the sake of convenience. IOPS is just the same MB/s multiplied by BlockSize/1024, i.e. a bigger digit with the same unit.

Step 1: Install fio

“fio”, which is not available on Linux by default, can be installed easily nonetheless. To install this utility:

sudo apt-get install fio

Step 2: Run an SSD Disk Speed Test

Let’s first run a basic test with the following specifications:

Data volume: 250MB, Reads: 80% of the whole data, Write: 20% of the whole data

Block Size: 4k, Disk: SSD, Performance Indicators: IOPS and MB/s, Type of test: Random read/write

Test disk speed using fio

The results are as follows:

Step 3: Run an HDD Disk Speed Test

Now let’s run the exact same commands for an HDD:

This random write speed test on HDD shows weaker performance than that of an SSD. Overall, an SSD outperforms an HDD in random access usage and that is why it is more recommended.

The advantage of “fio” is that you can go for sequential reads and writes tests as well. To do that for our HDD, we will need to type in “seqread” and “seqwrite” for – – readwrite.

Linux Hosting Simplified Linux Hosting Simplified

Want a better way to host your websites and web apps? Developing something new? Simply don’t like Windows? That’s why we have Linux VPS.

Get your Linux VPS

Linux Disk Speed Test Using the Graphical Method

You can also use the native Linux Disk utility to perform disk speed tests without entering commands into the Terminal. Here, we’re going to use Ubuntu 21 as an example, but most Linux distros have the same utility.

Step 1: Open the Disk Utility

You can easily open the Disk Utility by entering the application menu and searching for “Disk” or by finding it in the menu under System → Administration → Disk Utility

Step 2: Select the disk for the test

On the left panel, you’ll see a list of all the disks available on your computer. Select the one you want to test by clicking on it.

Step 3: Run the Benchmark Feature

On the Disk Utility’s right panel, find and click on the ”Benchmark – Measure Drive Performance” button to start Benchmark up. 

Step 4: Perform Tests

On the new screen with the chart, you’ll find two buttons. The first one is “Start Read-Only Benchmark” and it does just what it says: measure how fast your disk is when just reading from it. The other one is “Start Read/Write Benchmark” and it measures the speed of both I/O operations, which is bound to be slower. Click on each one in turn or simply select the one you want.

Linux Disk Speed Test Using the Graphical Method

Improving Linux Disk Speed Using NVMe

Linux readily has a built-in tool named dd for measuring disk speed, which is particularly efficient for HDDs speed test as the hard drives are commonly used for large sequential writes and read. However, dd and also “hdparm” are two easy-to-use methods to test disk speed in Linux, they only address sequential access patterns. In other words, they miserably fail to provide a decent speed estimate of disks like SSDs that are used for both large and small files. also, you can read my detailed comparison of NVMe vs SSD.

This is because an SSD can have a random read and write usage. “fio” is a more reliable utility as it mimics the real-world condition for speed test and runs a disk speed test for both random access and large sequential writes and reads. So the next time you purchase a service, make sure you rightly test the throughput to and from your disk so that you do not experience latency.


How do I check disk read and write speed in Linux?

You can use different command-line utilities like hdparm and fio, or you can use the graphical GONME application Disk Utility for a disk speed test.

How do I increase disk read speed in Linux?

There are several ways to do that, but without getting into too many technical details, I can say using hdparm with the “–direct” option is a good example since it lets you bypass cache.

What is the command to check disk speed in Linux?

There are three commands for disk speed test in Linux: dd, hdparm, and fio. This article will tell you how to use these commands in the Terminal.

A Web designer, with Experience in digital marketing , Totally fueled by passion to understand and learn different aspects of digital marketing.


Leave a Comment

Your email address will not be published. Required fields are marked *

Latest Posts