This page looks best with JavaScript enabled

Install Windows on Usb Drive From Linux Using Qemu

 ·  ☕ 2 min read
    🏷️

🧰 Requirements

A Linux host with:

  • qemu (or qemu-system-x86_64) installed
  • sudo privileges
  • The ISO file of the OS you want to install (e.g. ubuntu.iso)
  • A USB drive (we’ll call it /dev/sdX — replace X with your actual device letter)

⚠️ Be careful — this process will overwrite all data on the USB drive.

You can identify the USB drive with:

1
lsblk

Then note your target (e.g. /dev/sdb).

🧩 Step-by-step using QEMU

1. Unmount the USB drive (important!)

1
sudo umount /dev/sdX*

2. Run QEMU, booting from the ISO, using the USB drive as the VM’s hard disk

1
2
3
4
5
6
7
sudo qemu-system-x86_64 \
  -enable-kvm \
  -m 4096 \
  -boot d \
  -cdrom /path/to/installer.iso \
  -drive file=/dev/sdX,format=raw,if=virtio \
  -vga virtio

Explanation:

  • -enable-kvm → hardware acceleration
  • -m 4096 → 4 GB of RAM
  • -boot d → boot from CD-ROM first
  • -cdrom → ISO installer
  • -drive file=/dev/sdX,format=raw → use the physical USB as a raw disk
  • -vga virtio → decent graphics for most installers

3. Install normally
Inside the VM, choose the target disk corresponding to the USB drive (usually shows as /dev/vda in the VM).
Perform the OS installation as you would on a normal hard drive.

4. Shut down the VM
Once the installation finishes, power off the VM.
You can then safely remove the USB and boot it on real hardware.

Share on
Support the author with

vitor
WRITTEN BY
vitor