Windows 10: DISM - Split install.wim file  

    DISM - Split install.wim file

    DISM - Split install.wim file

    How to split a custom install.wim file
    Published by Category: Installation & Upgrade
    30 Jan 2018
    Designer Media Ltd

    Published by


    Kari's Avatar
    PhD in Malt Based Liquids


    Location: A Finnish expat in Germany
    Posts: 13,972

    Show Printable Version 


    information   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.





    DISM - Split install.wim file Contents DISM - Split install.wim file
     Use links below to go to any step, back button of your browser to return to this list.


    Step One: Split WIM file
    Step Two: Prepare USB flash drive
    Step Three: Deploy (install) from SWM files





    DISM - Split install.wim file Step One DISM - Split install.wim file
     Split WIM file
    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 image for larger version. 

Name:	image.png 
Views:	139 
Size:	351.2 KB 
ID:	174639
    (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):
    Name:  image.png
Views: 1939
Size:  159.1 KB

    The first SWM file is named as install.swm, second part as install2.swm and so on.




    DISM - Split install.wim file Step Two DISM - Split install.wim file
     Prepare USB flash drive

    Note   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:
    Name:  image.png
Views: 1884
Size:  79.8 KB

    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, 500 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





    DISM - Split install.wim file Step Three DISM - Split install.wim file
     Deploy (install) from SWM files

    Note   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

    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
    Name:  image.png
Views: 1900
Size:  198.1 KB

    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
    Click image for larger version. 

Name:	image.png 
Views:	78 
Size:	201.2 KB 
ID:	174660

    Windows will restart and go through Windows Welcome (OOBE) to let you finalize Windows Setup.


    That's it!

    Kari
  1.    29 Jan 2018 #1

    Sooner or later MS are going to have to tackle the issue of install.wim being over 4GB. It will be interesting to see how they solve this.

    There is nothing really magical about a .wim file. In fact with modern flash drive capacity, there is no real need to put the files in a .wim file at all any more it seems to me.
      My ComputerSystem Spec

  2.    29 Jan 2018 #2

    Excellent tutorial. Everything is supported by MS.
      My ComputerSystem Spec


  3. Posts : 38,043
    Dual boot Windows 10 FCU Pro x 64 & current Insider 10 Pro
       29 Jan 2018 #3

    Again, great tutorial, Kari. Very clever as well. :)

    As a novice, I'm beginning to see what I thought was a cutting-edge industry isn't so cutting-edge anymore. FAT was originally designed in 1977 for use on floppy disks, then adapted throughout the industry. It may have been great for its day, but the newer formats like NTSF or others haven't been used because of silly little drivers? This would be like having to build log cabins because no one has developed a power saw.
      My ComputersSystem Spec


  4. Posts : 13,972
    Windows 10 Pro
    Thread Starter
       29 Jan 2018 #4

    Thanks geeks!
      My ComputerSystem Spec


  5. Posts : 13,972
    Windows 10 Pro
    Thread Starter
       29 Jan 2018 #5

    lx07 said: View Post
    You are however wrong saying UEFI doesn't require FAT. It does.
    What I said about this matter was that it is an artificial limitation. Quite the opposiste you claim me having said; I admitted that at the moment FAT is used and required but that the reason is artificial.

    I then quoted the author of Rufus, who on his GitHub page states the following:

    As an aside, and because there appears to exist a lot of innacurate information about this on the Internet, it needs to be stressed out that 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.

    However, as demonstrated in this project, it is very much possible to work around this limitation and enable any UEFI firmware to boot from non-FAT32 filesystems.
    Yes, FAT is required at the moment as per those specs. However, this is an artificial limitation, nothing in those specifications explicitly forces the use of it, therefore other file systems will be bootable, too, as long as correct drivers are present.

    Kari
    Last edited by Kari; 30 Jan 2018 at 06:22.
      My ComputerSystem Spec

  6.    30 Jan 2018 #6

    Hi all, @Kari, I believe there is another way to do this which is rather easier.

    The historical problem has been that windows would only recognise one partition on a standard recoverable flash drive, making it difficult to create a bootable partititionwith files greater than 4GB as you say earlier.

    This changed with the 1703 CU version where it would handle multiple partitions but you had to use diskpart commands to handle multiple partitions. With 1709 FCU version, it now handles multiple partitions from disk management.

    So method is basically very simple.

    1) Mount iso with large install.wim as a drive (say letter D)

    2) Create two partitions on usb flash drive as follows

    Partition 1 - fat32 formatted say 2GB (may be less but I used 2 GB) (say letter E)

    Partition 2 - NTFS formatted - rest of drive (must be large enough for INSTALL.WIM+ say 2GB) (say letter F)
    INSTALL.WIM can be as large as you like.

    3) Copy all of files/folders from D EXCEPT sources folder to E

    4) create sources folder on E and copy BOOT.WIM from sources folder on D to sources folder on E.

    5) copy all files from D to folder F (does not matter that files are on E as well).

    6) Reboot PC and it will boot from FAT32 partition but install files from NTFS partition.

    My PC will not boot from an NTFS partition, but I tried the above and it worked first time.

    Total time to create flash drive was less than five minutes.

    I have only tested this on a UEFI PC but it should work for legacy bios as well provided you make the first partition active I think.
    Last edited by cereberus; 30 Jan 2018 at 09:43.
      My ComputerSystem Spec

  7.    30 Jan 2018 #7

    Some Sandisk USB drives are recognized as a hard drive, which allows you to place multiple partitions on the USB drive. What I've done in the past is use diskpart to create two partitions on the Sandisk USB drive the first partition as a FAT32 and the second as a NTFS partition, which allows for larger file sizes. Install.wim just needs to be copied to the NTFS partition.

    MakeWinPEMedia will not wipe the NTFS partition. Since the Sandisk drive is recognized as a Hard drive physically there is not a Windows 10 version that is required. I've used Sandisk drives to apply windows 7 images as well.

    I hope I'm clear enough..
      My ComputerSystem Spec

  •    30 Jan 2018 #8

    Jerry06 said: View Post
    Some Sandisk USB drives are recognized as a hard drive, which allows you to place multiple partitions on the USB drive. What I've done in the past is use diskpart to create two partitions on the Sandisk USB drive the first partition as a FAT32 and the second as a NTFS partition, which allows for larger file sizes. Install.wim just needs to be copied to the NTFS partition.

    MakeWinPEMedia will not wipe the NTFS partition. Since the Sandisk drive is recognized as a Hard drive physically there is not a Windows 10 version that is required. I've used Sandisk drives to apply windows 7 images as well.

    I hope I'm clear enough..
    That was point of my previous post - you no longer need usb flash drives with the hard disk attribute set. Any flash drive with enough capacity will do it now.

    As I said, I installed Windows today setup like that. It does not matter what version you are installing, but you will need to turn off secure boot for Windows 7 afaik.
      My ComputerSystem Spec


  •  

    Tutorial Categories

    DISM - Split install.wim file 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 Xbox Windows Phone


    Related Threads
    Servicing an offline image, mounting an image, committing changes, it all sounds a bit complicated to an average Windows user. However, it's just geek speak meaning modifying default Windows install image, the install.wim file. It is a straight...
    I have a PC with 1tb hard drive. Currently am running windows 7 from it. I want to update to windows 10. I have tried windows media creation tool but it failed giving me some error. Is there anyway to install windows 10 from an iso by splitting my...
    ​I volunteer at a local community center. It has an Open Computer Lab for the public. It has An HP Server (Server 2012 R2). Itís a domain controller supporting Folder Redirection and Roaming Profiles 20 PCs (Windows 10 Pro v1511) but being...
    Solved DISM unable to locate Install.wim file in Performance & Maintenance
    Hi, Today, running sfc /scannow reported corrupted files it could not repair. I followed instructions here: https://www.tenforums.com/tutorials/7808-dism-repair-windows-10-image.html but I am unable to get DISM to find the Install.wim file even...
    I made a WIM for 14257 using the ESD to ISO tool trying to fix the DISM/Restorehealth issue. I cannot get it to work. First time ever I am running into a roadblock. Am I using the wrong path? I have the WIM file in a folder in Native C...
    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 05:15.
    Find Us