23 C
Jaipur
Sunday, October 25, 2020

Check Disk for Errors Linux Mint 20 – Linux Hint

Must read

Python range() Function – Linux Hint

Python is a modern, general-purpose, and high-level programming language that comes with powerful features. Python has many built-in modules to support diverse operations. The...

2020 World Series live stream: how to watch Dodgers vs Rays game 4 from anywhere

Over the next few days,  the year's shortened MLB season will come to an end and baseball will crown a new champion - but...

Michigan vs Minnesota live stream: how to watch Big Ten college football tonight

Big Ten college football is back, and the Michigan Wolverines vs Minnesota Golden Gophers game - one of the oldest rivalries in American college...

How to watch Khabib vs Gaethje: live stream UFC 254 right now

It's Fight Island's final bout of the year, and what a clash to be ringing that final bell to. UFC 254 plays host to...

All the devices that we use are sure to fail one day; however, to prevent ourselves from the potential losses that are associated with these failures, we should try our levels best to keep monitoring these devices for their health and immediately taking any action if we find any anomalous behavior. The hard disks that we use with our computer systems also fail now and then due to several reasons. One such reason is the presence of bad sectors in our hard disk.

The major problem with these bad sectors is that we cannot remove them altogether from our hard disk for getting rid of them. The maximum we can do is to stop our operating system from using these bad sectors for putting our data on them. Therefore, in this article, we will walk you through the method of checking hard disk for errors and preventing our OS from writing data on the bad sectors using Linux Mint 20.

Method of Checking Disk for Errors in Linux Mint 20:

For checking your disk for errors in Linux Mint 20, you will need to perform the following steps:

  • We will be checking the hard disk for errors via the command line in Linux Mint 20. Therefore, we will first launch the terminal by clicking on the terminal icon located on the taskbar or pressing Ctrl+ Alt+ T keyboard shortcut. The newly launched terminal window is shown in the image below:
  • Now you need to know about your hard disk partitions so that you can identify the portion that you want to check for errors. For doing that, type the following command in your terminal and then press the Enter key:

This command requires root privileges to run. That is why we have used the “sudo” keyword before it. It is also shown in the following image:

  • The output of this command will show you all the partitions of your hard disk. We want to check the portion highlighted in the image shown below for errors using Linux Mint 20. Here, /dev/sda is the portion of the disk that we want to examine. In your case, this portion might have a different name.

  • Once you manage to identify the portion of the hard disk that you want to check for errors, the next step is to look for all the bad sectors in the identified portion and listing them down in a text file. For doing that, you need to type the following command in your terminal and then press the Enter key:

sudo badblocks –v /dev/sda > /scan_result/badsectors.txt

Here, the badblocks command also requires root privileges to execute and it will scan the specified portion of the hard disk (/dev/sda in this case) for any bad sectors, and if it finds any, it will list them down in the file named badsectors.txt which will be placed in the scan_result directory. Here, you should replace /dev/sda with the exact name of the hard disk portion that you want to scan for bad sectors. This command is also shown in the following image:

  • Once this command is executed successfully, all the bad sectors will be stored in the badsectors.txt file. Now, our goal is to convey this message to our Linux Mint 20 that it should not be using the bad sectors mentioned in the badsectors.txt file in any way. For doing that, you will need to type the following command in your terminal and then press the Enter key:

sudo fsck –l /scan_result/badsectors.txt /dev/sda

The fsck command also requires root privileges to run. This command will prevent our Linux Mint 20 to use the sectors listed in the badsectors.txt file while working with the /dev/sda partition. This command is also shown in the image below:

Conclusion:

By following the method described in this article, we can easily aggregate all the bad sectors together in a text file. We can prevent our operating system from using these bad sectors for writing our precious data. In this way, we can not only prevent our data from corruption or loss, but we can also use a hard disk with bad sectors for our routine tasks without any difficulty.

Source link

- Advertisement -

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article

Python range() Function – Linux Hint

Python is a modern, general-purpose, and high-level programming language that comes with powerful features. Python has many built-in modules to support diverse operations. The...

2020 World Series live stream: how to watch Dodgers vs Rays game 4 from anywhere

Over the next few days,  the year's shortened MLB season will come to an end and baseball will crown a new champion - but...

Michigan vs Minnesota live stream: how to watch Big Ten college football tonight

Big Ten college football is back, and the Michigan Wolverines vs Minnesota Golden Gophers game - one of the oldest rivalries in American college...

How to watch Khabib vs Gaethje: live stream UFC 254 right now

It's Fight Island's final bout of the year, and what a clash to be ringing that final bell to. UFC 254 plays host to...

How to watch Khabib vs Gaethje: live stream UFC 254 right now

It's Fight Island's final bout of the year, and what a clash to be ringing that final bell to. UFC 254 plays host to...