How to Repair a corrupt E2B USB drive

Note: If prompted by Windows to format the drive – DO NOT FORMAT IT!

 If you have accidentally corrupted your E2B USB drive, DON’T PANIC! – here is how to fix it. First, check the USB drive using a different system to see if there was a problem with the first system or it’s OS. 

Windows 10? – try this first!

Windows 10 seems to have a bug and may not recognise a perfectly good USB drive (due to bad registry entries)!

First test in another system to check if the problem is your Win10 system (also try a different USB port after rebooting).

Fix USB device registry using USBDeview as follows:

  1. Download and run NirSoft USBDeview.exe (USB Device Viewer).
  2. Highlight the USB drive
  3. Right-click – Uninstall Selected Devices
  4. Now unplug and reconnect the USB drive.

Troubleshooting Procedures

agFM menu issues

Update the agFM files on partition 2 by running \e2b\Update agFM\Download and update agFM_v2.cmd.

If you cannot UEFI-boot at all to agFM, try Legacy booting (or use \QEMU_MENU_TEST.cmd on USB drive) – E2B will check partitions for you. UEFI BIOSes do not recognise disks with out-of-order partition entries.
Partition 4 on your USB drive should be unused (type = 0).

Ventoy menu issues

Update the Ventoy files on partition 2 by running \e2b\Update agFM\Update_to_latest_Ventoy_version.cmd 

E2B/General issues…

‘Sector at LBA30 appears to contain code’ error or other LBA30 .imgPTN issues

See end of this page… 

ERROR: PARTITION TABLE ENTRY #4 (Type=?) MUST BE EMPTY!

Normal E2B USB drives use only Partitions 1 and 2, Partitions 4 should be unused.

Partition 4 must be unused on E2B USB drives – just answer the questions to erase partition 4. Partition 3 may or may not be used on an E2B USB drive.

Only erase these partitions if you are sure that they do not contain wanted files!

Some ISO and payload files can cause partitions 3 or 4 to be created each time they are run – look them up in the ‘List of tested payloads‘ page for more details. 

For all other errors – START HERE…

First – use USBDeview as above – then unplug the USB drive – reboot your system – reconnect the USB drive. 

1. Can you see any files on the USB drive? – If YES then go to SectionA below. 

2. (no files on drive) – If you have ever used .imgPTN files, then sector 30 and 60 should contain a copy of the E2B MBR sector.
If you have never used .imgPTN files then LBA1 should contain a backup sector. 

We need to find a good backup sector of the MBR (LBA0)…

Use RMPrepUSB – Drive Info – 30 to view backup sector LBA30 of the USB drive.  

 Are the last two bytes on the 01F0 line 55 AA ? e.g.

 01F0 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 55 AA  ........ ......Uª

If bytes 55 AA are not present, repeat the Drive Info command using 60 (for LBA60).

If bytes 55 AA are not present in LBA60, repeat the Drive Info command using (for LBA1). 

Note that LBA1 may be an old backup – if possible, check the partition table before following the next step and use Drive>File button – LBA0.bin – 0 – 1SEC – 0 to save a copy of the MBR. 

If you found a sector ending in 55 AA, we can write that sector to LBA 0 (the MBR boot sector) to restore the original partition table as follows: 

2.1. RMPrepUSB – Drive -> File – mbr.bin (type in this name) – Sector Start = n – Length=1SEC – File start=    (where n is the backup sector 30, 60 or 1) 
This saves a file called mbr.bin which contains the sector contents of LBA n. 

2.2. RMPrepUSB – File   -> Drive – mbr.bin (pick this file) – File Start=0 – Sector Start=0 – Length=0                   

This writes the file to LBA 0 and overwrites your MBR.  You should now be able to see the E2B USB drive contents. 
Tip: If this frightens you and you have used .imgPTN files, then instead run the .\MPI_Tool_Pack_Plus_CloverLite_0xx\csm\e2b\RestoreE2B (run as admin).cmd script from the MPI Tool Pack download. This should restore the original E2B partition table.

WARNING: Only re-install grub4dos if you can see the correct E2B files (\_ISO folder)!
Now, re-install grub4dos using:
 2.3 RMPrepUSB – Ctrl+B to install the standard MBR boot code and then…
     RMPrepUSB – Install grub4dos – Y=MBR – cancel copy of grldr if prompted – it is not the correct version. 

2.3.1 Now we install grub4dos to the PBR – so run…
      RMPrepUSB – Install grub4dos – N=PBR – cancel copy of grldr if prompted.

2.4 Now check the filesystem of the USB drive – right-click on the drive letter – Properties – Tools – Check.
 From an Admin command prompt (type cmd if in Powershell) run chkdsk U: /f where U: is the USB drive letter. 

The USB drive should now be restored. If E2B is not working correctly, try the Update E2B Drive command in the E2B download. E2B v1.99 and later has a bug fix for issues when the CSM menu option 0 (Boot to E2B Menu) does not work. 

If you cannot find any backup sector at LBA1, LBA30 or LBA60, run TESTDISK to try to recover any important files that may still be on there and then re-make the E2B USB drive from scratch. If Update E2B Drive does not fix the problem and you suspect file corruption has occurred, then copy the entire contents of the E2B download folder over to the E2B USB drive so that it overwrites all the E2B files on the USB drive (check the filesystem first).

‘Cannot find GRLDR’ error

First unplug and then re-connect the USB drive.
Ensure the file \glrdr is present.
Use Explorer – (right-click) – Properties – Tools – Check to repair the drive. 

If you still get this error:
1. Copy all files and folders from the E2B USB drive to a temporary empty folder on your system hard drive (except Windows protected folders)

2. Use the latest E2B download or Make_E2B.exe to make a new E2B drive

3. Copy all your files back to the USB drive

4. Run Update E2B Drive (from the Make_E2B.exe GUI or using the .cmd file in the download) to ensure the E2B drive has the correct E2B files

 – o O o –

Section A

If you can see some files on the E2B USB drive…

First check and fix the filesystem of the USB drive – right-click on the USB drive letter – Properties – Tools – Check.

Then, from an Admin command prompt (type cmd if in Powershell) run chkdsk U: /f where U: is the USB drive letter.

Next, if you see a \_ISO folder go to Section B, if you see a \e2b folder go to Section C, if you don’t see either folder go to Section D.

Section B

\_ISO folder present

The USB drive has probably lost it’s boot sectors. 

Run RMPrepUSB – Ctrl+B to install a standard MBR.

WARNING: Only re-install grub4dos if you can see the correct E2B \_ISO files!

Then run RMPrepUSB – Install grub4dos – Y=MBR – cancel copy of grldr if prompted. 

Now follow 2.3/1 (update PBR section) and 2.4 above. 

Section C

\e2b folder present

The USB drive has probably been switched to a .imgPTN image.  

Use \e2b\SWITCH_E2B.exe – Restore E2B Partitions  to restore the E2B partitions.

If no partition is listed by SWITCH_E2B.exe, the USB drive probably no longer contains a grub4dos MBR or grub4dos boot code, so you can run \e2b\RestoreE2B_32_64.cmd  as Administrator. This should restore the E2B partition(s). 

If not, try running RMPrepUSB – Ctrl+B to install a standard MBR. 

WARNING: Only re-install grub4dos if you can see the correct E2B \_ISO files! 

Then run RMPrepUSB – Install grub4dos – Y=MBR – cancel copy of grldr if prompted. 

Also, use RMPrepUSB – File Info – \e2b\MBR.bin – 0 to examine the contents of \e2b\MBR.bin on the E2B drive, it should have an NTFS partition and another partition, something like this: 

Partition 1   SIZE=121435.969MiB   Type: 07 NTFS\exFAT  ACTIVE
 START POS   = CYL:0 HD:32 SEC:33       END POS = CYL:1023 HD:254 SEC:63
 START (LBA) = 2,048 (00000800) SIZE (LBA) = 248,700,865 (0ED2DFC1) [End=248,702,912]

 Partition 2   SIZE=675MiB   Type: 0C FAT32LBA (2047GB max)       
 START POS   = CYL:1023 HD:254 SEC:63       END POS = CYL:1023 HD:254 SEC:63
 START (LBA) = 248,702,976 (0ED2E800) SIZE (LBA) = 1,382,400 (00151800) [End=250,085,375]

If it has an NTFS partition at 2048, restore that file to the MBR using RMPrepUSB – File>Drive – \e2b\MBR.BIN – 0 – 0 – 0
If you get a ‘File read error’ from RMPartUSB, copy the MBR.BIN file to a folder on your C: drive and try the command again using the copied file. 
Once the E2B partition(s) are restored, follow 2.3, 2.3.1 and 2.4 above. 

Section D

no E2B folders/files present

If you don’t recognise any E2B files, the drive may have been reformatted accidentally by an OS installer!

This may mean that you have lost all or many of your E2B files!

Follow 2.1, 2.2, 2.3 and 2.4 or run TESTDISK to try to recover any important files that may still be on there and then re-make the E2B USB drive from scratch.  

Repair a corrupt persistence partition?

If the persistence file is corrupt, a linux ISO may not fully boot unless you first delete the persistence file. You can try to repair the persistence file as follows:First, attempt to boot from E2B with persistence so that E2B adds the xxxx-rw persistence file into the partition table.
Do not reboot to the E2B menu.

If offered a choice in the Linux boot menu, then boot without persistence or in safe mode. Otherwise, boot from a Linux LiveCD or other LiveCD media and then connect the E2B drive.
/dev/sdX3 should be the persistence partition (where X is drive letter for E2B drive).
Use the Linux shell commands sudo lsblk,sudo fdisk -lsudo blkid and df to check what device name the USB drive has been given.  To repair, type:
sudo e2fsck -p -n /dev/sdX3

Message: ‘Sector at LBA30 appears to contain code or grub4dos not installed – please reformat using RMPrepUSB’.

E2B requires that sector 30 (LBA30) is unused and that grub4dos is installed to the MBR (when installing grub4dos, the old MBR is written to LBA1 as the backup sector). 

LBA30 should either contain 512 bytes of all the same value (e.g. all 00 or all FF or all EC, etc.) or contain a valid backup of the E2B MBR.

When you select a .imgPTN file, LBA30 is checked to make sure it is either empty or contains the same contents as the MBR – if it is different then it is not safe to change the MBR because it may already have an image file switch-in to it.

If LBA30 contains random data or code, you will not be allowed to use it as a backup sector and cannot switch-in .imgPTN image files.

E2B thinks that possibly sector LBA30 is in use on your drive. This usually happens if the drive was not freshly formatted (e.g. using RMPrepUSB), or perhaps another bootloader such as grub or grub2 has been installed accidentally onto the E2B USB drive. 

To fix LBA30 and LBA60, do the following:
1. Boot to E2B Main Menu
2. Press SHIFT+P and enter the menu password (default = easy2boot)
3. Press SHIFT+C to get to the grub4dos console
4. Type fix30 and press Y and [ENTER] to fix LBA30 and LBA60 

WARNING: Only do this if you are sure the partitions on your E2B drive are correct!

 Alternatively use RMPrepUSB… First use RMPRepUSB to install grub4dos to the MBR (do not overwrite the /grldr file). 

If it is booting to grub4dos and E2B correctly, you can fix this by over-writing LBA30 and LBA60 with the contents of LBA0 as follows using RMPrepUSB.

1. Select the E2B USB drive in the Drive List box in RMPrepUSB

2. Drive->File – MBR.BIN – Start = 0, Length=1SEC, FileStart=0

3. File->Drive – MBR.BIN – Start=0, USBStart=30, Length=0

Repeat the same command for LBA60

File->Drive – MBR.BIN – Start=0, USBStart=60, Length=0

Alternatively, you can boot to E2B, go to the grub4dos command prompt (shift+p – (enter the E2B password) – shift+c) and use the following commands:

dd if=(hd0)0+1 of=(hd0)30+1
dd if=(hd0)0+1 of=(hd0)60+1

Restore the MBR

You can use Switch_E2B.exe – Display Partitions button to display the MBR partition table and LBA30 and LBA60 and LBA1 (LBA1 may be old – especially if you have resized partitions since making the E2B drive). LBA60 is a backup of LBA30 (in case LBA30 is overwritten by bootloader code).

If LBA30 looks correct and you are having problems restoring the original partitions then you can force the MBR to be updated using grub4dos as follows:

In the grub4dos E2B menu system (Legacy boot), exit to the grub4dos console and type RestoreMBR…

Note that the whole MBR is restored. If it does not contain the grub4dos bootloader code, you can use RMPrepUSB – Install grub4dos – MBR = Yes to re-write it.

Still no good?

If that still does not work then contact me.