Sunday, 6 November 2016

Restore the E2B partition under 64-bit WinPE

If you use .imgPTN partition image files to boot to WinPE, you sometimes may want to return the E2B USB drive partitions back to it's original 'E2B' state (without having to boot into CSM\MBR mode), so that you can access the files on the E2B partition whilst running WinPE.

When you 'switch' to a .imgPTN file, the original E2B MBR (which contains the partition table), is backed up to sector LBA30 on the E2B USB drive. To restore the original E2B partitions, we need to copy the contents of LBA30 to LBA0 (the MBR sector).

The .imgPTN file already contains a \e2b folder which has various utilities which you can use restore the E2B partitions:

  • FindCSMandRestoreE2B.cmd
  • RestoreE2B (run as admin).cmd
  • SWITCH_E2B.exe
The problem is that these all use 32-bit Windows executables, and so will not work if you are currently booted to a 64-bit version of WinPE that does not support WoW64.

If this is a problem for you, download the WinRaR self-extracting and auto-running file: MBRFIX_E2B.exe (32-bit) or MBRFIX_E2B_64.exe (64-bit) from the Alternate Downloads - Other Files folder and copy the file to your MakePartImagexxx\csm\e2b folder (or copy into your existing .imgPTN images). 

MBRFix comes in both a 32-bit and 64-bit form, and so this script should work for both 32-bit and 64-bit WinPE. For usage details of MBRFix, refer to the .htm ReadMe file here.

The problem is that the script does not make any checks that LBA30 actually contains a valid backup MBR, so it can trash your MBR if LBA30 does not contain a valid MBR backup. However, the script does display the new MBR after it has been updated and you can choose to restore the original MBR if it does not look correct (for instance if there are no partitions listed).

LBA30 is written to the MBR

If the MBR does not look correct, you can restore the original MBR.
P.S. MPI Tool Pack 0.070 now contains \e2b\RestoreE2B_32_64.cmd. This performs some checking of LBA30 and LBA60 and automatically updates the MBR if valid. If you run this from the command line, use the 'sure' parameter to suppress the user prompt and make it fully automatic.

Please let me know if you find this useful (or tick the 'cool' Reaction box below), and I may include it in the next version of the MPI Tool Pack download.