Hard Drives (or HDDs) We have already spoken here in DesdeLinux, we have shown you guides or tutorials on dd (very useful or disastrous terminal application, it depends how you use it hehe) and more, this time I will talk about how we can recover or repair those HDDs that we have with problems at home, that we have "discarded" in a drawer or we already forget in a box 😉
If any hard drive has bad sectors we can repair them with the tool badblocksThe first thing to do will be to know which is the hard drive we want to repair (/ dev / sdb… / dev / sdc… etc), for this we put the following in a terminal:
sudo fdisk -l
This will show us / dev / sda, its size in GBs and its partitions, equal to / dev / sdb if it exists, and so sdc and others depending on the amount of storage devices you have on your computer.
Suppose the hard drive in question is an external one and is / dev / sdb, then the command to start detecting and repairing bad sectors would be:
badblocks -s -v -n -f /dev/sdb
- -s: indicates that the process will be displayed with percent
- -v: verbose mode, which means that it will show us the number of errors
- -n: indicates that we will try to use a non-destructive mode, that is, that we will try to recover those sectors but also the information that was in them
- -f: force reading and writing on devices that are mounted. Normally if the HDD were mounted badblocks would not check the sectors that are being used, but, as I already warned you and advised that you can NOT have the hard disk mounted, we will use the -f parameter to force the recovery of all possible sectors
It will take a long time, and I repeat, quite. It could easily last for hours or days depending on the size of the hard drive, how damaged it is, the speed of your computer, etc. So I recommend you leave the computer there quiet, without moving it for the necessary time, that and a lot of patience 😉
Table of Contents
Is there any specific tool for ext2, ext3 or ext4?
To tell the truth, there is, it can be used e2fsck, they still have to know which partition is the one they want to check, suppose it is / dev / sdb1, then it would be:
e2fsck -p -v -y /dev/sdb1
- -p: indicates an attempt to automatically repair the damage found
- -v: verbose mode, that is, to show us the errors on the screen
- -y: it will answer Yes to all the questions such as, do you want to recover X sector?
Well, nothing more to add, before I used HirensBootCD, but I think that this option will prevent me from booting from another OS. I also bought a 1tb external hard drive on this web I use to save important files, or I do it in the cloud.