For most bootable ISO images one of two approaches works:
dd if=image.iso of=/dev/sdxif image is a hybrid CD-ROM/HD image.
- Extracting image via UNetbootin.
However, none of this works for Windows setup disks, even if you do this on Windows. Usually I go with UltraISO's "Write hard drive image", which works fine. But there is no UltraISO for GNU/Linux and one has to go another road.
The most useful information I found was in this thread on LinuxQuestions, but everything worked for me only on the third try, so I though of archiving working sequence of steps and a way to test them without rebooting machine here.
The main problem with Windows installation is absence of boot loaders in correct places, for this there is trully nice ms-sys utility out there. It's capable of installing various Windows boot loaders on your request, so be sure to have that installed.
Boot loaders need to be installed on partitions of supported type, so USB stick should be properly partitioned. Simply formatting whole USB stick as VFAT partition or making separate partition and formatting it as VFAT didn't worked for me, so I did the following:
- Removed partition table (I used
fdiskto remove all for primary partitions by pressing
d<enter>1<enter>d<enter>2<enter>d<enter>3<enter>d<enter>4<enter>, but there are other ways, e.g. using dd).
- Created new partition (using
- Marked it as bootable (used cfdisk if that matters).
- Formatted partition as NTFS (
# mkfs.ntfs /dev/sdx1).
- Installed NTFS boot loader (
ms-sys -n /dev/sdx1).
- Installed MBR boot loader (
ms-sys -7 /dev/sdx).
With this done, all that's left is to copy files from Windows ISO image:
mount win7.iso /media/cdrom -o ro,loop
mount /dev/sdx1 /media/disk
cp -r /media/cdrom/* /media/disk/
Not it should be ready for testing using QEMU. Install it and run:
qemu-system-x86_64 -m 1024 -hda /dev/sdx
-m 1024 is to give VM 1 GiB of RAM, because Windows installation fails to
start with default amount of memory (128 MiB). It's not really important,
if you see an error saying something like
Not enough memory, then USB stick