Windows guests — build ISOs including VirtIO drivers
Using Paravirtualized Block Drivers for Windows can dramatically improve Windows guest performance but installing them can be a bit of a fuss. This Tutorial shows you how you can inject all VirtIO drivers into all of your Windows install ISOs in one step using Windows® Automated Installation Kit and some batch files. This makes it really easy to deploy Windows with the most efficient hardware/driver configuration.
Contents
Prep Machine
- Launch a fast Windows 7 box and create a folder c:\tmp
- install AIK for Windows 7 (http://www.microsoft.com/en-us/download/details.aspx?id=5753)
- install an ISO editor such as UltraIso
- unpack File:Inject-virtio-drivers.zip batch files to c:\tmp
Prep and extract isos
- copy all your Windows ISOs to folders c:\tmp\win7, c:\tmp\win2008, c:\tmp\win8, c:\tmp\win2012, etc
- extract sources\boot.wim and sources\install.wim from each iso (e.g. by using UltraISO) and put them in the same folder as the iso
- get the latest virtio-win-x.x-xx.iso and extract the drivers into the VirtIO folder for each OS (e.g. WIN8\AMD64\*.* from the iso goes into c:\tmp\win8\VirtIO\ and into c:\tmp\win2012\VirtIO\)
Use AIK
- Start All Programs -> Microsoft Windows AIK -> Deployment Tools Command Prompt (Run as Administrator)
- check how many indices your install.wim has (e.g. dism /get-wiminfo /wimfile:c:\tmp\win2008\install.wim). Windows 2008 has up to 8 indices
- Set the variable IDX in each winxxxx-inject.bat to the number of indices you found in each install.wim (e.g. IDX=8)
- For each OS there is a SetupComplete.cmd. This script is always executed by the Windows installation as a final step. Make sure it contains the ballon service installer. You may add other commands to it.
Inject drivers and write wim files back to isos
- launch multiple winxxxx-inject.bat sequentially and uninterrupted, e.g.: winpe-inject.bat && win7-inject.bat etc.
- alternatively you can run multiple batch commands in parallel by launching multiple instances of «Deployment Tools Command Prompt» as Administrator
- for each iso use UltraISO to copy boot.wim and install.wim back to the sources folder of the ISO file
Example batch file win2012-inject.bat
Additional Info
Now that you have changed all your ISO files to include Paravirtualized drivers you no longer need IDE drives or a E1000 network adapter. Always select VirtIO for the Disk Controller and VirtIO when selecting a network card in the Creation Wizard.
Windows VirtIO Drivers
Contents
Introduction
VirtIO Drivers are paravirtualized drivers for kvm/Linux (see http://www.linux-kvm.org/page/Virtio). In short, they enable direct (paravirtualized) access to devices and peripherals for virtual machines using them, instead of slower, emulated, ones.
A quite extended explanation about VirtIO drivers can be found here http://www.ibm.com/developerworks/library/l-virtio.
At the moment these kind of devices are supported:
You can maximize performances by using VirtIO drivers. The availability and status of the VirtIO drivers depends on the guest OS and platform.
Windows OS Support
Windows does not have native support for VirtIO devices included. But, there is excellent external support through opensource drivers, which are available compiled and signed for Windows:
Note that this repository provides not only the most recent, but also many older versions. Those older versions can still be useful when a Windows VM shows instability or incompatibility with a newer driver version.
The binary drivers are digitally signed by Red Hat, and will work on 32-bit and 64-bit versions of Windows
Installation
Using the ISO
You can download the latest stable or you can download the most recent build of the ISO. Normally the drivers are pretty stable, so one should try out the most recent release first.
You can access the ISO can in a VM by mounting the ISO with a virtual CD-ROM/DVD drive on that VM.
Wizard Installation
You can use an easy wizard to install all, or a selection, of VirtIO drivers.
- Open the Windows Explorer and navigate to the CD-ROM drive.
- Simply execute (double-click on) virtio-win-gt-x64
- Follow its instructions.
- (Optional) use the virtio-win-guest-tools wizard to install the QEMU Guest Agent and the SPICE agent for an improved remote-viewer experience.
- Reboot VM
Manual Installation
- Open the Windows Explorer and navigate to the CD-ROM drive. There you can see that the ISO consists of several directories, each having sub-directories for supported OS version (for example, 2k19, 2k12R2, w7, w8.1, w10, . ).
- Balloon
- guest-agent
- NetKVM
- qxl
- vioscsi
- .
Downloading the Wizard in the VM
You can also just download the most recent virtio-win-gt-x64.msi or virtio-win-gt-x86.msi from inside the VM, if you have already network access.
Then just execute it and follow the installation process.
Paravirtualized Block Drivers for Windows
Contents
Introduction
In order to improve disk performance, special paravirtualized block drivers can be installed in Windows guests. You have to download and install those drivers in the VM, as Windows does not provides them by default.
Note: Proxmox recommends using SCSI with VirtIO SCSI as SCSI Controller Type for VM disks, to have the most features and best performance. VirtIO block may get deprecated in the future. DownloadYou can download the latest stable Windows VirtIO drivers from: https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso Older Windows Versions may sometimes need older VirtIO drivers. See Windows VirtIO Drivers for more info about the change log, guest OS compatibility and other useful VirtIO guest devices. Upload the ISO through the Proxmox VE WebUI: Select a Storage which allows ISO images in the PVE WebUI and switch to Content tab where you can use the «upload» button on the menu bar. You may also copy the ISO manually onto a PVE configured storage. InstallationThe goal to use VirtIO SCSI or Block (SCSI is recommended) to improve the performance and available features of (Windows) VMs. The way we do this depends if we want to change an already installed and running Windows VM or if we want to set this up during a Windows installation. Setup On Running WindowsHere we add a temporary disk with the new wanted disk controller to the VM and install the respective drivers. The Windows OS in your VM knows nothing about VirtIO drivers, so you can’t simply stop the VM, change the disk to Vrtio-SCSI or VirtIO and reboot. You have to force Windows to install VirtIO drivers during it runs. To do this we add a small temporary SCSI-VirtIO or VirtIO disk to the VM and install its drivers explicitly. Without adding the Disk the installation of the driver is flawed under Windows, as driver installation of an not plugged in Hardware does not works. Tested guest OS
Setup Steps
You should now be able to enter Windows «Disk Management» and format the temporary SCSI/VirtIO disk (this is not necessary, it just proves that the driver is installed and working). (Legacy Note: Windows 2000 may report each disk 8 times in disk management, just install and use the first of each 8-tuple. In «My computer» you should see each disk only once.) Windows has now the VirtIO SCSI/Block driver installed, and we need to re attach the VM disks as SCSI or virtio.
After finishing, through PVE web interface, you can:
Setup During Windows InstallationDownload the VirtIO drivers as described above. Set the drive type to SCSI (preferred) or VirtIO and the Network also to VirtIO for improved performance. Add a second IDE CDROM drive, in the first mount the Windows installer ISO and in the second the VirtIO driver ISO. Startup the VM and the Installation process. When you arrive at the Disk/Partition selection you won’t see a Disk because the driver aren’t loaded. Click on the Load Driver button and then Browse. In the file browser select the second CDROM drive with the VirtIO drivers and navigate to the vioscsi/WINVERSION/amd64 (or x86 if you have a 32 bit system) and click OK. RedHat driver should show up in the Driver Installer click next to install them. Repeat the process for other VirtIO driver (e.g. network, qxl, . ). The Disks should now show up and you can continue with the installation process as usual. Old VFD MethodNote: This is kept for legacy reasons, newer Windows versions (XP and newer) should use the above menthod. You can add the block drivers during install by manually adding a virtual floppy drive (vfd) and a second IDE CDROM Drive (for network VirtIO) to the VM for the initial install (thanks to meto & user100 in the forum). Download the VirtIO drivers as described above, upload VFD (for disks) and the ISO (for network) to PVE. to add the VFD as virtual floppy to the VM. Now start the VM and open the console. The standard boot sequence for a new KVM seems to be HDD — Floppy — CD, you can change this but it’s just as easy to reboot using the Ctrl-Alt-Del button in the console, use F12 to bring up a boot selection window & boot from CD. Once windows starts to load, press F6 to get it to look for extra drivers to load. It will automatically load the floppy & away you go. Note that older VirtIO drivers aren’t signed by Windows, so you need to tell the system to continue to load the drivers on a warning. |