20 Feb 2019 - by 'Maurits van der Schee'
Running Windows 10 is not that bad these days (I am a Linux user). It is a fast and stable operating system. Unfortunately it comes bundled with a lot of software that you do NOT want. To remove this unwanted software it is recommended to do a "clean install" of Windows 10. While doing this you may run into the problem that you can't copy the "install.wim" file, because it is larger than 4Gb. This post has a solution to that problem.
When I get a new PC (like my awesome passive cooled Acer Swift 1 laptop) I like to do a clean Windows 10 install. This removes the manufacturers bundled software. Since this laptop supports secure UEFI boot it should be as easy as initializing a USB drive with a "GPT partition table" and creating a FAT32 partition with the contents of the installation ISO (you can just copy the files). In UEFI boot there is no need for changes to the "Master Boot Record" or for a "boot flag" on the partition.
Note that a clean install also removes the bundled drivers from your system. This may prove cumbersome when the latest version of Windows does not support your Wifi or Ethernet port (you may need to transfer them using an USB stick).
In order to be able to write an ISO to a FAT32 partition there may be no file bigger than 4 gigabyte. This is a problem, as in the latest Windows 10 the "sources/install.wim" file is 4.4 Gb in size. We can work around this problem by re-compressing this file with a stronger compression (for which decompression is supported by the Windows 10 installer). The compression options and there compression factors are described on wimlib.net. We are going to use "solid" as this is the best compression available.
You can download the official Windows 10 ISO image from Microsoft by visiting:
But you must be on Linux (or pretend to be, using a "user-agent switcher") to download the file.
In Ubuntu you can just right click any ISO image and "unpack" it to a folder. Find the "sources" folder in the unpacked ISO, enter it and right-click and choose "Open Terminal Here". In this terminal you need to run one command:
wimlib-imagex optimize install.wim --solid
If you have not got this tool yet you may have to install WimLib tools first:
sudo apt install wimtools
On my machine this was the output (I ran it with "time" so that you can see how long it took):
$ time wimlib-imagex optimize install.wim --solid "install.wim" original size: 4253057 KiB Using LZMS compression with 4 threads Archiving file data: 9344 MiB of 9344 MiB (100%) done "install.wim" optimized size: 3175915 KiB Space saved: 1077141 KiB real 36m26,364s user 127m4,804s sys 0m10,063s
After waiting more than half an hour my files were ready to be copied onto the FAT32 partition of my USB drive (that has a GPT partition table). Next I rebooted, chose the USB drive in the Boot menu and the Windows 10 installation started (without the need to disable "secure boot").
On Windows you can use the "DISM.exe" tool to re-compress the "install.wim" file. Right-click the "Command Prompt" in the "Start Menu" and choose "Run as Administrator" and then use the "cd" command to change to the directory where your ISO contents are copied. You should rename the original "install.wim" to "install.wim.org" first. Then you can re-compress "install.wim.org" to "install.wim" using:
dism /export-image /sourceimagefile:install.wim.org /sourceindex:1 /destinationimagefile:install.wim /compress:recovery
After successful re-compression you may remove the "install.wim.org" file. Note that "recovery" is the name in DISM for the "solid" compression level in WimLib.
There is an alternative multi-partition method that does not require UEFI NTFS drivers (source). It removes the time consuming step of re-compressing and also supports secure boot. It requires you to create both a FAT32 and a NTFS partition and have a GPT partition table. On the FAT32 partition you need to copy everything but the contents of the "sources" folder (do create an empty "sources" folder). Also copy all the contents of the ISO to the NTFS partition. In the "sources" folder on the NTFS partition you need to add a new file named "ei.cfg" with the following contents:
The Windows installation will start on the FAT32 partition, but when encountering the empty "sources" folder it will look for the "sources/ei.cfg" file on the NTFS partition and continue the installation without any prompts.
After doing this you can uninstall everything on the start menu and from "add or remove programs" that Microsoft allows you to uninstall. No worries, it won't allow you to uninstall things that are needed for normal operation of the operating system. In the Windows 10 October 2018 release you can even uninstall OneDrive!