From 3ea450cafcde131d521a1a08de67dff363631d2a Mon Sep 17 00:00:00 2001 From: Ettore Dreucci Date: Mon, 1 Jun 2020 22:49:52 +0200 Subject: [PATCH] New post: Create Windows 10 Install Drive Signed-off-by: Ettore Dreucci --- content/blog/win10-install-drive.md | 79 +++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 content/blog/win10-install-drive.md diff --git a/content/blog/win10-install-drive.md b/content/blog/win10-install-drive.md new file mode 100644 index 0000000..6cf8ed0 --- /dev/null +++ b/content/blog/win10-install-drive.md @@ -0,0 +1,79 @@ +--- +title: "Create Windows 10 Install Drive" +tags: ["win10", "uefi", "bios", "drive"] +categories: ["recipe"] +description: "How to create a Windows 10 (UEFI and BIOS) install drive in Linux" +date: 2020-05-30T10:11:13+02:00 +author: "Ettore Dreucci" +draft: false +--- + + + +## [[recipe]({{< ref "/categories/recipe" >}})]: How to create a Windows 10 (UEFI and BIOS) install drive in Linux + +Latests Win10 image released by Microsoft have the `install.wim` file way above 4GB and FAT32 formatted devices cannot handle file bigger than 4GB in size. You could use a NTFS partition but that will reduce the number of machines you’ll be able to use the drive on because some (older) systems can’t boot from NTFS drive. + +An option is to use a small FAT32 partition that will contains only the NTFS UEFI drivers and bootloader and a bigger NTFS partition that will contains the Win10 image. + +Another option is to compress the `install.wim` file with [wimlib](https://wimlib.net/), an open source, cross-platform library for modifying [Windows Imaging](https://en.wikipedia.org/wiki/Windows_Imaging_Format) archives. This is what we’ll be doing: + +#### Mount Win10 ISO and extract `install.wim` + +We need to mount the ISO and copy the `install.wim` file somewhere else to be able to shrink it because `ISO-9660` is a read-only filesystem + +``` +mount -o loop /path/to/win10.iso /iso/mount/point +mkdir /tmp/win10 +rsync -av --no-owner --no-group --progress /iso/mount/point/sources/install.wim /tmp/win10 +``` + +#### Compress it + +Using the `wimoptimize` utility with the `--solid` option we can achieve remarkable compression rates: + +`wimoptimize --solid /tmp/win10/install.wim` + +``` +wimoptimize --solid install.wim +"install.wim" original size: 4266040 KiB +Using LZMS compression with 4 threads +Archiving file data: 9434 MiB of 9434 MiB (100%) done +"install.wim" optimized size: 3170257 KiB +Space saved: 1095782 KiB +``` + +#### Format the drive + +Now that the `install.wim` file can be fitted in a FAT32 partition we can prepare the drive. + +1. First we need to create a GPT partition table on the drive: + + `sudo gdisk /dev/sdXYZ` + + which will then ask for some commands: + + - `o` to create a new GPT partition table + - `n` to create a new partition + - `w` to apply the changes to the drive + +2. Then we need to FAT32-format the partition: + + `sudo mkfs.vfat /dev/sdXYZ123` + +#### Mount the drive and copy the data + +When the drive is ready we can mount it and copy data from the ISO, excluding the old `install.wim`: + +``` +sudo mount /dev/sdXYZ123 /drive/mount/point +rsync -av --progress /iso/mount/point /drive/mount/point --exclude sources/install.wim +``` + +Then we’ll copy the new compressed file: + +`rsync -av --progress /tmp/win10/install.wim /drive/mount/point` + +#### Boot + +The drive should now be ready. Go try it and boot! \ No newline at end of file