Features WIMBoot Lead image: Lead Image © ximagination, 123RF.com
Lead Image © ximagination, 123RF.com
 

Booting Windows from a compressed image

Dream Start

Microsoft's WIMBoot lets you run Windows 8.1 from a compressed file on solid state drives. By Thomas Joos

Recent Windows systems use Windows Image file format (WIM) as a disk image format. Unlike sector-based equivalents such as ISO, which require special handling by the system, WIM is a file-based format. System files and other important information are stored in compressed form within the WIM image.

Windows 8.1 rolls out a new feature called Windows image file boot (WIMBoot). According to Microsoft, WIMBoot "… lets you set up a PC so that it runs directly from a compressed Windows image file. WIMBoot can significantly reduce the amount of space used by Windows files" [1].

WIMBoot is designed to reduce the required space for a new generation of Windows tablets, but it will also work on other Windows 8.1 systems if you're looking for a way to free up disk space.

Instead of placing the system files directly on the Windows partition, WIMBoot uses pointers that reference files on the WIMBoot image. For this reason, WIMBoot only makes sense for solid state drives. According to Microsoft, "WIMBoot isn't supported on traditional drives that contain rotational components or on hybrid drives that contain both solid-state and rotational drive components. WIMBoot works by taking advantage of the capability of solid-state drives to access different areas of the hard drive quickly" [1].

WIMBoot only requires 4GB of disk space in Windows 8.1. WIMBoot does not impose restrictions on users. Programs and tools are installed as usual. Rolling out updates and patches for Windows 8.1 with the WIM file is generally the same as booting from a Virtual Hard Disk (VHD) file, only faster. You can even create your own WIM image on the basis of a preinstalled Windows 8.1 computer.

In this article, I will describe how to perform the necessary preparations for using WIMBoot on a Windows 8.1 system, how to install the technology, and your options when creating the image.

Prerequisites for WIMBoot

The new Windows 8.1 Update 1 allows you to roll out an entire operating system via a single WIM file and keep it up to date. Deploying Windows 8.1 via WIMBoot is fast and uses less memory, so the technology is suitable for speeding up the distribution of Windows 8.1 throughout an enterprise.

To use WIMBoot in your company, you will need the latest Windows 8.1 Update 1 of the Windows Assessment and Deployment Kit (ADK) [2]. WIMBoot is mainly implemented using the dism.exe tool and the Windows Preinstallation Environment (WinPE) version 5.1 from the ADK. WinPE version 5.0 in the Windows 8.1 ADK does not yet support this technology. The tools QuickPE [3] and Rufus [4] can also help create a suitable WinPE image and bundle it into a bootable USB stick. To implement the procedures in this article, you can use the trial version of Windows 8.1 Enterprise [5].

How WIMBoot Works

If you install Windows 8.1 in the usual way, the necessary files from the install.wim file in the sources directory of the installation DVD are extracted and written to the computer hard disk. Additionally, important system files land in compressed form on the hard disk for recovery routines (Reset and Refresh) to fix a system, if needed. Not surprisingly, these memory operations require a lot of disk space. However, if WIMBoot is used, Update 1 uses the WIM image for recovery, thus saving a huge amount of disk space. Furthermore, only this one file needs to be installed on computers. By booting this file, Windows 8.1 starts just as it does in a normal installation.

In addition to booting the default install.wim file, you can create another WIM file (custom.wim) and connect it to the computer. The default Update 1 files are located in install.wim, whereas custom.wim contains changes, patches, installed programs, and other settings that differ from the default files.

Another option is to create a WIM file based on an already existing installation and then assign this WIM file to a system. The PC then boots with the same settings and data as before but uses less disk space.

The Reset and Refresh functions also work with WIMBoot. You only need to connect a third WIM file (winre.wim), through which the recovery is performed. By separating this file from the default install.wim file, you thus save space. The recovery file is saved as a hidden file in the install.wim image in the path Windows\ System32\Recovery\winre.wim.

Only from SSD with UEFI

Windows 8.1 is not capable of booting from WIM files without Update 1. This also applies to the tool dism.exe. Windows Server 2012 R2 does not support this function after installing Update 1, so you can only boot workstations via WIMBoot with Windows 8.1.

Moreover, use of this technology is only possible on new PCs with UEFI. WIMBoot might not support the BIOS, but it does support the UEFI system's secure boot technology. In a Windows 8.1-based Hyper-V environment, you must accordingly use second-generation VMs that support UEFI.

Although the system cannot boot from conventional or hybrid drives, you can, of course, connect other drives to the PC in addition to your SSD. You should make sure the virus scanner you use is compatible, as well, because not all scanners support WIMBoot.

Creating an Image

To use WIMBoot, you first need a standard installation file of Windows 8.1 Update 1 based on the install.wim file from the sources directory of the installation DVD or an ISO file with Windows 8.1 Update 1. Later, I'll show how to boot a computer with Windows 8.1 Update 1 using WinPE 5.1, how to create a WIM image that supports WIMBoot, and how to assign this image to the computer as the operating system. You can also do all this with a Hyper-V second-generation virtual machine.

In the example, I assume you have saved the install.wim file in the C:\Temp directory; now, to add WIMBoot compatibility to the standard image, enter line 1 in Listing 1. The Dism command-line program is automatically added to the command path during the ADK installation, so you do not have to switch to the ADK installation directory.

Listing 1: Creating the WIMBoot Image

01 Dism /Export-Image /WIMBoot /SourceImageFile:C:\Temp\install.wim \
   /SourceIndex:1 /DestinationImageFile:C:\Temp\install_wimboot.wim
02
03 md C:\mount\Windows
04 Dism /Mount-Image /ImageFile:"C:\Temp\install.wim" /Index:1 \
   /MountDir:C:\mount\Windows
05
06 attrib -s -h C:\mount\Windows\Windows\System32\Recovery\winre.wim
07
08 move C:\mount\Windows\Windows\System32\Recovery\winre.wim C:\Temp\winre.wim
09
10 Dism /Optimize-Image /Image:C:\mount\Windows /WIMBoot
11
12 Dism /Unmount-Image /MountDir:C:\mount\Windows /Commit

Alternatively, instead of converting the default image file of Windows 8.1 Update 1, you can create your own, new WIMBoot image by copying install.wim to a new temporary file and using it.

However you create your image file, you should now create a mount directory and mount the image (lines 3 and 4; Figure 1). Additionally, you make the recovery boot image (winre.wim) visible in line 6 and move winre.wim from the image to save further disk space (line 8). Line 10 then optimizes the rest of the image for WIMBoot. The next step (line 12) dismounts the image; the changes are written to the image and can now be used to boot computers.

Creating a WIM bootable image with Dism from the current Windows ADK.
Figure 1: Creating a WIM bootable image with Dism from the current Windows ADK.

Customizing Images

After you have configured a satisfactory WIM image, you can distribute it to clients. Because a WIM image is appended in its own partition at the end of the hard drive, you should first adjust the hard disk partition on the computer. You will need a boot device with WinPE 5.1 to deploy.

To create an appropriate volume, from Windows 8.1 Update 1 with an installed Windows ADK environment, right-click the Deployment and Imaging Tools Environment via the context menu and Run as administrator. Create a working directory and directory structure for the WinPE files with

copype amd64 C:\WinPE_amd64

WinPE 5.0 is initially in this folder.

Now update it to version 5.1. To do so, download the MSU files for Windows 8.1 Update [6] and the update for Windows 8.1 [7]. Then, copy the seven MSU files into their own directory (e.g., C:\msu). You will need the files later to integrate them into WinPE 5.0 and to update them on WinPE 5.1. Next, mount the WinPE image with the following:

Dism /Mount-Image \
         /ImageFile:"C:\WinPE_amd64\media\sources\boot.wim" /index:1 \
         /MountDir:"C:\WinPE_amd64\mount"

In the next step, integrate the downloaded MSU files with the commands shown in Listing 2 [8]. Before doing so, ensure that all the patches are in the directory and complete the integration without error messages.

Listing 2: Updating Windows Images

Dism /Add-Package
     /PackagePath:C:\MSU\Windows8.1-KB2919442-x64.msu
     /Image:C:\WinPE_amd64\mount /LogPath:AddPackage.log
Dism /Add-Package
     /PackagePath:C:\MSU\Windows8.1-KB2919355-x64.msu
     /Image:C:\WinPE_amd64\mount /LogPath:AddPackage.log
Dism /Add-Package
     /PackagePath:C:\MSU\Windows8.1-KB2932046-x64.msu
     /Image:C:\WinPE_amd64\mount /LogPath:AddPackage.log
Dism /Add-Package
     /PackagePath:C:\MSU\Windows8.1-KB2934018-x64.msu
     /Image:C:\WinPE_amd64\mount /LogPath:AddPackage.log
Dism /Add-Package
     /PackagePath:C:\MSU\Windows8.1-KB2937592-x64.msu
     /Image:C:\WinPE_amd64\mount /LogPath:AddPackage.log
Dism /Add-Package
     /PackagePath:C:\MSU\Windows8.1-KB2938439-x64.msu
     /Image:C:\WinPE_amd64\mount /LogPath:AddPackage.log
Dism /Add-Package
     /PackagePath:C:\MSU\Windows8.1-KB2959977-x64.msu
     /Image:C:\WinPE_amd64\mount /LogPath:AddPackage.log

Next, optimize and dismount (Figure 2) the image:

Dism /image:C:\WinPE_amd64\mount /Cleanup-Image \
  /StartComponentCleanup /ResetBase
Dism /Unmount-Image /MountDir:"C:\WinPE_amd64\mount" /commit
You need a WinPE boot disk based on WinPE 5.1 (Windows 8.1 Update 1) to provision WIMBoot.
Figure 2: You need a WinPE boot disk based on WinPE 5.1 (Windows 8.1 Update 1) to provision WIMBoot.

In Listing 3, the commands shown create the updated WinPE 5.1 medium according to the following line numbers:

Listing 3: Creating the WinPE Medium

01 Dism /Export-Image /SourceImageFile:C:\WinPE_amd64\media\sources\boot.wim
   /SourceIndex:1 /DestinationImageFile:C:\WinPE_amd64\media\sources\boot2.wim
02 del C:\WinPE_amd64\media\sources\boot.wim
03 rename C:\WinPE_amd64\media\sources\boot2.wim boot.wim
04 MakeWinPEMedia /ISO C:\winpe_amd64 C:\winpe_amd64\winpe.iso
05 MakeWinPEMedia /UFD C:\WinPE_amd64 <stick drive letter>:

1. Export the WIM file and customize it for WIMBoot.

2. Delete the old boot file.

3. Use the new boot file.

4. Create an ISO file.

5. Create a bootable USB stick.

If you now boot the computer using the WinPE disk, you can manage WIMBoot and install a WIMBoot image on the computer.

Easier Image Rollout

At this point, you need to boot the computer with Windows 8.1 Update 1 using this USB stick or create a virtual machine by copying the ISO file from the VM onto the host computer and then setting it as a bootable disk. You also need to adjust the boot sequence in the settings of the VM "Firmware" for generation 2 VMs (Figure 3).

Change the boot order in the settings of second-generation VMs in Hyper-V 2012 R2 and incorporate WinPE 5.1.
Figure 3: Change the boot order in the settings of second-generation VMs in Hyper-V 2012 R2 and incorporate WinPE 5.1.

You can also create a WIM image of the current installation in this disk's command prompt. The WIM file can also be used as a boot medium. However, you need to make sure that this operating system has Windows 8.1 Update 1. To create an image, use the following command:

dism /capture-image /imagefile:"<dev>:<\path\new>.wim" \
  /capturedir:C: /name: "<name>"

During this process, save an image of the current operating system with all data and settings on an external hard drive and assign it later. The advantage is that you can install the necessary programs in a template image beforehand and integrate the necessary drivers and settings.

You can prepare this image with the previously mentioned steps to customize existing images for WIMBoot and then assign them to your computer. You can even optimize WIMBoot while creating it using the option /wimboot. However, this option is only available with WinPE 5.1, not WinPE 5.0.

Executing WIMBoot

You can now provide a WIMBoot-optimized WIM image in the command prompt. To this end, you should first completely format the C: drive, which you can do easily in WinPE. Afterward, use the WIM image you created yourself or an image you created using the install.wim file and assign it as a WIMBoot image:

dism /apply-image /imagefile:"C:<\path\your>.wim" \
  /index:1 /applydir:C:\wimboot

Reboot your computer once the operation is completed. Windows 8.1 will now start in a conventional installation. However, the WIM image looks like a conventional system hard drive within the Windows 8.1 installation. You also need to add data to the boot manager, using

bcdboot X:\windows /s X:\

where X is the drive with the WIM image.

Conclusions

With WIMBoot, you can distribute preconfigured Windows 8.1 systems and save some space on your hard disks. However, an important prerequisite is that you use an up-to-date environment. As an alternative, you can also use the open source tool wimlib to boot previous versions of Windows as images (see the box called "Alternative: wimlib" for more information).