Return to the main diy page


Create a Windows install drive

These instructions can help you create a USB pendrive, that can install Windows from an iso file, which contains a file that exceeds the 4 GiB limit for the FAT32 file system.

  • The size of the USB pendrive should be at least 8 GB
    • If you have a custom iso file, that needs more space than provided by the NTFS partition of the compressed image file, you should delete the NTFS partition and create a new partition using all the drive space behind the FAT partition
  • The method is tested with 64-bit systems
  • The install drive works both in UEFI mode and BIOS mode (alias CSM alias legacy mode) including secure boot. Grub is used to boot in BIOS mode, and it comes with the compressed image file.

If you have not yet ...

... downloaded an iso file

Download a 64-bit Windows 7--10 iso file

You find Windows iso files via Microsoft's web pages (and you need a license key to use it later on).

... created a mountpoint and loop mounted the iso file

Create a mountpoint

Create the mountpoint only once.

sudo mkdir -p /mnt/lp1

Loop mount the iso file

sudo mount -o loop file.iso /mnt/lp1

for example

sudo mount -o loop Win10_1809Oct_EnglishInternational_x64.iso /mnt/lp1

Check the size of the biggest file

When you have loop mounted a Windows iso file, you should check the size of the biggest file, often 'install.wim'. If it is > 4GiB, you need an ntfs partition. You can look for the biggest file with the following command line,

find /mnt/lp1 -ls|sort -nk7|tail -n1

Convert from bytes to MiB (you can divide by 2^30 in bc).

You can find all files that exceed the limit directly with the following command line,

find /mnt/lp1 -size +4G -printf "%11s %p\n" | sort -n

If a file exceeds the limit, you should download and use a compressed image file, that provides two partitions, one with the file system FAT16 and one with NTFS, that can manage the big file(s).

Otherwise, if all files are smaller than 4 GiB, you can Return to the main diy page.

... downloaded the correct compressed image file

Download the following compressed image file

Download this compressed image file: grub-win-ntfs-install.img.xz

Check that the md5sum is correct with the following file: grub-win-ntfs-install.img.xz.md5.asc

You may want a higher level of security. This file is signed with gpg and you can verify it according to the following commands.

gpg --keyserver keyserver.ubuntu.com --recv-keys EB0FC2C8
gpg --verify grub-do-it-yourself.img.xz.md5.asc 

The warning "was NOT verified" means that there is no chain of trusted keys between your computer's keyring and the key, that was used to sign the checksums (the key of sudodus). Check that the result matches with the following output, when you verify it,

$ gpg --keyserver keyserver.ubuntu.com --recv-keys EB0FC2C8
gpg: directory `/home/tester/.gnupg' created
gpg: new configuration file `/home/tester/.gnupg/gpg.conf' created
gpg: WARNING: options in `/home/tester/.gnupg/gpg.conf' are not yet active during this run
gpg: keyring `/home/tester/.gnupg/secring.gpg' created
gpg: keyring `/home/tester/.gnupg/pubring.gpg' created
gpg: requesting key EB0FC2C8 from hkp server keyserver.ubuntu.com
gpg: /home/tester/.gnupg/trustdb.gpg: trustdb created
gpg: key EB0FC2C8: public key "Nio Sudden Wiklund (sudodus) <address@mailserver.com>" imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)

$ gpg --verify grub-win-ntfs-install.img.xz.md5.asc 
gpg: Signature made sön  3 mar 2019 13:20:07 CET
gpg:                using RSA key 0303EA77E34C52F2295847C6BD43C742EB0FC2C8
gpg:                issuer "nio.wiklund@gmail.com"
gpg: Good signature from "Nio Sudden Wiklund (sudodus) <nio.wiklund@gmail.com>" [ultimate]

Then there is reason to trust that nobody else has written the checksums. The date of the signature will change at updates, and the text might be translated to your local language, but it should be clear that it is a 'Good signature from "Nio Sudden Wiklund (sudodus)"'.

If you have the compressed image file and the md5sum file in the same directory, you can use the md5sum program to check like this,

md5sum -c grub-win-ntfs-install.img.xz.md5.asc

tester@xenial32 ~ $ md5sum -c grub-win-ntfs-install.img.xz.md5.asc
grub-win-ntfs-install.img.xz: OK
md5sum: WARNING: 14 lines are improperly formatted

The 'improperly formatted lines' are the lines belonging to the gpg signature.

Create the partition table and file systems

Install mkusb if you want to clone safely and easily (optional)

https://help.ubuntu.com/community/mkusb

Clone 'grub-win-ntfs-install.img.xz' to the target drive

Normally you would clone grub-win-ntfs-install.img.xz to a USB pendrive or memory card, minimum size 8GB. The image extracts to 7743 MB. There is a margin for undersized 8 GB pendrives and cards. Please unmount all partitions on the target drive before cloning.

Use mkusb or Disks

Use mkusb or Disks to clone in a safe way, via the GUI or using mkusb-dus

dus grub-win-ntfs-install.img.xz

or

Use dd to clone in a risky way

Avoid this method if you can, because it is risky.

Identify the target drive. You can use lsblk without options or better, copy and paste the following command line

lsblk -d -o name,vendor,model,type,size,hotplug

and then use the correct drive letter in the cloning command line

sudo dd if=grub-win-ntfs-install.img.xz of=/dev/sdX bs=4096

where X is the drive letter of the target drive. Check that the drive letter is correct, and double-check the details of the whole command line. A minor typing error might overwrite your family pictures.

Use Win32 Disk Imager to clone in Windows

Mount partitions on the target drive

Create mountpoints

Create mountpoints only once.

sudo mkdir -p /mnt/sd1
sudo mkdir -p /mnt/sd2

Mount the partitions on the USB pendrive or memory card

Identify the target drive. You can use lsblk without options or better, copy and paste the following command line

lsblk -d -o name,vendor,model,type,size,hotplug

or blkid, grep and cut, copy and paste the following command line

sudo blkid |grep WININSTFAT|cut -d ' ' -f 1-2
sudo blkid |grep WinInstNtfs|cut -d ' ' -f 1-2

and then use the correct drive letter in the mounting command line

sudo mount /dev/sdX1 /mnt/sd1

sudo mount /dev/sdX2 /mnt/sd2

where X is the drive letter of the target drive. Double-check that the drive letters are correct.

Copy the content from the iso file to the target partition

rsync

You can use rsync to perform the copy operations. First copy the files related to booting to the FAT partition. Then copy 'everything' to the NTFS partition. Some computers need the FAT partition to boot in UEFI mode. Some computers can boot directly from the NTFS partition.

(Grub is used to boot in BIOS mode, and it comes with the compressed image file, you need not worry about that.)

sudo rsync -r --info=progress2 --exclude=sources /mnt/lp1/ /mnt/sd1
sudo mkdir /mnt/sd1/sources
sudo rsync -r --info=progress2 /mnt/lp1/sources/boot.wim /mnt/sd1/sources
sudo rsync -a --info=progress2 /mnt/lp1/ /mnt/sd2

There might be some warning and error messages from the rsync copying process. Some links cannot be understood and some permissions cannot be preserved by the FAT32 file system in the target partition. But the result will still be a useful system in the drive.

I have seen cases, when running in some versions of 32-bit Ubuntu systems, where rsync does not copy all the files correctly. They are truncated (too small). When this happens the system in the drive will not work. rsync did not notice it; there was no warning or error message about this problem.

Alternative 1

You can use mkusb for the whole process instead. It is made and tested to manage these cases, where rsync truncates some files. But mkusb does not work (yet), if a file exceeds 4 GiB.

Alternative 2

You can try to extract the content from the iso file to the target partition with your favourite tool for compressed files, for example

1. 7z (via the package p7zip-full) in Ubuntu and

2. 7-zip in Windows.

Flush the buffers

sync

Now you have a Windows install drive :-)

Unmount the partitions on the target drive and unplug it

sudo umount /mnt/sd?

Check that no partition on the target drive is mounted with

df

(and you can unmount the iso file too

sudo umount /mnt/lp1

but it is mounted read-only, and not dangerous to leave mounted)

In Windows you should eject the drive and wait until it is 'safe to remove the device'.

or

Continue if you wish

Modify the partition table

  • If there is space enough (if the drive contains more than 8 GB), you can create a third partition. It is easy to use gparted to create the third partition.

  • If you have a custom iso file, that needs more space than provided by the NTFS partition of the compressed image file, you should delete the NTFS partition and create a new partition using all the drive space behind the FAT partition.


Return to the main diy page

Installation/iso2usb/diy/windows-installer-for-big-files (last edited 2019-11-06 13:43:41 by nio-wiklund)