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

Page 1 of 2 12 LastLast
    Create bootable USB installer if install.wim is greater than 4GB

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

    Published by Category: Installation & Upgrade
    31 Oct 2018
    Designer Media Ltd

    information   Information

    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


    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)

    4) copy custom install.wim to folder c:\usbcreate

    5) create batch file called usbcreate.bat containing following text

    cd \usbcreate
    rd "baseiso" /s /q
    md "baseiso"
    xcopy E:\*.* "c:\usbcreate\baseiso\" /s /y
    diskpart /s "c:\usbcreate\diskpart.dat"
    label Q:USB-FAT32
    label R:USB-NTFS
    xcopy "c:\usbcreate\install.wim" "c:\usbcreate\baseiso\sources\"  /y
    xcopy "c:\usbcreate\ei.cfg" "c:\usbcreate\baseiso\sources\"  /y
    xcopy "c:\usbcreate\baseiso\*.*" R:\ /s /y
    rd "c:\usbcreate\baseiso\sources\" /s /q
    md "c:\usbcreate\baseiso\sources\"
    xcopy "c:\usbcreate\baseiso\*.*" Q:\ /s /y /e
    xcopy "E:\sources\boot.wim" "Q:\sources\" /y

    6) Identify disk number for use in diskpart script

    Insert flash drive and open admin command prompt and type


    list disk

    and note drive number of usb flash drive.

    7) Create a text file called diskpart.dat containing following text changing # as appropriate (do not copy lines in brackets). Save file in folder usbcreate.

    (Replace # with drive number of usb flash drive obtained from Step 6)
    select disk #
    (Warning: Drive gets wiped, so be sure you have selected correct drive)
    convert mbr
    create partition primary size=1000
    create partition primary
    select partition 1
    format fs=fat32 quick
    assign letter=Q
    select partition 2
    format fs=ntfs quick
    assign letter=R

    8) Right click usbcreate.bat and run with admin rights.

  1.    #1

    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 ComputerSystem Spec

  2.    #2

    alphanumeric said: View Post
    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 ComputerSystem Spec

  3.    #3

    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 ComputerSystem Spec

  4. Posts : 33
    Windows 10 Pro for Workstations

    SELECT DISK $($Disk.Number)
    CONVERT $($PartitionType)
    "@ | & "$Env:SystemRoot\System32\DiskPart.exe" | Out-Null
    $Disk = Get-Disk -Number $Disk.Number
    $BootPartition = ($Disk | Get-Partition).AccessPaths[0]
    $OSPartition = ($Disk | Get-Partition).AccessPaths[2]
    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 ComputersSystem Spec

  5.    #5

    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 ComputerSystem Spec

  6. Kari's Avatar
    Posts : 15,628
    Windows 10 Pro

    hsehestedt said: View Post
    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 answered the same question posted by another member in another thread a few days ago.

    Kari said: View Post
    emmapeel6490 said: View Post
    Thank you for your quick answer.
    I tried the one (Create bootable USB installer if install.wim is greater than 4GB) but what I quit don't understand is, which file goes where?
    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.

    When USB is created, copy your answer file autounattend.xml to USB partition labelled USB-FAT32.

    If you have any issues with getting the USB created as instructed, post your questions on that tutorial thread.
    Notice that you do not need the ei.cfg file when using autounattend.xml, you can skip step 2 in this tutorial and remove line 10 from batch file in step 5.

      My ComputerSystem Spec

  7.    #7

    Thanks, Kari. Much appreciated.
      My ComputerSystem Spec

  8.    #8

    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.

    @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 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)
    echo You have not run this file as Administrator. Please
    echo re-run it as an Administrator.
    goto END
    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.
    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 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\.
    set /p SourcePath="Enter source path (with a \ at the end): "
    echo Below are all the disks seen by your system. Note the Disk ID for the disk you
    echo want to write to.
    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 list disk
    echo exit
    ) | diskpart
    set /p DiskID="Enter the DiskID for the DESTINATION disk to write to: "
    echo You have specified the following path for the source files: %SourcePath%
    echo You have specified the following drive number to make bootable: %DiskID%
    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 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:.
    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
    echo We're all done. Press any key to exit.
      My ComputerSystem Spec

  9.    #9

    First I would like to say Thank you !!!! Again Thank you.

    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 ComputerSystem Spec

Page 1 of 2 12 LastLast

Tutorial Categories

Create bootable USB installer if install.wim is greater than 4GB Tutorial Index Network & Sharing Instalation and Upgrade Browsers and Email General Tips Gaming Customization Apps and Features Virtualization BSOD System Security User Accounts Hardware and Drivers Updates and Activation Backup and Restore Performance and Maintenance Mixed Reality Phone

Related Threads
Installation & Upgrade Create Bootable USB Flash Drive to Install Windows 10 in Tutorials
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...
Here's an alternative in addition to Kari's Tutorial: ESD to ISO - Create Bootable ISO from Windows 10 ESD File - Windows 10 Forums NOTE: It is better to create an ISO contaning install.wim so if you...

Tags for this Thread

Our Sites
Site Links
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.

© Designer Media Ltd
All times are GMT -5. The time now is 10:44.
Find Us