Create bootable USB installer if install.wim is greater than 4GB

Create bootable USB installer if install.wim is greater than 4GB

As discussed in tutorial DISM - Split install.wim file | Windows 10 Tutorials, it is not possible to create a bootable flash drive in fat32 format if the install.wim file is over 4GB in size. That tutorial presents a method to split the install.wim into smaller sub-files.

However, since Windows 10 1703, it is now possible to create a flash drive with multiple partitions which leads to an alternative solution.

Basically, two partitions are created i.e. a small (say 1GB) fat32 partition and a larger NTFS partition. The files from a standard installation iso are copied to the NTFS partition, and the standard install.wim file is replaced with the custom install.wim.

Similarly, all the files from the standard ISO image are copied to the fat32 partition except the files from the sources folder where only the boot.wim file is copied.

This guide does not supersede method in above tutorial but is an alternative method if using windows 10 1703 onwards

Here is a batch file that automates the copying process.

Here's How

You need at least an 8GB flash drive or larger depending on size of install.wim

1) Create folder on C drive called usbcreate (change drive and folder as you wish)

2) Create text file called ei.cfg with just two lines

[CHANNEL]Retail

and save in folder c:\usbcreate

3) mount base iso as a drive and note Drive letter (It is assumed to be E: for this example)

Just recently ran into this with MY Visual Studio Subscription ISO's. Can't remember if it was the Business or Consumer, might have been both? I just switched tactics and formatted my thumb drives in NTFS via diskpart. Good info though for those that need Fat 32 for UEFI installs. My laptop is fine with NTFS for UEFI so no big deal for me. And my two desktop PC's are legacy BIOS. It will just be mu Wife's Acer laptop that may be an issue. I'll just use a MCT created thumb drive on it if need be.

My ComputerYou need to have JavaScript enabled so that you can use this ...

Just recently ran into this with MY Visual Studio Subscription ISO's. Can't remember if it was the Business or Consumer, might have been both? I just switched tactics and formatted my thumb drives in NTFS via diskpart. Good info though for those that need Fat 32 for UEFI installs. My laptop is fine with NTFS for UEFI so no big deal for me. And my two desktop PC's are legacy BIOS. It will just be mu Wife's Acer laptop that may be an issue. I'll just use a MCT created thumb drive on it if need be.

Yeah - majority of devices do not boot in UEFI from NTFS regrettably.

I just created the above batch file to do all the hard work. The reason I had to do this as I need to inject custom drivers into install.wim, or else pc does not clean install (the ubiquitous spinning circles), and this forced my install.wim to be nearly 5GB.

My ComputerYou need to have JavaScript enabled so that you can use this ...

At one time I had a custom install thumb drive for each PC. I added the OEM logo's and some extra system page info via $OEM$ folder. These days I just can't be bothered. I still have 3 different drives though, one 32 / 64 bit MCT created drive, one with my MSDN x64 Business and one with my MSDN x64 Consumer. Overkill, but I like to test each one seperatly when I can. Lets me clean install Enterprise if I want too, to. At some point My Visual Studio subscription is going to time out and I'll be left with just the MCT.

My ComputerYou need to have JavaScript enabled so that you can use this ...

This works perfectly fine if you're hellbent on using the DiskPart method. I simply assigned labels for the $BootPart and $OSPart variables. The FAT32 partition contained the EFI files and the NTFS partition contained the full OS. There's zero need for any of those other steps in the original post.

Likewise you can do this using disk objects with PowerShell, too. Circumventing the 32GB FAT32 limit PowerShell enforces is not hard.

My ComputersYou need to have JavaScript enabled so that you can use this ...

I really like this method because it requires no third-party utilities like Rufus.

I do have a few questions:

How is it that this works? We are not modifying anything to tell Windows where to find the install.wim. When the boot starts from the FAT32 partitition, does Windows simply search for the install.wim on other partitions?

Also, is it strictly necessary that a duplicate of all the Windows installation files be present on the NTFS partition or is all that is strictly needed there the \sources directory?

Finally, is there any other documentation available where I can read more about this? Maybe I'm simply not searching on the right thing but I simply can't seem to find anything more about this.

Also, I'd simply do some testing to answer the first 2 questions myself, but I simply don't have a physical machine to test this on available for the moment. I have to backup all my data from those systems first .

Edit: I had one more question: If I'm going to perform an unattended install, do I need to place the autounattend.xml on the FAT32 partition, the NTFS partition, or both? I'm sure I could put it on both just to cover all bases but I'm trying to understand the process as best as I can to determine where it might actually access the file from.

My ComputerYou need to have JavaScript enabled so that you can use this ...

Just follow the instructions in that tutorial. In its step 4 you will copy your custom install.wim file to folder you created in its step 1. Following the tutorial, USB will be created automatically, you do not have to think where the files go.

Just for grins, I started playing with this batch file. I made the following additions / changes / modifications and thought I would just share it in case anyone was interested.

IMPORTANT: Use with caution. I have not implemented error checking yet, but this has been working geat for me.

Changes made:

1) Added code to verify that batch file is being run elevated. Abort if it is not.

2) Modified diskpart handling so that no external script file is needed. The batch file is the only thing needed.

3) Replaced xcopy and md commands with robocopy because I like how it shows progress. That's especially nice when copying a large INSTALL.WIM to a slowe flash drive.

4) Prompt user for location of source files and destination disk ID so that you don't ever have to modify the batch file.

5) Allow the batch file to automatically create the ei.cfg file in the sources folder on the NTFS partition. No need to have an external copy of the file any longer.

6) Typically, the only files you may need to replace on the flash drive are the AUTOUNATTEND.XML on the FAT32 partition and the INSTALL.WIM on the NTFS partition. As a result I'm hiding ALL files on both partitions except those files just to keep down on the clutter when viewing the files on the flash drive. If you want to change this, simply comment out or remove the "attrib" lines at the very end of the batch file.

Note: If you prefer to hide the progress of the file copy operations, simply add /ndl /nfl to the end of each robocopy line.

Code:

@echo off
REM Note: Code to check if this batch file is being run elevated was found
REM on the Internet. I wish I could credit the author but I've long ago
REM lost reference to where I found it.
REM
REM Check to see if this batch file is being run as Administrator
REM Try to write a zero-byte file to a system directory
REM if successful, we are in Elevated mode and delete the file
REM if unsuccessful, avoid the "Access is denied" message
REM arbitrary choice of system directory and filename
set tst="%windir%\$del_me$"
REM the first brackets are required to avoid getting the message,
REM even though 2 is redirected to nul. no, I don't know why.
(type nul>%tst%) 2>nul && (del %tst% & set elev=t) || (set elev=)
if not defined elev (goto NotAdmin) else (goto IsAdmin)
:NotAdmin
cls
echo You have not run this file as Administrator. Please
echo re-run it as an Administrator.
echo.
pause
goto END
:IsAdmin
REM End Routine to check if being run as Admin
REM Change to the directory from where this batch file is being run.
REM This may not be strictly necessary in this batch file, but i like
REM to have it in place for possible future additions in functionality
REM to this batch file.
cd /d %~dp0
REM Ask user for location of mounted ISO image or the directory containing
REM the Windows files.
cls
echo This batch file will create a bootable flash drive from a mounted Windows ISO image or an
echo image extracted on disk. You will be asked for the path to the Windows files and the disk
echo ID of the destination. If you are using an ISO image, mount it before you continue. If
echo you are using a customized INSTALL.WIM, replace the standard Windows INSTALL.WIM with
echo that file before continuing. If you are using an AUTOUNATTEND.XML answer file, place it in
echo the root of the folder with the Windows files before you continue.
echo.
echo Enter the full path of the SOURCE below and be certain to end the path with a \
echos (backslash) at the end. Valid examples: F:\ or C:\ISO_Files\.
echo.
set /p SourcePath="Enter source path (with a \ at the end): "
cls
echo Below are all the disks seen by your system. Note the Disk ID for the disk you
echo want to write to.
echo.
echo CAUTION: MAKE SURE that you specify the correct drive number because we will
echo completely erase that drive! You can press CTRL-C if you want to abort.
echo.
(echo list disk
echo exit
) | diskpart
echo.
set /p DiskID="Enter the DiskID for the DESTINATION disk to write to: "
cls
echo You have specified the following path for the source files: %SourcePath%
echo.
echo You have specified the following drive number to make bootable: %DiskID%
echo.
pause
REM
REM Consider adding some error checking here in the future to verify that a
REM valid source path was specified and that a valid destination disk was
REM specified.
REM
REM We are creating 2 partions. A FAT32 partition (Q:) and an NTFS
REM partition (R:). We only need the sources folder on R:. On Q:
REM we want everything else. We also want the single file called
REM BOOT.WIM in the sources folder on Q:.
cls
echo We are partitioning the destination drive and copying files.
echo Be patient. This may take a while.
(echo select disk %DiskID%
echo clean
echo convert mbr
echo create partition primary size=1000
echo create partition primary
echo select partition 1
echo format fs=fat32 quick
echo rescan
echo assign letter=Q
echo active
echo select partition 2
echo format fs=ntfs quick
echo assign letter=R
echo rescan
echo exit
) | diskpart > nul
REM Set volume labels on the two partitions that we just created.
label Q:USB-FAT32
label R:USB-NTFS
REM Some flash drives present themselves as a fixed disk and as a result they my have a recyle bin
REM folder on them. We are excluding the system folders which includes the recycle bin from the
REM following operation. The /njh and /njs switches prevent robocopy from displaying the header and
REM summary information. If you want to stop robocopy from displaying file copy progress just add
REM a /ndl /nfl (No Directory Listing and No File Listing) to each robocopy command.
REM For reasons unknown to me, sometimes a path enclosed in quotes does not work in robocopy unless you
REM add a trailing space. In the below commands I found this to be true only on the first robocopy
REM command but I've added the space to all commands for consistency. We need the quotes just in case
REM a path with spaces in the name is specified.
robocopy "%SourcePath% " q:\ /mir /xd sources "system volume information" $recycle.bin /njh /njs
robocopy "%SourcePath%sources " q:\sources boot.wim /njh /njs
robocopy "%SourcePath%sources " r:\sources /mir /njh /njs
REM Create the ei.cfg file. Technically, this file is only needed if you are NOT using an
REM AUTOUNATTEND.XML answer file, but it won't hurt to have it there anyway.
echo [CHANNEL] > r:\sources\ei.cfg
echo Retail >> r:\sources\ei.cfg
REM Hide ALL files on both partitions with the exception of the following files:
REM 1) AUTOUNATTEND.XML on the FAT32 partition.
REM 2) \sources\INSTALL.WIM on the NTFS partition.
attrib q:\*.* +s +h /s /d > nul
attrib q:\autounattend.xml -h -s > nul
attrib r:\sources\*.* +s +h /s /d > nul
attrib r:\sources\install.wim -s -h > nul
cls
echo We're all done. Press any key to exit.
pause
:END

My ComputerYou need to have JavaScript enabled so that you can use this ...

Question: Should I remove the "install.esd" file in the base iso before or after execution of the procedure. Its currently running an I am thinking the final usb image might contain the .esd and .wim file.

My ComputerYou need to have JavaScript enabled so that you can use this ...

How to Create Bootable USB Flash Drive to Install Windows 10 from
This tutorial will show you how to create a bootable USB flash drive that can be used to install Windows 10 with or without UEFI.
CONTENTS:
Option One: Use Media Creation...

Hello! I've been messing with my laptop for hours now and still doesn't work so here's my problem...
I have new m.2 SSD which I will use to replace my existing SSD on my laptop. Now I want to install an image of my OS on my new SSD but my problem...

I've asked about this a long time ago. Several personal issue interfered with me getting computer work done. Now I'm starting a telecommuting job in a week, need to clean things up a bit. Just in case I have issues, I'd like to burn off a bootable...

I have been trying to create a USB installation drive. I have the Windows10 .iso image. I have created a recovery USB drive but it doesn't allow me to access the image just the advanced options. I want to be able to do a clean install of Windows...

About Us
Windows 10 Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows 10" and related materials are trademarks of Microsoft Corp.