Restore Damaged or Corrupted Linux Partition Table

IT

Restore Damaged or Corrupted Linux Partition Table

When rebooting Linux virtual server (Ubuntu), we received the frightening Operating System Not Found error. 

Error

I verified the virtual hard drive was intact and accessible from the datastore. 

The first thing was to examine the structure of the virtual drive. I downloaded a Gparted Live ISO and saved to my local datastore.

Edit the settings of the virtual machine to start from the newly downloaded ISO file:

Edit settings

Open a console window and restart the server.

Follow the prompts to boot into the Gparted Live OS. 

Once booted, you will see the partition table displayed in graphical form. Here is what ours looked like. As you can see, it appears as unallocated space and unrecognized disk label.

Partition table

This suggests that the partition table is corrupt or no longer written to the disk.

Built into GParted is a great tool called TestDisk. 

TestDisk can do the following (according to their website).

TestDisk can:

  • Fix partition table, recover deleted partition
  • Recover FAT32 boot sector from its backup
  • Rebuild FAT12/FAT16/FAT32 boot sector
  • Fix FAT tables
  • Rebuild NTFS boot sector
  • Recover NTFS boot sector from its backup
  • Fix MFT using MFT mirror
  • Locate ext2/ext3/ext4 Backup SuperBlock
  • Undelete files from FAT, exFAT, NTFS and ext2 filesystem
  • Copy files from deleted FAT, exFAT, NTFS and ext2/ext3/ext4 partitions.

Open the command window from the desktop of GParted Live OS.

Type TestDisk and click Create:

Create

Next, choose the disk that you need to search. If you do not see your disk. click SUDO at the bottom to search as the Root user.

Click Proceed:

Proceed

TestDisk will search for the default partition type. You can typically just select the default choice:

Select default choice

Next, choose Analyse to allow TestDisk to examine the disk and look for the lost partitions: 

Analyse

You will see a listing of you current partition structure that was found. Click Quick Search to proceed.

You will now see a listing of the missing partitions. You can select a partition and choose P to examine the contents. 
Press Enter to continue.

If you are satisfied that all the partitions are found, you can click Write to write the partition table to the disk.

If there are additional partitions not listed, click Deeper Search to search more.

Once the partition is written, you can look at the partition in GParted to see the results:

Results

Shutdown the VM. 

Edit the VM to remove the ISO from the CD Drive. 

You can now attempt to start the OS, but we still received an error on boot.

1234F: This error is specific to Ubuntu and suggests our MBR (Master Boot Record) is busted.

*** The following was used to correct this, but again, it was specific to Ubuntu – Your results may vary!

Ubuntu has a boot repair disk available from here.

Download the ISO and save to your datastore.

Edit the settings of your VM to boot from the new ISO.

Edit settings

Open a console window and restart your VM.

Follow the prompts to boot into the Boot-Repair-Disk.

Boot-Repair-Disk

If the disk determines a repair is necessary, you will see the following:

Boot Repair

Click Recommended repair.

After the repair, you should see a message saying that the MBR was successfully repaired.

Boot successfully repaired

Edit the virtual machine to disconnect the ISO and boot into your operating system.

More About the Author

Scott Matlock

Regional IT Practice Lead
You Down with SOP? My kids are terrible at doing their chores. Each day, my highly organized wife leaves a list of items that must be accomplished before ...
Learning Technology on the EDGE The consequence of a dynamic environment is the need to know it all, or at least the perceived need to know more than anyone else. That ...

See more from this author →

Subscribe to our newsletter

  • I understand that InterWorks will use the data provided for the purpose of communication and the administration my request. InterWorks will never disclose or sell any personal data except where required to do so by law. Finally, I understand that future communications related topics and events may be sent from InterWorks, but I can opt-out at any time.
  • This field is for validation purposes and should be left unchanged.

InterWorks uses cookies to allow us to better understand how the site is used. By continuing to use this site, you consent to this policy. Review Policy OK

×

Interworks GmbH
Ratinger Straße 9
40213 Düsseldorf
Germany
Geschäftsführer: Mel Stephenson

Kontaktaufnahme: markus@interworks.eu
Telefon: +49 (0)211 5408 5301

Amtsgericht Düsseldorf HRB 79752
UstldNr: DE 313 353 072