When rebooting Linux virtual server (Ubuntu), we received the frightening Operating System Not Found 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:
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.
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:
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:
TestDisk will search for the default partition type. You can typically just select the default choice:
Next, choose Analyse to allow TestDisk to examine the disk and look for the lost partitions:
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:
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.
Open a console window and restart your VM.
Follow the prompts to boot into the Boot-Repair-Disk.
If the disk determines a repair is necessary, you will see the following:
Click Recommended repair.
After the repair, you should see a message saying that the MBR was successfully repaired.
Edit the virtual machine to disconnect the ISO and boot into your operating system.