Repair and isolate bad sectors on your hard drive with these tools

Written by BiRU Tuesday, 15 November 2022 12:30

Print

I have recently given myself the task of maintaining my equipment, so, within the tasks, identify that my hard drive already has some bad sectors which has been the cause that has slowed down its operation a bit.

While in Linux we have some very effective tools and quite powerful for this type of task, this is excellent since we are not going to break our heads looking among the many that exist for Windows and most of them are based on the same method.

In Linux they do the same thing that is to encapsulate or isolate the sectors that are damaged, in this way the disk will avoid storing the information in these sectors that are no longer optimal for it.

I must mention that The following tools will only detect the damages in the sectors Therefore, if there is any physical damage to the disk or problems with the heads, this type of damage can no longer be easily repaired, so it is recommended that you change the hard disk.

Now inside dand the tools that we will use this badblocks, this powerful tool will help us locate those sectors with failures or that are no longer optimal for storing information and try to recover them.

Use of badblocks to repair hard drive.

For the use of this tool the first thing is to identify the disk that we are going to repair, for this we will open a terminal and execute:

1
sudo fdisk -l

Once this is done, we will see the mounting point that our disk has, now it is important that the disk that we are going to analyze and repair with badblocks is not in use, so it is the disk where you currently have your system, I recommend you use a Live CD / USB of your system.

Mount point already identified we proceed to execute badblocks from the terminal, in my case the disk that I am going to repair has the mount in / dev / sdb

1
sudo badblocks -s -v -n -f /dev/sdb

Where we are indicating the following:

In my case it is a disk to which the information has already been backed up, so I have no problem with the data so all the data will be overwritten, block by block I execute the following:

1
sudo badblocks -wvs /dev/sdb

We just have to have a lot of patience for this as depending on the damage and the size of the disc it can take from hours to days. So I recommend you leave the computer and prepare a good series marathon if your disk is badly damaged.

How to isolate bad sectors of the hard drive?

Now if what you are interested in is being able to isolate those sectors that are no longer optimal for storage of information, we can use the fsck tool.

This tool it is a good complement for badblocks and I also recommend its use for analysis and preventive maintenance, since using this tool periodically we will have a disc in good condition for a long time.

For your use, like badblocks, the disk that we are going to analyze and repair must be unmounted, now we must open a terminal and execute the following command:

1
sudo fsck -cfvr /dev/sda

Where we are indicating the following:

In the same way we must wait and be patient.

If you know of any other tool that helps us with this work, do not hesitate to share it with us, also as a personal comment if the time it takes for these tools to complete their task is more than one day, you should start thinking about purchasing a new disc since in time to back up your information and avoid unnecessary losses.