How To: Test Your Drive Speed In The Linux Terminal

Today’s article is going to just be a nice and easy article, one that shows you how to test your drive speed in the Linux terminal. It’s easier than you might think and even easy enough that a new Linux user can figure this one out.

Why would you want to do this? Why would you want to test your drive speed in the Linux terminal?

Well, while there are surely GUI ways to accomplish this, you might want to verify that you’re getting the disk speed you paid for. You might also just want to know your drive’s speeds or perhaps you want to post your drive speed on a forum for bragging rights? These terminal commands will also be pretty much universal, across all distros.

It doesn’t matter why you want to test your drive speed, it just matters that you can test it – and that you’ll now know how. And, you know what they say? Knowledge is power!

So, what will we be doing?

Well, we’ll be using the Linux terminal to check how fast we can read and write data to your drives, no matter if they’re spinning platter hard disk drives or solid state drives. The commands will be the same for all drive types and are fairly easy to learn.

So, with all that said and done, let’s get into the article…

Test Your Drive Speed In The Linux Terminal:

Of course, this article will require an open terminal. On Linux-Tips we do a lot in the terminal. It’s fun and fairly universal. 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 your terminal open, you’ll want to run the following command to identify the drive you want want to test. That’s nice and easy, just run:

You’re looking for something like /dev/sda1 or something like /dev/nvme0n1p1 and the lsblk command might help you narrow down which drive it is you want to test.

Once you have identified the drive you want to speed test, you can begin testing. You can first try testing the write speed, that is how fast you can write data to the drive. To do that, you’re command would look like:

For example, if you had ‘sda1‘, your command would look like:

That will tell you how quickly you can write data to your drive, a pretty handy number to know. However, that’s only half of the equation…

You might also want to know how fast you can read data to the drive, the other half of the equation. The command to find the read speed is pretty similar to the command to read the write speed – and that command would look a little something like this:

Or, again, if you want an example of how to test the speed at which you can read data from your drive, an example command would look a little like this:

Note the difference between the commands. In the latter command, we’re writing data from the disk (reading it) and sending it to the bit bucket. With the write command, we’re going the opposite direction. In one case you’re writing from /dev/null and in another case you’re writing to /dev/null. Pretty easy, huh?

Closure:

There it is! This is actually the 301st article written for Linux-Tips.US! This time around we learned how to test your drive speed in the Linux terminal. I told you that it wasn’t too complicated and I stand by it. If you just follow the directions, you’ll learn how to test your drive speed and have another tool in your toolbox.

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.

How To: Check A Disk For Errors

In today’s article, we’re going to learn how to check a disk for errors. We’ll be using a multi-pronged process to thoroughly check a disk for errors in the Linux terminal. By itself, none of these are particularly complicated. As such, I expect this to be a relatively easy article to follow.

If you’ve been seeing errors when transferring data to a disk, it’s probably a good sign that it’s time to check that disk for errors. You may also want to check a disk for errors if you’ve not used it before – like if it is used or if you have just purchased it.

To perform these tests, the disk must not be mounted! If need be, you’ll have to do these tests from a live environment. That’s easy enough. Remember how you installed Linux? Well, that same installation media is (usually) the same media you’ll need to enter a live environment. You will, of course, need to boot to the media when you start your system – be it USB, or CD, or DVD. It’s much the same as though you were going to install Linux – except you don’t opt to do the installation – you just work in the live environment.

Anyhow, we’ll be using a few tools for this. All of these tools will almost certainly be available by default. If they’re not, ummm… Well, if they’re not, pick a different distro’s live environment to use, or install them yourself! These tools are all on the installation media for distros in the Ubuntu family, for example. So, yeah, find a distro where they are available – which should be pretty much all of them.

Check A Disk For Errors:

So, you’re booted to a live instance of your favorite distro (or the disk you’re going to check is unmounted) and you’re ready to start testing. Well, you need an open terminal. 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.

Once you have your terminal open, use lsblk to identify the disk you wish to check for errors. For the purposes of this exercise, we’re going to assume the disk you’re checking for errors is known as ‘sda’. Be sure to change that to suit your particular needs.

First, let’s check for S.M.A.R.T. errors (which we’ve previously covered in-depth). You can do so with this command:

Next, let’s check for bad blocks. Bad blocks are physical points on your device that no longer work properly. Some bad blocks isn’t, necessarily, indicative of immediate disk failure. Some bad blocks may be normal. Still, let’s check it.

If you’re really into this, you’ll want to check it for bad blocks – and then check it again soon after. That will let you know if the number of bad blocks is increasing. If the number is rapidly increasing, disk failure will likely soon follow. Otherwise, you’re probably okay for the time being.

Finally, let’s check for file-system consistency. This is typically done with the ‘fsck’ command, a command you should have some understanding of. There are many ways to run the command, but you can just use the following command to see what’s going on:

Now, you’ve run three tests. Between them all, you should have a pretty good understanding of your disk’s health and you’ll know how to check a disk for errors. Again, you’ll want to check a disk for errors when the situation dictates – especially if you’re getting disk errors while in the operating system. 

When you get disk errors, it’s time to consider retiring the drive. Depending on the severity of the errors, you might wish to stop using the drive immediately, creating an image of the drive, and retiring the drive from your system. Disk failures happen and recovering data from a failed drive can be a major hassle. So, use these warnings as a reason to consider replacing your drives if drive failure is in the cards.

Closure:

And there you have it! You now know how to check a disk for errors! It’s a handy skill to have. After all, disks fail. Knowing when they are going to fail is a good thing. Being prepared for disk failure is a bonus and a good idea! It’s also worth checking new disks. I’ve tested new disks and had unsatisfactory results that meant I returned the disk to the retailer, so it’s a concern and worth taking the time to test.

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.

How To: Check Your Hard Drive Temperature

Today’s article is going to teach you how to check your hard drive temperature (in Linux, of course). There are a number of ways to do this, so we’ll just cover one way in this article. It may seem complicated, but it’s not. This should be a pretty short article.

You should have a general idea of the temperature of components within your computer. The components have various operating temperatures and keeping them within spec means they’ll last longer and give you better performance.

Hard drives generally have temperature sensors and we’ll be using ‘hddtemp’ in the terminal to check your hard drive temperature. It won’t work with every hard drive, but it may work with yours. It’s a pretty easy application to install and use, so we’ll go over it as though you’re using Debian/Ubuntu/Mint or something that uses apt. A quick check says you have this available for other distros.

By the way, ‘hddtemp’ defines itself accurately enough, like so:

hddtemp – Utility to monitor hard drive temperature

Which is, as the article intends, exactly what we’re going to do…

Check Your Hard Drive Temperature:

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 your terminal now open, let’s install ‘hddtemp’:

Next, we want to start it as a service:

And we’ll want to have ‘hddtemp’ start with the boot process:

That’s about it for the installation. Now all you need to do is know which hard drive you want to check. You can get a list of hard drives by running:

Next, you’ll run ‘hddtemp’ as a privileged user and use the path to the drive you want to check. So, it’d look a lot like this:

If you’re in luck, it’ll spit out the drive temperature. If you prefer Fahrenheit, the command should look similar to this:

That’s really all there is to it. You can check the man page for other options, but this is how most folks are going to use ‘hddtemp’ on their own local computers.

Closure:

Well, this was a short article. I have a bit of a stomach ache, so picked one that’d be shorter than most. Ah well… At least now you know at least one way to check your hard drive temperature. That’s always a good thing.

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.