- Microsoft Windows 11 VM
- Table of Contents
- Prerequisites
- Preparation
- Installation
- Advanced Guest VM Launch
- Reduce the Size of Guest VM
- Windows 11 ISO. In this example we are using Windows 11 version 23H2 (OS Build 22631.4890)
- Intel Graphics Driver version 32.0.101.6314
- SR-IOV Zero Copy Driver version 4.0.0.1797
- Virtio Driver version 0.1.240-1
-
Download the Windows 11 iso image, save it as
windows.isoand copy it to setup directorycp windows.iso /home/$USER/sriov/install_dir/
-
Run
install_windows.shto start windows vm installation# Start installing Windows guest vm cd /home/$USER/sriov/scripts/setup_guest/win11 sudo ./install_windows.sh
-
Choose language and other preferences and click Next
-
Select Drive 0 Unallocated Space and click Next and wait for Windows installation to succeed
-
Shutdown the Windows guest
There are two options provided. Choose the corresponding launch method according to your installation method.
- [Option 1] Launch VM Using
qemu - [Option 2] Launch VM Using
virsh
-
Run
start_windows.shto launch windows virtual machinecd /home/$USER/sriov/scripts/setup_guest/win11 sudo ./start_windows.sh
-
Setup libvirt on host.
Note: Skip this step if it has been run before
cd /home/$USER/sriov/virsh_enable/host_setup/debian # load br_netfilter module sudo modprobe br_netfilter ./setup_libvirt.sh
# reboot the system sudo reboot -
Launch the windows vm
cd /home/$USER/sriov/virsh_enable/ # init windows guest vm ./guest_setup/idv.sh init windows11 # launch vm sudo ./guest_setup/launch_multios.sh -f -d windows11 -g sriov windows11
- Install Windows update with the following steps:
- Open Settings
- Click Windows Update
- Click Check for updates and wait for the update to complete.
- Click Pause for 1 week to disable the automatic updates temporarily.
-
Download Intel Graphics Driver from browser.
-
Use File Explorer to extract the zip file.
-
Navigate into the install folder and double click on
Installer.exeto launch the installer. -
Click Begin installation
-
After the installation has completed, click the Reboot Required button to reboot.
-
After reboot, launch the Device Manager to check the installation.
-
Download SR-IOV Zero Copy Driver from browser.
-
Navigate into the install folder and double click on
ZeroCopyInstaller.exeto launch the installer.
-
Click on the Install button when prompted.
-
Once the driver installation completes, click Finish and the Windows Guest VM will reboot automatically.
-
After reboot, launch the Device Manager to check the installation.
-
Download Virtio Driver from browser.
-
Double click the iso file in File Explorer to mount it.
-
Search for Windows PowerShell and run it as an administrator.
-
Navigate to the folder of the extracted files.
-
Use the following command to install VIOSerial.
Start-Process msiexec.exe -Wait -ArgumentList '/i "D:\virtio-win-gt-x64.msi" ADDLOCAL="FE_network_driver,FE_balloon_driver,FE_pvpanic_driver,FE_qemupciserial_driver,FE_vioinput_driver,FE_viorng_driver,FE_vioscsi_driver,FE_vioserial_driver,FE_viostor_driver"' -
Install QEMU guest agent in Windows VM.
Start-Process msiexec.exe -ArgumentList '/i "D:\guest-agent\qemu-ga-x86_64.msi"'
There are three options provided. Choose the corresponding launch method according to your installation method.
Note: Option 3 should be executed after option 2
- [Option 1] Launch VM With
qemu - [Option 2] Launch VM With
virsh - [Option 3] Launch VM With
virt-manager
-
Run
start_windows.shto launch windows virtual machinecd /home/$USER/sriov sudo ./scripts/setup_guest/win11/start_windows.sh
-
Launch the windows vm
cd /home/$USER/sriov/virsh_enable/ # init windows guest vm ./guest_setup/idv.sh init windows11 # launch vm sudo ./guest_setup/launch_multios.sh -f -d windows11 -g sriov windows11
-
Run virt-manager to launch windows virtual machine
virt-manager
-
Passthrough usb device. Click Open button -> click Add Hardware and select the usb device you need -> click Finish
-
Launch the windows vm. Click Virtual Machine -> click Run
-
Customize launch single VM
The
start_windows.shscript help on the hostcd /home/$USER/sriov/scripts/setup_guest/win11 sudo ./start_windows.sh -h
Output
start_windows.sh [-h] [-m] [-c] [-n] [-d] [-f] [-p] [-e] [--passthrough-pci-usb] [--passthrough-pci-udc] [--passthrough-pci-audio] [--passthrough-pci-eth] [--passthrough-pci-wifi] [--disable-kernel-irqchip] [--display] [--enable-pwr-ctrl] [--spice] [--audio] Options: -h show this help message -m specify guest memory size, eg. "-m 4G or -m 4096M" -c specify guest cpu number, eg. "-c 4" -n specify guest vm name, eg. "-n <guest_name>" -d specify guest virtual disk image, eg. "-d /path/to/<guest_image>" -f specify guest firmware OVMF variable image, eg. "-d /path/to/<ovmf_vars.fd>" -p specify host forward ports, current support ssh, eg. "-p ssh=2222" -e specify extra qemu cmd, eg. "-e "-monitor stdio"" --passthrough-pci-usb passthrough USB PCI bus to guest. --passthrough-pci-udc passthrough USB Device Controller ie. UDC PCI bus to guest. --passthrough-pci-audio passthrough Audio PCI bus to guest. --passthrough-pci-eth passthrough Ethernet PCI bus to guest. --passthrough-pci-wifi passthrough WiFi PCI bus to guest. --disable-kernel-irqchip set kernel_irqchip=off. --display specify guest display connectors configuration with HPD (Hot Plug Display) feature, eg. "--display full-screen,connectors.0=HDMI-1,connectors.1=DP-1" sub-param: max-outputs=[number of displays], set the max number of displays for guest vm, eg. "max-outputs=2" sub-param: full-screen, switch the guest vm display to full-screen mode. sub-param: show-fps, show fps info on the guest vm primary display. sub-param: connectors.[index]=[connector name], assign a connected display connector to guest vm. sub-param: extend-abs-mode, enable extend absolute mode across all monitors. sub-param: disable-host-input, disallow host\'s HID devices to control the guest. --enable-pwr-ctrl option allow guest power control from host via qga socket. --spice enable SPICE feature with sub-parameters, eg. "--spice display=egl-headless,port=3002,disable-ticketing=on,spice-audio=on,usb-redir=1" sub-param: display=[display mode], set display mode, eg. "display=egl-headless" sub-param: port=[spice port], assign spice port, eg. "port=3002" sub-param: disable-ticketing=[on|off], set disable-ticketing, eg. "disable-ticketing=on" sub-param: spice-audio=[on|off], set spice audio eg. "spice-audio=on" sub-param: usb-redir=[number of USB redir channel], set USB redirection channel number, eg. "usb-redir=2" --audio enable hda audio for guest vm with sub-parameters, eg. "--audio device=intel-hda,name=hda-audio,sink=alsa_output.pci-0000_00_1f.3.analog-stereo,timer-period=5000" sub-param: device=[device], set audio device, eg. "device=intel-hda" sub-param: name=[name], set audio device name, eg. "name=hda-audio" sub-param: server=[audio server], set audio server, eg. "unix:/run/user/1000/pulse/native" sub-param: sink=[audio sink], set audio stream routing. Use "pacmd list-sinks" to find available audio sinks sub-param: timer-period=[period], set timer period in microseconds (us), eg. "timer-period=5000"
-
Run the
start_all_windows.sh, Please be patient, it will take some time# on the host cd /home/$USER/sriov/scripts/setup_guest/win11 sudo ./start_all_windows.sh
- Download and Prepare Sdelete
- Obtain Sdelete from Microsoft SysInternals and unzip the package.
- Run Sdelete
-
Execute
sdelete.exein Command Prompt with the -z flag on the C: drivesdelete.exe -z C:\
- Backup the Disk Image
-
Convert the current disk image to a backup
# Please replace the <win11_image> with your actual image name qemu-img convert -O qcow2 <win11_image>.qcow2 <win11_image>.qcow2_backup
- Replace the Original Disk Image
-
Remove the original image and replace it with the backup
# Please replace the <win11_image> with your actual image name rm <win11_image>.qcow2 mv <win11_image>.qcow2_backup <win11_image>.qcow2