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

Repair HDD in Ubuntu

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.


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   Pedro Correa said

    Hi, thanks for the help, I am trying to recover a backup disk that got damaged. The thing is slow but it works :), when I finish I will share the result.

  2.   Reinaldo Gonzalez said

    Thanks for the information, I have a 500gb hard drive with two SOS, I looked to analyze slackware 14.2 but it gave me an error after a crash and under no circumstances will it let me enter now with this method I will try to make it work ...

    eye if someone knows how to recover this error please let me know

  3.   Animals said

    What a good tutorial, thank you very much. I have started to scan a 1Tb HDD and it took 16 hours, 2 patterns finished the other by 4%. It was the original disk that the HP 14-ac132la brings, I noticed a change in its performance spoiling the work a lot, I have changed it for a 240Gb Kingston SDD and it flows perfectly. The previous one I have put in the CD bay (this laptop does not come with that unit) with a caddy and it has fit perfectly. Now to wait for the badblocks work to finish, continue with the fsck and hopefully it will be optimized as additional storage. I have also changed the OS from Win10 to Ubuntu, it had me fed up with so much mediocre and slowing down update.
    Thanks again for the tutorial.
    One more follower.

    1.    CarlosD said

      I had the same problem, the original 1 Tb disk of my HP laptop did not lift Win 10, I made the change with a 128 Gb solid disk and took advantage of installing Ubunto 19.10, now I am repairing the 1 Tb disk with badblocks and I'm on my way 53 hrs, let's see when it ends.
      40464163 done, 53:18:44 elapsed. (1772/0/0 errors)
      40464164 done, 53:22:01 elapsed. (1773/0/0 errors)
      40464165 done, 53:25:18 elapsed. (1774/0/0 errors)

  4.   Guille RS said

    Eventually I had an error and the OS would freeze, it occurred to me to analyze the disk and I had errors in blocks and clusters. Just use fsck with the above parameters and Xubuntu stopped freezing.

    Thanks for the excellent tutorial help.

    Greetings from Argentina!

  5.   John Gesell Villanueva Portella said

    Ok, thank you very much, for now the badblocks thing is going well for me, I already identified 4 damaged blocks. I am doing the operations from an ISO image on a pendrive; I hope everything is in order at the end, thanks for everything!

  6.   Martin said

    Hello, the tutorial is very good! I ask you a question: on my pc the disk tool throws me the sig. message: «Disk correct, 32456 bad sectors», and with Smart I see several items such as «Pre-failure». That's normal? And the weird thing is that when I run Badblocks or FSCK, I get that everything is ok and it doesn't have any errors. That could be happening? Thanks a lot!

  7.   Achilles Baeza said

    It is a real SHAME, that sites where the use of FREE software is encouraged, force visitors to accept the use of cookies, really, they are embarrassing to others.

    1.    Christian Cala said

      And it is also a REAL SHAME the fact that you do not know what a cookie is, gafo! Shut up and focus on learning clown

    2.    Beloved said

      Your comment reflects the little knowledge you have of Blog and the management of Web pages. Before criticizing, advise yourself so that you do not suffer pain.

    3.    free said

      My son, you are mixing lashes with your ass. This is not a capitalist ruse, but a legal obligation for ALL internet pages, since ALL are hosted on a server that hosts cookies on your computer.

  8.   angel kirilov said

    Hello,
    1TB disk for 216 hours and the% is 106189%?!
    Nowhere does it say how much is left, what should I do?

  9.   Akshay patil said

    Can I install new OS after isolating bad sectors without any error? While installing new OS we have to format disk, which can remove isolation?