Check Your (Write) Disk Speed In The Terminal

Today we’re going to discuss one way for you to check your write disk speed in the terminal. That is, we’re going to learn how long it takes you to write data to your disk drives. It’s a very simple set of commands and easy enough for anyone to try. There are other methods, this is just one of them.

After all, I recently did an article that let you check your (read) disk speed in the terminal. I might as well do an article that lets you check your write disk speed in the terminal. The former article was about how fast you can read data from your disk drives. The current article is about how fast you can write data to your disk drives.

There’s not really all that much real world work that this is going to benefit. You’re able to read and write data as fast as you’re able to read and write data. If you want to change that, invest in different hardware. Knowing the read and write rates really doesn’t do you much good – it’s just an interesting bit of information and maybe a reason for you to brag to your friends.

Today we’ll be using the ‘dd’ command. Be sure to be careful with this command because once you set it loose it does exactly what you told it to do. It can and will cause you to reach for your backups… If you don’t know, ‘dd’ defines itself as a tool to convert and copy files. You should read the man page sometime. It’s a rather robust, and potentially complicated, application.

Anyhow…

Check Your (Write) Disk Speed In The Terminal:

This article requires an open terminal, like many other articles on this site. If you don’t know how to open the terminal, you can do so with your keyboard – just press CTRL + ALT + T and your default terminal should open.

The first thing we’re going to do is make a new directory and move to it.

Now, let’s start testing. I’m going to assume you have at least 10 GB worth of space (we’ll be using ~5.5 GB, or 5 GiB). If you do not have enough space, don’t run this command until you do have that much free disk space. The command to run the test is:

Here’s a test result on a slower, in use SSD, about what I expect most users to have:

It will show you the progress, as we’ve enabled that in the dd command. It won’t take all that long for the test to complete. Unless your drive was otherwise heavily occupied, there’s little to gain from running the test multiple times.

Anyhow,  how about we cleanup after ourselves? As the file was made with ‘sudo’ so too shall it be removed with ‘sudo’. It will probably even ask you for confirmation.

And delete the directory:

That should have cleaned up our mess, all nice and fancy like. There’s no real reason to keep a 5.4 GB test file hanging around and you already have the test results.

Closure:

There you have it! You now have another article and this one will show you how to check your write disk speeds for your drives. If you want to test other drives, just write the file to those drives by navigating there first in the terminal. ‘Snot all that difficult.

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Check Disk Speed In The Terminal

In today’s article, we’re going to learn how to check the disk speed in the terminal. When I say ‘disk’ I also mean drives, like SSDs. I could use ‘storage drive’, or perhaps just ‘drive’, but the word ‘disk’ is what I’m going with. So, if you have any questions about other devices – the answer is that it should work just fine if you want to speed test them. 

I should point out that we’ll only be checking disk read speeds. We won’t do any write tests today. We’re just going to see how fast we can read data from the disks we have installed.

There’s a number of ways to check the speed of your disks. You can do so with tools like Gnome Disks or HardInfo, for example. If you’d rather, you can do a full-blown benchmark of your Linux system with GeekBench. This article will explain how to check disk speed in the terminal, because why not? The GUI tools may provide more data, but you don’t always need more data.

The tool we’ll be using for this ‘hdparm’ and it’s available for any major distro out there. In fact, it may be installed by default. So, if you want to get a head start, check to see if you have it installed. If not, go ahead and install it – just like you’d install any other software.

Anyhow, the tool describes itself as:

hdparm – get/set hard disk parameters

Which sums it up nicely. If you check the man page with man hdparm, you’ll see it’s actually pretty complicated. Fortunately, we’ll just be using it to check the disk speed. It can be used to do all sorts of stuff, as you can see from the man page. Perhaps we’ll cover some of that in a future article?

Anyhow, there’s not a whole lot that goes into this. So, let’s jump right in.

Check The Disk Speed In The Terminal:

This article requires an open terminal, like many other articles on this site. If you don’t know how to open the terminal, you can do so with your keyboard – just press CTRL + ALT + T and your default terminal should open.

With the terminal open, you should first identify the disk you’re looking to test. You can list all your attached drives with:

Once you identify the drive you’re looking to check, you’ll almost certainly want to add a /dev/ in front of it – because that’s really where it’s mounted. So, if the disk you want to check is sda1, you’d use /dev/sda1. Even if it says something like /media/<user>/<drive_name>, you’ll still be using /dev/<disk>.

Now, to check the disk speed, you’ll use the following:

That gives you a good example result, including things like buffer and cache. If you want, you can actually check the direct disk speed as well. That just requires the --direct flag. It looks like this:

That’ll give you some results as though you were reading directly from the disk without a buffer involved. It’s an option to check, should you want to. But, you can get a good look at what your disk reads are going to be.

Closure:

That’s actually all there is to it. ‘Snot very difficult. Sure, hdparm is this big complicated application – but you can still use it to check the disk speed in the terminal. You don’t actually have to master all the options of these complicated applications in order to use them. You can still use them, learning more and more options as you use their features as needed.

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Linux Tips
Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.