
Information
Overall, Windows image size (the size of install.wim file) is growing version by version. In fact, it is slowly approaching the magical 4 GB file size limit for a FAT32 formatted USB flash drive. Especially if you customize Windows image, it could easily be larger than that.
Interestingly, the restriction that we must still use FAT32 formatted USBs to install Windows on UEFI based computers is purely artificial or arbitrary:
There is absolutely nothing in the UEFI specifications that actually forces the use of FAT32 for UEFI boot. On the contrary, UEFI will happily boot from ANY file system, as long as your firmware has a driver for it. As such, it is only the choice of system manufacturers, who tend to only include a driver for FAT32, that limits the default boot capabilities of UEFI, and that leads many to erroneously believe that only FAT32 can be used for UEFI boot.
(Source:
GitHub - pbatard/uefi-ntfs: UEFI:NTFS - Boot NTFS partitions from UEFI)
My custom Windows images are 10 GB+, depending on what software I pre-install before capturing the deployment / install image. To get them onto a USB flash drive without using any third-party tools, I must split the install.wim file into pieces, to stay beneath the 4 GB limit.
In this tutorial I show how to split Windows image files larger than 4GB into smaller SWM (Split Wim) files so as to copy them to a USB flash drive, and how to deploy (install) Windows using such SWM files.
Contents
Use links below to go to any step, back button of your browser to return to this list.
1.1) In below screenshot you can see that my custom
install.wim file is about 12 GB (#1). Trying to copy it to USB flash drive I: gives an error because file exceeds the maximum allowed size for a FAT32 formatted device(#2):

(Click screenshot to enlarge.)
1.2) To get the install.wim onto a USB flash drive, I need to split it to smaller SWM files using the following command (#3 in above screenshot:
Dism /Split-Image /ImageFile:"H:\Deployment Image\install.wim" /SWMFile:"H:\Deployment Image\install.swm" /FileSize:4000
Notice that as the path to my image file contains spaces, it must be given in quotes. Maximum size for an SWM file is 4,700 MB which although a practical size if I would store the split image on single layer DVDs is still too big for FAT32 formatted USB. I wanted to be sure that split image can be copied to USB, giving size for split SWM files as 4,000 MB.
1.3) When done, I have the original huge install.wim file (yellow highlight) and the same image in split SWM files (blue highlight):

The first SWM file is named as install.swm, second part as install2.swm and so on.
Step Two
Prepare USB flash drive

Note
You can of course create a bootable FAT32 formatted USB flash drive using your preferred method. I always use bootable WinPE USB flash drives for deployment, but creating one is only my recommendation, not obligatory.
2.1) Create a WinPE USB drive as told in this tutorial:
Create WinPE or ISO Installation Upgrade Tutorials
2.2) Create a new folder on WinPE USB, name it as you wish. In my case now I named it as
ImageFiles. Copy the SWM files to this folder:
2.3) Copy & paste following
DISKPART script in Notepad. Save it on root of WinPE USB as
GPTConfig.txt:
Code:
rem DISKPART script for single Windows partition
rem OS: Windows 10 (any version & edition)
rem ---------------------------------------------------
rem Select Disk, wipe it empty, convert to GPT
rem
select disk 0
clean
convert gpt
rem
rem ---------------------------------------------------
rem Create & format 100 MB EFI System partition
rem
create partition efi size=100
format quick fs=fat32 label="System"
rem
rem ---------------------------------------------------
rem Create 16 MB MSR partition (will not be formatted)
rem
create partition msr size=16
rem
rem ---------------------------------------------------
rem Create OS partition using all available space,
rem shrink it with 450 MB to leave space at end of HDD
rem for WinRE partition
rem
create partition primary
shrink minimum=450
rem
rem ---------------------------------------------------
rem Format OS partition, label it, assign drive letter
rem W. Windows Setup will change this drive letter to C
rem when installed. It's important now to use a not
rem reserved letter, therefore we use a letter from
rem end of alphabet
rem
format quick fs=ntfs label="Windows 10"
assign letter="W"
rem
rem ---------------------------------------------------
rem Create & format WinRE recovery partition at the
rem end of the disk. Not defining the size, it will use
rem all available space, 450 MB that we shrunk OS
rem partition with. Notice that ID and GPT attributes
rem must be set exactly as shown!
rem
create partition primary
format quick fs=ntfs label="WinRE"
set id="de94bba4-06d1-4d40-a16a-bfd50179d6ac"
gpt attributes=0x8000000000000001
rem
rem ---------------------------------------------------
rem Exit Diskpart
rem
exit
The above script partitions a GPT disk to be used on UEFI based machines creating system partitions and one large Windows partition using all available space on disk. To modify script for multiple partition setups, see this tutorial:
DISKPART - How to Partition GPT disk Installation Upgrade Tutorials
I am also happy to help you if you need help with modifying script for multiple partitions and / or disks. Just post your partitioning plan, we'll make a script for you!
Same script modified to partition an MBR disk on BIOS based machines. Save it as
MBRConfig.txt on WinPE USB:
Code:
rem DISKPART script for single Windows partition
rem OS: Windows 10 (any version & edition)
rem ---------------------------------------------------
rem Select Disk 0, wipe it empty, convert to MBR
rem
select disk 0
clean
convert mbr
rem
rem ---------------------------------------------------
rem Create & format 500 MB System Reserved
rem partition, mark it Active
rem
create partition primary size=500
format quick fs=ntfs label="System"
assign letter="S"
active
rem
rem ---------------------------------------------------
rem Create OS partition using all available space,
rem shrink it with 450 MB to leave space at end of HDD
rem for WinRE partition
rem
create partition primary
shrink minimum=450
rem
rem ---------------------------------------------------
rem Format OS partition, label it, assign drive letter
rem W. Windows Setup will change this drive letter to C
rem when installed. It's important now to use a not
rem reserved letter, therefore we use a letter from
rem end of alphabet
rem
format quick fs=ntfs label="Windows 10"
assign letter="W"
rem
rem ---------------------------------------------------
rem Create & format WinRE recovery partition at the
rem end of the disk. Not defining the size, it will use
rem all available space, 450 MB that we shrunk OS
rem partition with. Notice that ID must be set exactly
rem as shown!
rem
create partition primary
format quick fs=ntfs label="WinRE"
set id=27
rem
rem ---------------------------------------------------
rem Exit Diskpart
rem
exit
Step Three
Deploy (install) from SWM files

Note
Windows Setup cannot be run from split WIM. Therefore we need to partition and prepare the disk with DISKPART, and then apply Windows image with DISM, and finally create boot records to make hard disk bootable.
3.1) Boot the PC from your new WinPE disk
3.2) Enter command
diskpart
(#1 in next screenshot)
3.3) Enter command
list vol
(#2) to check the drive letter of your WinPE USB drive (#3). It will in most cases be drive C: when booted from WinPE on device with non-partitioned disk.
3.4) Enter command
exit
(#4) to quit DISKPART
3.5) Partition and prepare hard disk running the DISKPART script with following command (#5):
diskpart /s C:\GPTConfig.txt
The
/s switch tells system you want to run a DISKPART script. Change path to script according your actual WinPE drive letter and script name. Notice that a DISKPART script must have extension
.txt
3.6) Deploy Windows from SWM files with following command (#1 in next screenshot):
Dism /apply-image /imagefile:c:\ImageFiles\install.swm /swmfile:c:\ImageFiles\install*.swm /index:1 /applydir:W:\
Change the path for
/imagefile and
/swmfile switches according your actual one. As I had the SWM files stored on USB in folder
ImageFiles, my path is
C:\ImageFiles.
Switch
/imagefile tells DISM where to find the first SWM file,
install.swm, and
/swmfile where to find parts 2, 3 and so on. Because I had all SWM files in same folder, both paths are the same. Windows image will be applied to drive
W: because W: is the chosen drive letter we used in DISKPART script. Windows setup will automatically change this to letter
C: when we restart PC after deployment.
3.7) Last thing to do is to add boot records for Windows on drive W: using the following command (#2):
GPT disk / UEFI system:
bcdboot W:\Windows
MBR disk / BIOS system:
bcdboot W:\Windows /s S:
Notice that the above command only works as such if you have booted with properly made WinPE USB drive as told in steps 2.1 though 2.6. Using a normal bootable USB you must enter the command as follows:
GPT disk / UEFI system:
W:\Windows\System32\bcdboot W:\Windows
MBR disk / BIOS system:
W:\Windows\System32\bcdboot W:\Windows /s S:
3.8) All done! Unplug the USB drive and restart PC with following command (#3):
W:\Windows\System32\shutdown -r -t 0
Windows will restart and go through Windows Welcome (OOBE) to let you finalize Windows Setup.
That's it!
Kari