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.

Bonus Article: KGIII Rants A Little About Security

The below ‘article’ is a rant about security – except it was written while really, really intoxicated. It’s not very good. I can’t even clean it up to make it good – but it does have some good bits scattered throughout and I’m just going to publish this as a ‘BONUS ARTICLE‘. 

Note: I may someday break this article down into bits and pieces, which is the only way I can think of to make it worth reading. At this point, I just don’t want the time to be wasted, so it might as well get published.


After trying to edit it, again while inebriated, I am not sure I can turn this into an article… I’m a bit inebriated. It’s perfectly legal here. I think I can… It’ll need to be pretty simple.

Let’s talk some basics about security!

You know what I get a kick out of? I get a kick out of seeing the people who move to Linux for “privacy reasons”, only to see them log back in to social media/forums to show that they have now moved to Linux.

They’ll login to accounts where they left plenty of personal information.

I’m not sure who they think they’re hiding from, but it’s not good privacy and they’re hiding from nobody important.

Real privacy is difficult, possibly next to impossible.

Seriously… Even the vaunted Tor is generally only as safe as you are smart, and then only on .onion domains. Once you hit the regular web, you’re probably not safe from a nation-state. Here are some theoretical attacks against Tor.

Realistically? How much privacy do you need or want? As you can guess, it’s a spectrum and and there are extremes on either end. There are also the law of diminishing returns on either end of the spectrum.

By the way, privacy is not security. Privacy is just one aspect of security.

So then, what is security?

Let’s start with the basics. For at least ‘good’ physical security, it should be ‘who you are’, ‘something you have’, and ‘something you know’.

For example, the security guard should check your ID to ensure who you are. The ID is something you have. The something you know is a password, a PIN, or a passphrase. That’s the least amount of security you can physically have to be any good.

Then, there are things you can do to improve it, for example. You can make it a rotating passphrase, make the guards work in pairs, require confirmation from someone proven to be in the building at the time, etc… You can do a layered approach where they may need all three of those things to enter yet another section and incorporate a man-trap between them.

Of course, on the other end of the spectrum is anyone and anything gets in and out. We tend to call those public spaces, when anyone can get in and out. As a general rule, you lose some rights to be in the public spaces – among those rights would be some degree of privacy (which will vary per jurisdiction). That’s pretty damned insecure. As far as security (and privacy goes) that’s the opposite.

So, again, there’s this giant spectrum of security. Where you want to be on that line is up to you. I find it’s a judgement call. We’re even willing to give up some privacy to be recognizable on a forum. Some of that lack of privacy is what keeps the forum secure and running smoothly. We give that privacy up because we get something in exchange.

At the same time, we might not want Google knowing everything we’re up to. We may be some dissident trying to reach a journalist to expose human rights violations and be under legitimate threat of death – or worse than death. We all make judgement calls about how much of our information we’re going to share.

And, really, unless you’re at the extremes, life is pretty good. It’s pretty easy to retain a little bit of privacy while participating in an online community. It’s less easy to do so with a typical Facebook account. where you are in some way connected to a more physical you.

Me? Oh, come on… I’ve long-since eaten the Google kool-aid. The ads here are from Google. I use their Analytics to better optimize the site, and all that – and more. Hell, I use Google Chrome and I’m logged in as the same user that does all those other things. I don’t use Gmail very often, so there’s that. I only use one of their accounts and that’s just to service my phone. But, that too is tied to all things Google.

The thing is, I know this. I know the privacy I give away. I made an informed decision to cede that privacy for those benefits. For me, the risks outweigh the benefits and I have a level of trust for Google. 

That’s the right choice – for me. Y’all make your own choices. If you don’t know how to block Analytics (or ads), just go ahead and ask. Just because I use those things doesn’t mean you need to. You’re perfectly free to block anything you want. You’ll still show up and be counted in the raw server logs. I’ll still be able to see what you did on the site. (Don’t worry, I don’t much care – unless you’re harming the site. The site’s security automatically blocks hundreds of requests per day.) But, yeah, I could see your IP address.

Oh, man… Oh no!!! Your IP address?!?

And the things people think about their IP address, as though it’s some great secret. If you really care, use a VPN – but learn what a VPN actually is before buying into the hype. They tout it as some great security (and it actually can be, but not how you’re using it) but it’s not really. Especially if you’re logging into sites like the video site you’re unlocking!

By the way, it’s ‘security’ when you connect to a VPN ’cause a web access point is locked down so that it only takes inputs from one IP address. That’s not how you’re gonna be using your VPN. (Well, you might, if you keep reading these articles.)

No, your IP address isn’t important. There’s no l337 hacker out there that’s just waiting to learn your IP address before he dusts the Cheetos off his shirt and gets to work hacking you. It’s just bots scanning bots at this point and you’re behind a NAT anyhow. Keep your stuff secure, mostly by keeping it off the public internet.

Ah, yes… The MAC address people…

No, you don’t need to change your MAC. The only reason you’d want to do so would be for something local. It’s not hiding you from Google, ’cause it’s only seen at the very first hop in network traffic. Once the packet is beyond that point, it uses its own MAC address. While changing your MAC address is a useful skill (for local “Spoofing” purposes), it’s not gonna make you appear any different to the rest of the web.

Lemme see… 

More security stuff to spew out onto the page?

I’ve been known to say, “Security is a process, not an application.” I’m probably not the first to express it similarly, but it doesn’t make it any less true. It is indeed a process. It starts best with a good plan and deciding where on the spectrum you’d like to be. Be sure to compare that with where on the spectrum you need to be to accomplish your computational goals. Somewhere in the middle is probably gonna be the sweet spot for you.

The thing is, you have to know where you can be on the spectrum involved. You have to know what the extremes are. You have to be aware of what techniques are available and what they really do. You need to be aware of what threats there are and what goals you want to accomplish. ‘Cause the only completely secure computer is one that doesn’t work and you might want to be extra sure by burying it in 25 feet of concrete.

Want some privacy? How about blocking third party cookies and scripting. How about you take a look at browser fingerprinting and deciding where you want to be on that spectrum? In pretty much every OS you can block DNS requests by using  your hosts file. There are even curated lists that you can download and use.

Alright, I wrote this while impaired. I’ll eventually schedule it or delete it. I’ll probably proofread it, maybe trying to make it salvageable, and the likes.


Meh… After reading this sober, I’m just gonna submit it as a bonus article. It’s not very good. I just barely proofread it and it wasn’t nearly as good as it seemed while drunk!

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: Remove AppArmor From Ubuntu

In today’s article, we’re going to learn how to remove AppArmor from Ubuntu. This will work for other distros, like Debian. It’s actually not a very difficult task to remove AppArmor from Ubuntu, but it’s not something you necessarily want to do. Just because you can, doesn’t mean you should…

As many of you know, I write many of these articles based on the notes I’ve taken over the years. I’m a little reluctant to write this one, because removing AppArmor is probably not the best of choices.

AppArmor is similar to the various jails and application isolation techniques. It’s a security tool that restricts applications to a constrained set of resources. If the application is then compromised, it only has access to that set of resources and not to the whole system.

In other words, unless you know what you’re doing, you almost certainly don’t want to remove AppArmor from Ubuntu. In fact, if you don’t know what you’re doing then doing this is almost certainly a ‘not-bright’ choice.

If you’re going to remove AppArmor, you should consider replacing it with something else. SELinux is an option that’s similar, though I suppose you could use something like Firejail and be prepared to craft your own application profiles.

Again, removing AppArmor from Ubuntu (or whatever distro you’re using that has it) is probably not a good idea. I include the article because the information is already out there and because some folks may just decide to operate their system without such protections. This is Linux, you have the freedom to make bad choices. This isn’t even the first time I’ve shown you how to make bad choices.

Remove AppArmor From Ubuntu:

Like oh so many of these articles, you’re gonna need an open terminal. Just press CTRL + ALT + T and your default terminal should open. (I say that a whole lot on this site.)

We should first check to ensure AppArmor exists and is running. To do so, enter the following command:

What you’re looking for is several lines into the output. You’re looking for ‘apparmor module is loaded‘. If you see that, AppArmor both exists and is running. So, the next step in removing AppArmor is to stop the service. You do that with:

In case AppArmor is somehow installed again, we’ll make sure that it won’t start at boot by disabling the service entirely. That seems like a good idea.

Finally, we nuke AppArmor from existence with a purge command:

And that should do it. You probably want to reboot, just to make sure there are no tendrils sticking around – but stopping the service first should mean you don’t need to. Either way, you have now removed AppArmor from your system – assuming you followed the directions.

Closure:

Again, and I can’t stress this enough, don’t do this unless you know what you’re doing and unless you have something to replace AppArmor with. It’s really a bad idea and you’ll gain very little. I wouldn’t even do this with a system air-gapped from the network, unless I had a very good reason to do so.

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.