Thursday, 21 January 2016

Problems UEFI-booting .imgPTN files - continued...

I have experimented some more with my Asus Z87 UEFI system and .imgPTN files, and it seems that the firmware will not provide the user with the UEFI boot option to UEFI-boot from an MBR-partitioned USB drive, if the partitions on that drive are out of order.

The Partition Table in the MBR (first sector) has 4 'slots' for 4 partition entries.

Each Partition Table entry has the following fields:
  • Drive number and Active/boot flag
  • Partition Type number (e.g. 0C = FAT32)
  • Start address of partition
  • Number of sectors in the partition
(there are also some parameters for old Cylinder/head/sector addressing).

If we use two partition image files with E2B, then when the .imgPTN file is selected, the Partition Table is re-written by E2B (or SWITCH_E2B) and we get the following results (depending on where the two files are located):

Example 1: No UEFI boot option is displayed by firmware - BAD
TABLE SLOT 1: FAT32 Start=8,194,236 (xxxx.imgPTN)
TABLE SLOT 2: empty
TABLE SLOT 3: NTFS  Start=4,234,556  (xxxx)
TABLE SLOT 4: empty

Example 2: No UEFI boot option is displayed by firmware - BAD
TABLE SLOT 1: NTFS  Start=8,194,236 (xxxx.imgPTN)
TABLE SLOT 2: empty
TABLE SLOT 3: FAT32 Start=4,234,556  (xxxx)
TABLE SLOT 4: empty

Example 3: UEFI boot option is displayed by firmware - OK
TABLE SLOT 1: NTFS  Start=4,234,556  (xxxx.imgPTN)
TABLE SLOT 2: empty
TABLE SLOT 3: FAT32 Start=8,194,236 (xxxx)
TABLE SLOT 4: empty

Notice how the partition start locations in slots 1 and 3 are not in the correct order. 

Side note: The unused entry at slot 2 does not affect anything (i.e. the slot 3 entry can be moved to slot 2 and we still get the same results).

So I have found that if any of the four partitions are 'out-of-order' then no UEFI boot option for the USB drive is displayed by the Z87 firmware (it obviously thinks the partition table is invalid). However, it still provides the normal CSM\MBR boot options!

MOVE_IMGPTN script (E2B v1.77c)

This means that if we want to use two partition image files, we need to ensure that the .imgPTN file (PTN1) is located on the E2B drive before the file without the file extension (which becomes PTN3).

If the .imgPTN file is small and the other file is very large, normally the NTFS file system will place the smaller .imgPTN before the larger file (but not always!). Unused, contiguous clusters are written to before deleted or fragmented free clusters.

E2B v1.77c Beta has the MOVE_IMGPTN Windows script added, which checks the position of these files and tries to move them if they are in the wrong order.

Read the \_ISO\docs\E2B Utilities\MOVE_IMGPTN\ReadMe.txt file to see how to set it up and use it.
There is also a new page on the E2B website here.