Introduction

In this guide I document how you can create a disk image of bootable Windows 7 installation media without having a working Windows installation in hand. The image could be written to a physical USB storage device. This guide is an adaptation of the standard way to create Windows 7 USB installation media that are all around the net[1],[2].

Preparation

During this guide we’re assuming that

  • You have a 64-bit Linux installation at hand with capability to run KVM virtual machines
    • Ubuntu 9.10 was used when writing this posting
  • Root access on the said Linux machine
  • The target platform is Windows 7 64-bit
  • Bootable ISO image of Windows 7 installation media exists
    • We’re using the image 7600.16385.090713-1255_x64fre_client_en-us_Retail_Ultimate-GRMCULXFRER_EN_DVD.iso

It should be very straightforward to adapt this guide to apply to 32-bit Linux host or Windows 7 target.

Creating the image

  1. First create a disk image file for the Windows 7 installation media. 3200 megabytes will hold the installer of Windows 7 Ultimate 64-bit.

    ~: # qemu-img create -f raw /scratch/images/win7.img 3200M
    
    
  2. Launch KVM so that the virtual machine boots from CD-ROM that has the Windows 7 installation ISO image attached to it. Also the empty disk image is added to the virtual machine.

    ~: # kvm -cpu qemu64 -m 1024 -vnc :1 -hda /scratch/images/win7.img -cdrom \
            /scratch/images/7600.16385.090713-1255_x64fre_client_en-us_Retail_Ultimate-GRMCULXFRER_EN_DVD.iso
    
    
  3. Connect to the display of the virtual machine using a VNC viewer. You should see Windows 7 installation program loading. Make your language / localization / keyboard selections and press Next.

  4. Choose Repair your computer

  5. Select Use recovery tools that can help fix problems starting Windows and click Next.

  6. Click Command Prompt

  7. Now we’re using diskpart[3] utility that can be launched from the recovery shell.

    X:\Sources>diskpart
    
    
  8. Input the following commands in order to partition and format the virtual disk.

    select disk 0
    create partition primary
    select partition 1
    active
    format fs=ntfs quick
    assign
    exit
    
    
  9. The virtual disk is now available as drive C:. Now you can copy the contents of the installation media (CD-ROM drive D:) onto it.

    xcopy d:\ c:\ /e
    
    
  10. Close the shell and click Shut Down in the System Recovery Options window.

  11. The installation disk is now ready! Now you can write the disk image file win7.img to a physical USB storage device with e.g. dd(1).

References