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 Operating System on the first system. Also restart your Windows system before you begin.

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).
Boot to the legacy E2B menu and press shift+c to get the grub4dos command prompt (you may need to press shift+p and enter the menu password first). In the grub4dos console type checkptns to list and check the partition order.

Typically, Partition 1 of a standard E2B USB drive will always start at 2048. If it does not start at 2048 then the USB drive partitions may have been changed – possibly because a .imgPTN file has been switched in.

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

Scroll down to the end of this page (see fix30)… 

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! You should be offered the option to delete when you MBR\Legacy boot.

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. This is because the Windows registry can get confused when using multiple USB drives, etc.

1. Can you see any files on the USB drive in Windows Explorer? – If YES then go to Section A below. 

2. (no files on drive) – The MBR and partition tables may be corrupt. If you have ever used .imgPTN files, then sector 30 and 60 should contain a backup copy of the E2B MBR sector. If you have never used .imgPTN files then LBA1 should contain a backup sector which was created when you first made the E2B USB drive. 

We need to find a good backup sector of the MBR (LBA0). This can be at LBA30, LBA60, LBA1000 or LBA1.

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) and for LBA1000.

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

We are looking for a good backup of the MBR which will be at LBA30, LBA60 or LBA1.

Note that LBA1 may be an old backup – if possible, check the partition table listed by the Drive Info command output before following the next step and use Drive>File button – LBA0.bin – 0 – 1SEC – 0 to save a copy of the MBR.  Follow the ‘Restore MBR‘ section below if the partition table at LBA30 or LBA1 looks OK.

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. 1000 or 1) 
This saves a file called mbr.bin which contains the sector contents of LBA n. 

2.2. Now click on 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. Check in Windows Explorer (you may need to unplug and reconnect the USB drive).

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.

2.3 Re-install grub4dos…

WARNING: Only re-install grub4dos if you can see the correct E2B files (e.g. \_ISO folder)!

Now, re-install grub4dos using:

First use RMPrepUSB – Ctrl+B to install the standard MBR boot code and then…

RMPrepUSB – Install grub4dos – Y=MBR – cancel the 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 the 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. 

2.5 The USB drive should now be restored. If E2B is not working correctly, run the Update_E2B_Drive.cmd command in the extracted E2B download folder.

If you cannot find any backup sector at LBA1, LBA30, LBA60 or LBA1000, 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 (but check the filesystem first).

‘Cannot find GRLDR’ error

First unplug and then re-connect the USB drive.
Ensure the file \glrdr is present on the first partition.
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 in Windows – 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\LANG folder go to Section C, if you don’t see either of these two folders go to Section D.

Section B

\_ISO folder present

The USB drive has probably lost its 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 the copy of grldr if prompted. 

Now follow 2.3/1 (update PBR section) onwards – see above. 

Section C

.imgPTN \e2b folder present

The USB drive has probably been switched to a .imgPTN image if an \e2b\LANG folder is present.

Use \e2b\SWITCH_E2B.exe – Restore E2B Partitions  to restore the E2B partitions. You can use the Display Partitions button to see what MBR backups are present.

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/2.5 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/2.5 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.  

If you thing the MBR partition table looks wrong (e.g. Partition 1 does not start at 2048) then go to the ‘Restore MBR’ section below.

— o O o —

Repair a corrupt Linux persistence partition

If the persistence file is corrupt, a linux ISO may not fully boot unless you first delete the corrupt 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

Fix30 – 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 – but first check that Partition 2 contains an \e2b folder and, if present, Partition 3 contains your original files:
1. Boot to E2B Main Menu (you can use QEMU button in RMPrepUSB.exe if you cannot legacy boot on a real system).
2. In the E2B menu – press SHIFT+P and enter the menu password (default = easy2boot)
3. Press SHIFT+C to get to the grub4dos console
4. Type checkptns and if OK then 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 (press shift+c) and type RestoreMBR

Tip: Type checkptns to check the current partitions in the MBR.

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.

If you wish to restore the original MBR from LBA1 (when the USB drive was first installed with grub4dos) then run RestoreMBR1

Still no good?

If that still does not work then contact me.

New! Ventoy for Easy2Boot v1.0.97 now released!

 

eBooks available (in PDF format)

Easy-to-read eBooks are available in PDF format (each eBook is over 100 pages) – rated 4.5/5 stars.
Learn the secrets of Legacy and UEFI USB booting and then make your perfect multiboot USB drive.
E2B eBook #1 includes instructions on how to remove the E2B 5-second start-up delay blue screen.

E2B is unique in that it uses partition images which allows you to directly boot from Secure Boot images (no need to disable Secure Boot or run MOK manager or modify your UEFI BIOS).

Most eBooks are over 100 pages long, contain original content and step-by-step exercises which are suitable for both the beginner or the more experienced user.
Customer reviews are located at bottom of each eBook product page and multi-buy discounts are available when you buy more than one eBook. Please also visit RMPrepUSB.com and the E2B Forum.
Subscribe to my blog for the latest news, tips, USB boot articles and free eBook updates.