MakePartImage and the CSM Menu
- Advantages and disadvantages of using .imgPTN files
- MemTest86.imgPTN (ready-made)
- Quick Start - how to make .imgPTN files
- Introduction to .imgPTN files
- How to use MakePartImage.cmd
- MakePartImage user prompts
- How does E2B boot to .imgPTN files?
- Additional utilities
- Directly boot in UEFI mode with Clover
- Modify the CSM menu
- What does MakePartImage.cmd actually do?
Please note: Once you 'switch-in' a .imgPTN file, it will replace the E2B partition and the E2B files will 'disappear'.
You then will have a 'different' drive volume present. Any changes you make to the files will be permanent, just like any normal drive volume and those changes will still be there the next time you switch to the same .imgPTN file.
To restore the original E2B partition and E2B files, you should MBR-boot and select Item #0 from the CSM Menu, or you can run the Windows utility \e2b\SWITCH_E2B.exe and click on Restore E2B Partition(s).
Advantages of using .imgPTN files
- Can UEFI-boot (if payload supports it and use FAT32 .imgPTN) and MBR\CSM-boot
- Can run any number of Windows, linux or other UEFI software (e.g. MemTest86, KonBoot, etc.)
- Can run Windows installers from an E2B USB HDD (no removable flash drive required)
- Can run All-In-One Windows installs
- Best way to run multiple Hirens Boot CDs
- Can run .imgPTN files from any menu folder
- Can run Windows To Go
- Can run multiple fully installed linux installations
- Can run FreeBSD/PfSense/Hackintosh installers
- Can run WinBuilder/WinPE (and UEFI-boot if payload supports it)
- No UEFI-bootloader is used, so Secure Boot will work if the payload contains signed EFI boot files (unless rEFInd is added)
- If your USB drive has a write-protect switch, you can switch in a .imgPTN file first and then write-protect the drive before booting from it.
- If your E2B USB drive has a second partition, they can be temporarily removed or can remain as a valid partition.
- By adding rEFInd and a second WinPE partition image you can change to a different .imgPTN file on UEFI64 systems.
Disadvantages of using .imgPTN files
- Must boot to E2B Menu first (in MBR\CSM mode) - OR - run the Windows SWITCH_E2B.exe utility to 'switch-in' the new partition - OR - UEFI-boot to WinPE from the E2B drive (see 'Multi-UEFI').
Note: MemTest86.imgPTN is already included in recent E2B downloads (UTILITIES - MEMORY TEST menu) - try it to see how UEFI-booting works.
Quick Start Instructions - how to make .imgPTN files
If prompted, just hit [ENTER] to accept the default size (or if there is a size problem, increase the size until it fits).
Tip: If you use a file extension of .imgPTN23 then any second or third Primary partition on the E2B USB drive will NOT be removed when you switch in the new image file. This is useful if you wish to UEFI-boot and still have the files on a second partition of the E2B Hard Disk accessible. For instance, PortableApps or disk images can be kept on a second partition.
Note: If using a FAT32 .imgPTN file and there is a file larger than 4GB - see here for details on how to fix this.
When you run any .imgPTNxxxx file from the Easy2Boot menu, it removes the Easy2Boot partitions on the USB drive and replaces them with the .imgPTN partition.
.imgPTN files can also be used to boot Windows Install payloads in MBR\CSM mode from an E2B USB hard drive, but without needing the additional USB 'Helper' Removable Flash drive. For MBR\CSM booting the partition image file can be either FAT32 or NTFS.
N.B. Some buggy UEFI systems will not offer the user a MBR\CSM boot option if there are UEFI boot files present on the USB drive. This means that after changing to an .imgPTN file which contains EFI boot files, you may not be able to boot to the CSM Menu and restore the drive back to the E2B menu. For these systems, you must either MBR-boot on a different system, or use a Windows system to run \e2b\SWITCH_E2B.exe to restore the E2B partitions.
Tip: If some systems don't boot when in the CSM-mode (flashing cursor) then try a file extension of .imgPTN23. See FAQ
How to use MakePartImage
Recommended: If you are using Windows Vista\7\8, then you can automatically create Desktop shortcuts by double-clicking on the CreateDesktopShortcuts.cmd file.
About the MPI shortcuts: If you have spaces in the path for the 'Target' field, then we must use double-quotes for the part of the path after the drive letter - e.g.
cmd.exe /c F:\"temp\name with spaces\MakePartImage\MakePartImage.cmd"
This may seem 'wrong', but enlosing the whole path in double-quotes does not work!
If it fails to copy all the files, due to lack of space, run it again and increase the size of the image slightly, when prompted.
Note: When a folder is the source, make sure your .imgPTN file is not created in, or under, the same SOURCE folder or the operation will fail!
Tip: If 7Zip has problems unpacking the ISO files, try a different program (e.g. IsoBuster) and extract the contents of the ISO file to an empty folder. Then drag-and-drop the folder onto one of the MPI Desktop shortcuts.
Note: If your payload boots using syslinux/isolinux, you will need to choose which version of syslinux to install - hints are provided.
3. Once the .imgPTN image file is made, copy it to the \_ISO\MAINMENU folder of your E2B drive (or any other menu folder except \_ISO\WINDOWS or \_ISO\WINDOWS\XP).
Note: For other possible variants of .imgPTN file extensions, see here.
4. Run WinContig (\MAKE_THIS_DRIVE_CONTIGUOUS.cmd) on the E2B USB drive to ensure all the files are contiguous (or use RMPrepUSB - Ctrl+F2).
Windows Explorer is launched at the end of running MakePartImage.cmd so you can copy the image file to your E2B drive.
To prevent Explorer from being run, first type
MakePartImage.cmd (MPI) user prompts
- Source ISO or Folder - specify either a path to an ISO file (or zip/7z file) (e.g. C:\fred\debian.iso) OR a USB drive that you want to 'clone' (e.g. G:\) or a folder that contains a copy of the source files (e.g. C:\temp\ExtractedWin8\). Note that the path should always end in a backslash. Remember, you can type TAB
on the command line during typing, to make Windows complete the path or filename for you.
- Use FAT32 for the new image (N=NTFS) (A/[Y]/N) : - Type either FAT32 or NTFS or hit enter for the default which is indicated by the [square brackets] (Y=FAT32 is the default). If you are using a Windows ISO which has a file >4GB inside it, you must choose NTFS (but it won't UEFI boot) or split the install.wim into smaller files - see here for details.
- Size for Image file (MB), min=38 - e.g.  : - Enter the size that will be required for the partition image. Hit [Enter] for the suggested size (which is usually a tad generous). If the process fails due to insufficient space, run MPI again and increase the size.
- OUTPUT FILENAME for new Image (e.g. C:\temp\xxx.imgPTN) : - A DEFAULT path and name may be suggested - if so, just hit [Enter], otherwise type a valid path and filename. If the path contains spaces, enclose the whole path in double-quotes. Usually E2B will require a .imgPTN file extension.
- VOLUME NAME for partition [LIVE] : - MPI will use 'LIVE' as the default volume name OR if using a USB drive as the source, it will use the same Volume Name as the source USB drive. If the image is made from an XBOOT drive, use the Volume Name of XBOOT. Max = 11. Avoid using spaces. If the source is a folder, you will be prompted for a Volume name.
- EI.CFG - if a Windows install payload is detected, you may be asked if you want to delete or make an EI.cfg file. This can enable more choices as often Windows Install ISOs contain multiple versions. If you are unsure what to answer - just press [Enter].
Windows 8/10 ISOs usually do not contain an EI.CFG file - if you add one it will allow you to pick any version contained inside the ISO. It will also avoid you having to enter a Product Key and also allow you to use 'split wim' files (.swm files).
If your source is a Windows 7 ISO, it usually contains an EI.CFG file - by using a modified EI.CFG file, you will be able to choose any version inside the ISO.
- Which version of Syslinux shall I use (37,38,,5,6,N=None) : - Normally it is safe to use the suggested version. Some versions of linux may require Version 6 (tip: if you see a 'COM32R' error when booting from the CSM menu, then try '6' instead).
- Press a key to dismount - At this point you can inspect and change the contents of the ImDisk RAM drive volume (usually U:). Once you press a key, the volume will be dismounted and all contents saved to the image file.
- MENU.LST FOUND - OK to combine them ([Y]/R/N) : - If a menu.lst file is found, it indicates that the source payload is grub4dos bootable. As MPI installs it's own menu.lst file there is a problem! Normally the safest thing to do is combine the two menus, however you may find that some of the menu entries are redundant or don't work. If the main CSM 'Boot from this drive' entry works, then re-make the .imgPTN file and answer R for Replace. You are strongly advised to NOT answer N because unless you use the MPI CSM menu.lst, you will not be able to easily restore the E2B drive partitions after switching to the .imgPTN partition (but see the RestoreE2B utility below). Unless the menu contains the correct commands, E2B will refuse to run the .imgPTN file.
- Title of the CSM menu : - If you did not use an ISO file as the source, then we need to know what the payload actually is, so we can display the name at the top of the CSM menu. You can edit this heading in the menu.lst file once the image is made.
- INFORMATION: xxx occurs in the .YYY files - AUTO-CORRECT these? ([Y]/N) : - If syslinux, grub, EFI config files or isolinux files have been detected (.cfg, .lst or .conf) then MPI can attempt to do 'fixups' on these so that it matches the Volume Label of the partition and the UUID of the partition, as well as change the parameters for USB booting rather than CDROM booting. Normally, just hit [Enter] to change all these automatically. For a Hirens ISO, you may need to answer No to ensure any linux files still boot.
Tip: To see what it finds and what it changes them to, type set NOISY=1 at the command console before you run MPI.
- WARNING: Cannot dismount volume U: - This is quite common/normal on some systems if you have Explorer windows open, hit [Enter] and another attempt will be made to dismount the ramdrive.
- A Windows Explorer window will open if the image file was made successfully. If there was a problem the console background will change to a red colour and the ImDisk Manager Control Panel application may appear so that you can 'Remove' any ramdisk drive that is 'stuck'.
How does E2B boot to .imgPTN files?
Note that you can also boot directly to UEFI boot files by using the Clover menu entry (3). The payload's efi boot files that are present in the image, are listed in the INFORMATION: lines under the menu.
The opposite to RestoreE2B is RestoreCSM which will restore the original .imgPTN partition that was saved when you ran RestoreE2B from your booted Windows environment. To use RestoreCSM, you will need to copy the whole e2b folder to your OS system drive first, because as soon as you run RestoreE2B, the USB partition which has the e2b folder on it will disappear! Once you run RestoreCSM you will need to unplug and re-connect the USB drive for the change to be seen by the booted Windows/WinPE environment. Only use RestoreCSM on the same drive that you ran RestoreE2B on.
If you want to skip the conversion of any ISO files, type A for Abort at the FAT32/NTFS prompt. (only valid if you typed N to the AUTO-RUN option).
Directly boot in UEFI Mode with Clover
Modifying the CSM Menu using the CUSTOM folder
What does MakePartImage actually do?
The image file made by MakePartImage is an image of a whole partition starting at the Partition Boot Record.
MakePartImage can use either a folder, whole drive or ISO file (or .zip file) as the payload source.
If you have a working source USB Flash drive that contains a single partition, MakePartImage will create a new partition image from it, but the partition can be of any size.
For example, if a 32GB USB Flash drive contains only 2GB of files, you can make a 2GB .imgPTN file from it, instead of having to make a 32GB image of the whole USB partition.
This is what MakePartImage.cmd does...
Creates a virtual RAM drive with a .imgPTN 'backing file' of the size and name that you specified, using ImDisk
Formats the new virtual RAM drive (as NTFS or FAT32)
Copies the source files to the RAM drive (if a file is specified, then it extracts the files from it, e.g. .zip or .iso or .7z)
Copies over some grub4dos files that are required for the CSM Menu, from the .\csm folder (and then copies all files from the CUSTOM folder)
If isolinux or syslinux is detected in the source, then syslinux is installed to the PBR of the virtual RAM drive so that the image will boot to syslinux in BIOS mode. Also it will copy or rename the isolinux folder and rename isolinux.cfg to syslinux.cfg. Note: extra image space may be needed for this, so you may need to specify a larger size for the RAM drive. Possible syslinux versions are 4, 5 or 6. Version 4 will be used by default unless you run MakePartImage without using the MPI_FAT32 or MPI_NTFS shortcuts, in which case you will be prompted to choose a version.
Sets a Volume Label for the RAM drive. This can be specified by the user, or changed before dismounting the RAM drive.
Warns the user about UUID=, LABEL= and other strings in .cfg, .conf and .lst files and will auto-convert these for you (useful for linux ISOs - in some exceptional cases you may need to edit these files before dismounting the image). Unlike other multiboot utilities such as YUMI or XBoot, MPI does not need to recognise what distro it is, it just corrects any grub2/isolinux/syslinux parameter values into the correct values for use with a USB drive.
Dismounts the RAM drive and saves the contents to the .imgPTN file and launches an Explorer window to display the folder where the new image file resides.
The menu.lst file that is copied over is the grub4dos CSM menu that allows you to restore the original E2B MBR. Without this, the drive would always be seen as a single partition containing only the files in the .imgPTN image file. If a menu.lst file also exists in the source, it will ask you if you wish to combine them and then you can edit the \menu.lst file in the mounted RAM drive before you dismount and save the image.
Once the .imgPTN file is made, the user can mount the image .imgPTN file using ImDisk and then edit and re-save it by unmounting it.
Alternatively, you can boot to E2B and select the .imgPTN file, in order to switch the drive to the desired disk image (you can use VBox+DavidB's VMUB utility for this or a real system). Unplug and re-plug the E2B drive. The new image contents will be visible to Windows. Now you can edit the files on the USB drive. Any changes will directly affect the .imgPTN file.
If your E2B drive is 'stuck' with the single partition image installed, and you cannot boot to the CSM menu and get back to the E2B Main menu, run the 'RestoreE2B' script from a Windows system (see the 'Additional Utilities' section above) or from the RestoreE2B.cmd file in the \e2b folder on the USB drive.
You can instead run the Windows SWITCH_E2B.exe utility (E2B v1.73+ and MPI v0.055+).
A backup of the E2B MBR can be found in \e2b\MBR.BIN which can be used to restore the original E2B partitions if RestoreE2B.cmd does not work (e.g. using dd in linux or RMPrepUSB - File>Drive or BootIce). SWITCH_E2B.exe will use the MBR.BIN file if it cannot find another MBR backup sector.