Qemu example existing windows disk
This simple example demonstrates:
- boot existing windows install, off real HDD
- booting windows using EFI
- KVM/HyperV enhancements (specific to windows)
- Spice for RDP
Setup/Dependencies
sudo pacman -S qemu # qemu itself sudo pacman -S ovmf # intel EFI driver cp /usr/share/ovmf/x64/OVMF_CODE.fd bios.bin # copy OVMF_CODE.fd to bios.bin somewhere. It MUST be renamed.NOTE:
windows 10 installs default to using EFI, the params
-L
and--bios
reference the 3rd party intel OVFM software.As far as I know, you cannot directly reference the windows bootloader like you can the linux kernel
Start Simple
Simple Example to get you up/running, before layering in too many components that may break.
# run qemu, booting off disk using EFI qemu-system-x86_64 \ -enable-kvm `# enable KVM optimiations` \ -L . `# dir with bios.bin` \ --bios bios.bin `# bios.bin itself` \ -m 8G `# provide reasonable amount of ram` \ -cpu host `# match the CPU type exactly` \ -drive file=/dev/sda,format=raw,media=disk `# load raw HDD` \
CPU optimizations
# emulate exact host cpu, # enable hyper-v enlightenments -enable-kvm -cpu host,hv_relaxed,hv_spinlocks=0x1fff,hv_vapic,hv_time -machine type=pc,accel=kvm # use all available CPU cores -smp $(nproc)
Spice for RDP
spice is a fast (but not as fast as bare-metal/pci-passthrough) RDP server. Using spice will let you use higher-than 1024x960 resolutions, at a reasonable speed (as long as you do not care heavily about speed of graphics). It also enables bi-directional clipboard access.
install dependencies
sudo pacman -S qemu spice virt-viewerqemu flags
-daemonize # do not attach monitor, we connect by RDP -vga qxl -spice port=5930,disable-ticketing -device virtio-serial -device virtserialport,chardev=spicechannel0,name=com.redhat.spice.0 -chardev spicevmc,id=spicechannel0,name=vdagentconnect to spice
remote-viewer spice://127.0.0.1:5930 & disown remote-viewerinstall guest drivers
install windows guest tools in guest OS. Find on https://www.spice-space.org/download.html
Resource-Expensive Programs
program cost how to disable salt-minion 90% CPU-utilization on idle!! Task-Manager > Services > Open Services > salt-minion (rclick/properties) > StartupType: Manual