ZENworks Imaging: How to recover corrupt GPT disk header and partitions

over 6 years ago

GPT (GUID Partition Table) is the standard for disk partition layout on UEFI devices. GPT is much more scalable than MBR based partitioning scheme. The specification also adds provision for backup disk partition layout information to recover from failures.

There are applications (like Antivirus software) which write on areas of the disk depending on the boot mode (i.e. UEFI or BIOS mode). If such a software detects BIOS mode and writes any information in between 5 to 34 sectors of the disk, the GPT information is corrupt. The operating system might not boot into UEFI mode any more. The situation becomes trickier if the MBR (Master Boot Record) is also tampered with. In these cases where you may not be able to recover a disk information though there is no hardware failure.

Today as you know, ZENworks Imaging can restore a base image. However, it cannot prevent data loss. Now the question is whether it is possible to boot the OS in UEFI mode again without restoration?

The answer is YES. With ZCM 11.4, ZENworks Imaging provides an option (unsupported) to attempt recovery of the GPT layout information if either the primary or backup GPT information is intact! The functionality is integrated into the img utility and provides the following capabilities:

  • Confirm that the disk is not an MBR-based disk

  • Check if either the primary or backup GPT information is intact by validating checksum

  • Regenerate Protective MBR, GPT Header signature, revision, size, LBA, Alternate LBA, First and Last usable LBA, Disk Unique GUID from system entropy

  • Reconstruct the Partition related information (for all partitions) from the GPT Partition Array that is still intact

  • Write back the GPT layout information on the disk

To use the utility, boot into the ZENworks Imaging distro environment and run:
# img --fix /dev/sdN

where, N is the GPT partitioned disk you want to fix. Note that you should pass the device path for the full disk, NOT a single partition on the disk.


If the disk has no issues or the tool could fix the problems with GPT information, it will show the "Operation successful" message.


If the disk cannot fix GPT information due to some unrecoverable error, it will show an appropriate message and exit.



How To-Best Practice
Comment List
Related Discussions