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.

macOS vs Linux: Comparative Analysis

macOS vs Linux: Comparative Analysis

 

BSD code is the base of macOS, which is developed under the banner of Apple Incorporation. The Unix-based operating system is developed with the use of languages like C, C++, etc. In 2001, the first version of macOS was introduced. This OS is in the second position in the world to be used highly on computers.

Linux is independently developed with a system similar to Unix. The systems where Linux plays a crucial role are named mobile devices, cloud computing, servers, personal computers, supercomputers, etc. In 1991, the first version of Linux was introduced to the world.

Linux can be easily downloaded and used. In comparison to Linux, Windows is high in demand and not available for free. macOS is picked up by specific users who can spend a specific amount from their pocket because it is designed by Apple and costs too much. Even though it is not affordable for all Windows users.

Both of these systems are not compatible with binary codes. The applications based on macOS cannot be used like open sources.

To know more about the differences and similarities of these operating systems, please have a look over the listed headings underneath. The doubts that can annoy you when deciding Mac vs. Linux are going to be sorted in the sections mentioned underneath.

Is it good to use macOS and Linux together?

People who have used Linux for years and are now using Apple’s Mac think MacOS is good to go. If you are a Mac user, you can use Mac OS X. To fulfill all your needs with Linux; you need to get another computer. You can look for a cheaper choice where Linux will work.

Is it possible to switch to macOS from Linux?

Yes, it is easy. You need to take care while doing this so that you can avoid data loss or damage. The entire process of macOS installation should be done properly, along with a recovery partition.

 Which is safer – Linux or macOS?

For a few reasons, Linux is considered safe in comparison to Windows and macOS. But, still, there are some flaws and exploits due to which Linux does not stand at the top.

The use of these operating systems depends upon the needs of the user and his/her preferences. If we talk about higher usage of the OS, then it’s only Windows.

Is It possible to install Linux on an old iMac?

Installing Linux into the old iMac computer is not an issue. For this task, you don’t need to take tension as you do not need to use any specific Mac Distro. Any of the distros can be downloaded and installed. a 64-bit distro will be a better choice to make the Old iMac be used with Linux.

If you are not able to download Linux, there might be a problem with your internet connection. Check out https://setapp.com/how-to/fix-your-connection-is-not-private-error to resolve the error.

 Which version of Linux is good to use with macOS?

The free versions of Linux to be used with Mac are — Linux Mint, Fedora, and ArcoLinux. Linux, which is easily accessible to anyone, was created by Linus Torvalds and owned by many authors (as they worked over source codes) with the GPLv2 license.

Drawbacks of Linux OS 

  • No standard environment for the desktop usage
  • No way of proper single presentation for packaging software
  • No proper and good support for games
  • Rare availability of desktop software

Downsides of macOS 

  • Mac does not allow to perform required customization
  • The gaming experiences of Mac users are not good to the date
  • The creation of new files becomes an issue on Mac devices
  • The macOS does not allow to make a jump list like Windows

Is there an issue if Linux dual-boot is being performed on a Mac device?

With Boot Camp, the process of Windows installation is easy on the Mac system. But, this process is not good to go if you want to do this for Linux. It is a tough task to be performed. If you still want to do this, you need to try it with the use of a USB or CD drive.

Why should you go for Linux in comparison to Mac?

Linux is a safer choice in comparison to Windows and Mac. With this OS, you can simply keep the malware and viruses away. The security codes and aspects involved in Linux are helpful in keeping your computer safe. Still, if you want to be more protected, then ClamAV antivirus can be used with Linux.

macOS has always had a specific clientele who love to play games flawlessly, and Linux is being loved by users who are set to program & develop formulas and codes. Choosing any of these OS is not easy, but priorities and specifications can help you to make the right decision.

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.

Check Memory Usage With ‘free’ In Linux

In today’s article, we’ll chec memory usage with the free command. We’ve touched on the ‘free’ command before, but this is a whole article about the free command. This should be a pretty quick and easy article, as it’s not a complex command.

There have been a few other articles about RAM.

How To: Find The RAM Total In The Terminal
Check Your Memory In The Terminal: Part II
Let’s Determine The Number of RAM Slots Without Opening The Case

And, in the discussions of those articles, we often refer to free -m as our go-to tool for quickly checking memory usage. It’s a handy tool used by most, and it’s a good tool to have in your toolbox. On top of that, it does a bit more than just check memory usage.

The free command has been around forever and describes itself like this:

Display amount of free and used memory in the system

Which is exactly what it does. It’s a pretty useful command if you want to see how much RAM you’re using, how much is free, how much is reserved for buffers, and even more if you’re interested in your swap stats.

So, folks are generally already familiar with the free command, but there are indeed more options and it’s worth an article to explain a few of those choices. Like always, you can also run man free to get a bunch of information that may not be included in this fairly brief article.

Check Memory Usage:

Yeah, this is yet another article that insists on the terminal. That’s not a bad thing, if you check the byline. The goal here at Linux-Tips is to get you more comfortable with Linux – and that includes getting comfortable in the terminal. So, open one up by pressing CTRL + ALT + T on your keyboard, and your default terminal should pop right up.

With that done, let’s go ahead and try the command that everyone uses:

The output from that will look a little something like this:

output from free -m
Those columns should be reasonably easy to understand. You can figure it out, I’m sure of it!

You can see by the column titles what the columns mean. Like I said, it’s relatively easy to understand – which is why it makes a pretty great tool. There’s actually a pretty good description of those terms, if you don’t already know them, in the man page.

But, you can use it in other ways. See, the -m stands for megabytes (obviously). Well, you can use other flags, like -b, -k, and -g. That’s bytes, kilobytes, and gigabytes – where the -m is megabytes as previously mentioned.

If you want a nice human-readable format, you can try this:

The output of that may vary the units but it will also show you which units are in use. It’s a pretty handy way to use the free command to check memory usage in Linux.

Sure, there’s a wide format and you can even use units as large as pebibytes. I don’t actually have anything where that’d make sense, but it’s an option if you happen to have such a system. (If you have access to a system with pebibytes of RAM, call me!)

But, did you know that you can run the command over and over again with just a single command? To do that, you use the -s flag followed by the number of seconds you want it to wait before refreshing. So, if you want it to run every 10 seconds, the command would look like this:

You can combine that with a count – like how many times you want it to run. So, something like this:

That will run the free command (you could add other modifiers) every five seconds and will do so three times in a row.

There are other options, but those are the most common. You can have it output the low and high numbers (when run over a period of time), display column totals, and even opt for a wider display. Personally, I don’t really find those options all that interesting and don’t bother with them, but they’re a man page away from being a part of your toolbox.

Closure:

And there you have it, an article teaching you how to check memory usage with the free command. The free tool is a pretty handy tool and one everyone should be familiar with. If your system is slowing down, it’s nice to know things like how much RAM is being used. If you work in application development, it’s nice to know how much more RAM your application adds to the system. There are any number of reasons why you’d want this information.

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 Your Memory In The Terminal: Part II

Today’s article is all about how you can check your memory in the terminal. If it looks familiar, it’s because I’ve already written “How To: Find The RAM Total In The Terminal“, which covered a couple of ways to check your RAM – all of which were in the terminal. I left the article open for others to share how they check their memory, but nobody left any comments.

In the previous article, I invited people to comment and share other ways to check RAM, RAM total, RAM usage, etc… Seeing as nobody commented, I figured I might as well return to the previous article and throw in a couple more ways to do check your memory in the terminal.

The previous article includes some handy tools, such as the easiest way:

While also mentioning a much more extensive and informative tool:

Both of which are lovely ways to check your memory in the terminal.

This being Linux, there’s also other ways.

Me being me, I figure I might as well share them with you.

After all, it’s yet another article that I can write! So, as unoriginal as this article may sound, there’s also a couple of tools I really want to introduce you to. 

There’s always room for more tools, especially if they’ll help you…

Check Your Memory (in the terminal):

As the line above indicates, you’re going to need an open terminal to do the work in this article. You can open it from your start menu, or you can just press CTRL + ALT + T and your default terminal should open right up.

The first tool we’re going to use is ‘top‘. I think you’ll find top installed on pretty much everything, though some distros are including variants like htop. The venerable top application is a terminal-based task manager and has been with us since 1984.

Anyhow, the command is nice and simple. Just run ‘top’ in the terminal:

The output will look something like this:

using top tto find your memory information
Look up near the top, above the fold, you’ll see the memory information. Pretty easy, isn’t it?

The last two lines of data, above the list of tasks, tell you all you need to know (unless you need a ton of details, I suppose) about your RAM, your RAM usage, what’s buffered, etc… It also tells you about swap, another facet of memory. 

Next we have a lovely command called ‘vmstat‘ a tool for showing virtual memory statistics. This lovely tool has been around since 1985 and has a ton of options. It’s an excellent tool and you’re highly encouraged to use the man vmstat command.

We actually don’t need all those lovely options for this. We don’t have to dig down very far to get the information you need. In fact, once again, you’re going to run the command without a single flag, like so:

The outcome of which is also self-explanatory. It looks like:

vmstat showing information, including ram information.
Look under the line clearly marked memory. See? There it is! There’s the memory info!

Just look under where it’s clearly marked ‘memory’ and you’ll see that you can use this to check your memory. It’s a bit more cryptic as it doesn’t directly show the total – but it does show you the information that’s actually important.

The total doesn’t matter. What really matters is how much RAM you’re using and how much RAM you have free. But, vmstat being vmstat, it will of course give you that information if you want it. If you do want that additional information, just use the --stats flag – like this:

Where you can see an output similar to this;

use the --stats flag to get a ton of memory information about your memory.
It contains not just that, but all sorts of information about your memory!

Pretty sweet, huh?

Closure:

There you have it, a follow-up article that tells you how to check your memory. After all, nobody wanted to add them as comments! Either way, you got to play with a couple of new tools, or at least tools not really mentioned here on this site.

Speaking of the site, the end of my year long project is in less than 2 months. That’s right, I’ve kept this up for this entire time, with a few guest articles in between. I’ll do a meta article, but I have to say that this has been a pretty fun (and educational) project. Maybe we’ll keep it rolling? It seems likely that I will. I quite like writing these things.

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.

Subscribe To Our Newsletter
Get notified when new articles are published! It's free and I won't send you any spam.
Linux Tips
Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.