There are times when we try to initialize our Windows or Linux system normally and we get a startup error type cannot find the device to start, cannot find the operating system or directly we have an error on the hard disk.
In those cases, it is convenient to try to repair our hard drive in some way for fear that we have not made a backup copy of our system, before trying to change our hard drive, since it cannot be repaired.
There are several ways to try to repair our hard drive and get all its information:
Through an external drive with the Ubuntu operating system prepared, we will start the system. In this link we indicate how to start an operating system from a flash drive.
Once the Ubuntu system is booted from the flash drive, we will try to repair the damaged hard drive using a series of commands that can be executed from the terminal Linux. What these commands are going to do is isolate the sectors that are damaged, so that the hard disk will avoid storing the information in these sectors that are not in good condition.
These tools will only detect damage to the sectors, so if there is any physical damage to the disk or problems with the heads, the hard disk cannot be easily repaired, so it is advisable to change the hard disk.
One of these tools to use is badblocks, which will help us locate those sectors with failures to store information and try to recover them.
To use this tool, the first thing to do is to identify the hard drive that we are going to repair, for this we will open a terminal and execute:
sudo fdisk -l
We can get something of this style, where the drive to repair is "sda" with a capacity of 240GB, and our flash drive is "sdb".
Once our hard drive is identified, we proceed to run badblocks from the terminal, in this case the drive to repair is / dev / sda. For this we will apply the following command in the terminal.
sudo badblocks -s -v -n -f /dev/sda
Where indicating the following:
This tool, depending on the size of the disk, can take hours or days.
fsck allows us to isolate those bad sectors for information storage.
For its 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:
This tool, like badblocks, depending on the size of the disk can take hours or days.
Canonical URL: Repair Damaged hard drive with Linux Ubuntu