Linux Mint

Check Disk for Errors Linux Mint 20

Check Disk for Errors Linux Mint 20
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:

sudo fdisk -l

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:

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:

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.

How to Change Mouse and Touchpad Settings Using Xinput in Linux
Most Linux distributions ship with “libinput” library by default to handle input events on a system. It can process input events on both Wayland and X...
Remap your mouse buttons differently for different software with X-Mouse Button Control
Maybe you need a tool that could make your mouse's control change with every application that you use. If this is the case, you can try out an applica...
Microsoft Sculpt Touch Wireless Mouse Review
I recently read about the Microsoft Sculpt Touch wireless mouse and decided to buy it. After using it for a while, I decided to share my experience wi...