Welcome to AUXNET IRC Network

Idle on AUXnet a lot? Why not play our idlerpg game, you can check it out at #idleRPG - for more information visit the website http://idlerpg.auxnet.org

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

Attention: open in a new window. PDFPrintE-mail

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:

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

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

Where we are indicating the following:

  • -s. It shows us the process of scanning the disk, showing us the sectors already checked.
  • -v. It indicates the writing mode used.
  • -n. It puts us in non-destructive mode, this means that the damaged sectors will be recovered and the information on the hard disk will not be damaged or deleted.
  • -f. It will repair bad sectors.

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:

sudo badblocks -wvs /dev/sdb
  • - in: Write mode (destructive).
  • -s. It shows us the process of scanning the disk, showing us the sectors already checked.
  • -v. It indicates the writing mode used.

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:

sudo fsck -cfvr /dev/sda

Where we are indicating the following:

  • -c. Check blocks on disk.
  • -f. Force the check, even if everything seems ok.
  • -v. Display more information.
  • -r. Interactive mode. Wait for our reply.

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.