Surely at some point, especially if you have had a computer for many years, it has happened to you that you have a hard drive that malfunctions or doesn’t start at all. Well, let’s see how to fix it on both Windows, Linux and Mac.
Having bad sectors is the easiest way for a hard drive to crash, although this failure will not stop working.
The problem comes when these errors get bigger and many sectors begin to appear where the information cannot be recorded or read. That is when the computer does not always start the first time, when on certain occasions the system does not respond, when we cannot read specific files, etc.
You can try to fix all these errors, although whenever we are going to do this we advise you to make a copy of the information and the boot sector that you currently have on the disk, since all that is not corrupt will be preserved.
To try to fix that defective hard drive we are going to use TestDisk, regardless of our operating system, since it is valid for Windows, Linux or Mac.
Solution to hard drive problems:
The first thing we have to do is download TestDisk on our computer, choosing the operating system we use.
Then we extract the compressed files and all the sub-directories.
- For Windows: we start TestDisk being Administrator.
- on linux: we need to be Administrator (root) to run TestDisk.
- for macOS: if we are not Administrator (root), TestDisk will be restarted after confirmation by us through “sudo”.
If what we want is to recover a partition from an image or repair a system file, we must execute certain commands.
- To create a raw disk image: testdisk image.dd
- If we want to recover the files from an “Encase EWF” image: testdisk image.E01
- In the event that the Encase image is split into multiple files: testdisk ‘image.???’
To use TestDisk on a set of files, we must execute test disk device.
For example, it will be like this:
- testdisk /dev/mapper/truecrypt0 either testdisk /dev/loop0 which will serve to repair the NTFS or FAT32 files in the boot sector of a TrueCrypt partition. It is extremely effective.
- testdisk /dev/md0 is to be used to repair system files from the boot of a Linux RAID device.
If we need to add any data to the registry, if TestDisk has been started from a read-only file, click on Create so that this image can be left in another place.
Simply by selecting what we have said and clicking on Enter It’s enough.
All the hard drives that we have must be detected by the program, as is logical, so that it knows of their existence.
They must be listed by their correct size, for which we will do the following:
- We use the keys to move up and down and thus select the exact hard drive with the lost partitions.
- We push Get in to continue.
In Mac OS, whenever it is available, it is convenient that we use /dev/rdisk* on a clean drive instead of ‘/dev/disk* to speed up data transfer.
From there we can continue.
This is when TestDisk shows us the Partition Table.
What we need to do now is select the partition table type. Almost always, both the default value or the type of partition table is correct, so there is little we need to do at first, nothing more than pressing the Enter.
Next, TestDisk displays the partition menus.
We must use Analyze to check our current partition structure and search for lost partitions. Right after we must press Enter to be able to continue.
Now information about the current partition appears, in addition to the fact that we can see others that are missing, as well as the errors in the current structure of all of them.
Depending on what appears, we can find damaged partitions, invalid boot points and partitions that are in good condition.
The next steps are:
- We select Quick Search and press Enter.
- Then we confirm that we are satisfied with what the operating system we have should be.
- We select the partition (which we have taken for granted) and we press p to list the files.
- If we need to return to the previous screen, we will have to click on the q.
- If all the directories and data are correctly listed, it only remains to press Enter to follow.
When we already have all the partitions available and the data corresponds to the listings, we can go to the write menu to save the partition structure.
You should know that Extd Part It will allow us to decide if the partition that we want is going to use all the available disk space or only the minimum space that it requires to work.
Once everything is to our liking, it’s time to write a new partition table or commit the one we have. We confirm in Write and press Enter and ready. From now on all partitions are registered in the partition table.
Recover NTFS boot sector
If the partition’s boot sector is still damaged, but the one in the backup we made is valid, we can use it to fix it.
We will do it as follows:
- We are going to overwrite the boot sector with the Backup sector.
- We select Backup BScopy it and press Enterthen click on okay.
The boot sector is now exactly the same as the working one from the backup.
From here, TestDisk is going to have to Restart your computer to access its data.
Once the system is operational again, we will have all our problems solved and everything will return to normal, since all the difficulties of the operating system have been solved.
It is an easy way, although with many steps, to solve the problems of partitions and damaged sectors of our hard drive.
If you have tried it, you can tell us about your experience on our social networks, since we would love to hear from you, how TestDisk went and what your impressions are.
George is Digismak’s reported cum editor with 13 years of experience in Journalism