KVM under Windows virtual machine using Virtio driver

Source: Internet
Author: User

The default disk for the Windows virtual machine under KVM is the QEMU IDE hard disk, which defaults to the RTL8139 network card. In order for the KVM host to be more efficient in the same configuration, the NIC and disk can be replaced with the Virtio driver.

Windows Virtio driver mainly includes network card and disk drive, mainly in three ways, the first is the existing Windows operating system, need to update the driver, the second is the installation of the Virtio driver, the third is to directly make Virtio drive ISO system image.

One: Update Virtio driver

1. Modify the XML file

Raw XML file

<disk type= ' file ' device= ' disk ' >
<driver name= ' qemu ' type= ' qcow2 ' cache= ' writeback '/>
<source file= '/polydata/image/winxp_sp2.qcow2 '/>
<target dev= ' hda ' bus= ' ide '/>
<address type= ' drive ' controller= ' 0 ' bus= ' 0 ' target= ' 0 ' unit= ' 0 '/>
</disk>

<interface type= ' bridge ' >
<mac address= ' 52:54:00:33:a4:19 '/>
<source bridge= ' br0 '/>
<model type= ' rtl8139 '/>
<address type= ' PCI ' domain= ' 0x0000 ' bus= ' 0x00 ' slot= ' 0x03 ' function= ' 0x0 '/>
</interface>

Enter the command Virsh edit winxp_sp2 Modify the following

<disk type= ' file ' device= ' disk ' >
<driver name= ' qemu ' type= ' qcow2 ' cache= ' writeback '/>
<source file= '/polydata/image/winxp_sp2.qcow2 '/>
<target dev= ' hda ' bus= ' ide '/>
<address type= ' drive ' controller= ' 0 ' bus= ' 0 ' target= ' 0 ' unit= ' 0 '/>
</disk>
<disk type= ' file ' device= ' cdrom ' >
<driver name= ' qemu ' type= ' raw '/>
<source file= '/tmp/virtio-win-0.1.96.iso '/>
<target dev= ' hdc ' bus= ' IDE '/>
<readonly/>
<address type= ' drive ' controller= ' 0 ' bus= ' 1 ' target= ' 0 ' unit= ' 0 '/>
</disk>
<disk type= ' file ' device= ' disk ' >
<driver type= ' qcow2 ' cache= ' writeback '/>
<source file= '/tmp/test.img '/>
<target dev= ' vdc ' bus= ' Virtio '/>
</disk>
<interface type= ' bridge ' >
<mac address= ' 52:54:00:33:a4:19 '/>
<source bridge= ' br0 '/>
<model type= ' Virtio '/>
<address type= ' PCI ' domain= ' 0x0000 ' bus= ' 0x00 ' slot= ' 0x03 ' function= ' 0x0 '/>
</interface>

In fact, the original disk does not have to be modified, only need to add virtio-win.iso cdrom, virtio type of temporary disk, and the network card to modify the Virtio type.

2. Create disk: qemu-img create–f qcow2/tmp/test.img 1G, copy driver to/tmp/virtio-win-0.1.96.iso, drive https://fedoraproject.org/wiki/ Windows_virtio_drivers, you can open https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/archive-virtio/ Download different versions of the driver

3. Update Driver: Virsh start WINXP_SP2, using VNC connection, the system will prompt to find new hardware, pop-up windows (SCSI and network card) installation, try not to automatically search, but manually search, different operating system path is as follows:

Disk Card
Xp Viostor\xp\x86\viostor.inf Netkvm\xp\x86\netkvm.inf
2k3 Viostor\2k3\x86\viostor.inf Netkvm\2k3\x86\netkvm.inf
Win7 Viostor\w7\x86\viostor.inf Netkvm\w7\x86\netkvm.inf

If it is a 64-bit OS, look for the AMD64 corresponding folder, the older driver directory structure a little change, as shown below

Where WLH corresponds to win2008,wnet corresponding WIN2003,WXP corresponding Xp,xp folder contains only XP network card driver

Note 1: If the Automatic Update Driver dialog box does not pop up after the virtual machine is turned on, right click on My Computer--management----Device Manager, you will see an exclamation point of SCSI and network card, right click Update Driver, follow the above steps to update the Virtio driver.

Note 2: For the XP system Virtio-win driver version is very important, the beginning of the installation is not successful because the driver version information is not correct, if the installation process is slow is basically the driver version is not correct, change the driver test, tested, for the XPSP2/XPSP3 operating system, The virtio-win-0.1.96 version is available, and the stable version virtio-win-0.1.102 is available for WIN7SP1 operating systems.

4. Close the virtual machine, Virsh edit winxp_sp2 Modify the XML file, delete the CDROM and temporary loaded disk content, the original disk content is modified as follows

<disk type= ' file ' device= ' disk ' >
<driver name= ' qemu ' type= ' qcow2 ' cache= ' writeback '/>
<source file= '/polydata/image/winxp_sp2.qcow2 '/>
<target dev= ' Vda ' bus= ' Virtio '/>
<address type= ' PCI ' domain= ' 0x0000 ' bus= ' 0x00 ' slot= ' 0x05 ' function= ' 0x0 '/>
</disk>

5. Start the virtual machine to discover that both the disk and NIC drivers are updated

Reference:http://wenku.baidu.com/link?url=g2-zybvadyeq1xorn0b0test-hsmvvbrhxp4a4adejjhoikvon0jbi3bpwkj01s_ Mixsjvuvzozscmdlupwjjm4p0-wwbhj3ebgvmnbpbmy

II: Load Virtio driver during installation

1.xp/2k3

1.1 New disk image qemu-img Create-f qcow2/polydata/image/winxp_sp2_backup.qcow2 10G

1.2 Preparing the drive diskette (/TMP/VIRTIO-WIN-0.1.96_X86.VFD) and the system ISO installation file (/tmp/xpsp2_netkvm.iso, preferably an image that has been integrated with the Virtio NIC driver)

1.3 Installing the System
Virt-install--virt-type KVM--name winxp_sp2_backup--ram--os-type=windows--os-variant=winxp--disk path=/ Polydata/image/winxp_sp2_backup.qcow2,format=qcow2,bus=virtio,cache=writeback--disk path=/tmp/virtio-win-0.1.96 _x86.vfd,device=floppy--network bridge=br0,model=virtio--cdrom=/tmp/xpsp2_netkvm.iso--graphics vnc,listen= 0.0.0.0–noautoconsole

You need to set--os-variant to Win2k3 when installing the 2K3 system

1.4 VNC connection, after the virtual machine up press F6, pop up the following interface

Input s, select the appropriate SCSI device (Virtio)

Then press ENTER twice to OK. The rest is the general operating system installation procedures, no longer repeat.

The installation finishes as follows

2.win7

1.1 New disk image qemu-img Create-f qcow2/polydata/image/win7_sp1_backup.qcow2 20G

1.2 Preparing the drive CD (/TMP/VIRTIO-WIN-0.1.102) and the system ISO installation file (/TMP/WIN7SP1.ISO)

1.3 Installing the System
Virt-install--virt-type KVM--name win7_sp1_backup--ram 1024x768--os-type=windows--os-variant=win7--disk path=/polydata /image/win7_sp1_backup.qcow2,bus=virtio,format=qcow2,cache=writeback--network Bridge=br0,model=virtio--cdrom=/ Tmp/win7sp1.iso--disk path=/tmp/virtio-win-0.1-102.iso,device=cdrom--graphics vnc,listen=0.0.0.0--noautoconsole

1.4 VNC Connection, eject the following installation interface

Using the Virtio interface of the hard drive, we must load the virtio hard drive. If you do not load the drive Windows Installer will not be able to find the virtual disk, click Load Driver, browse, select the Virtio Drive CD, find the corresponding version driver under VioStor,

Click Next, install the Virtio disk drive, and then more out of a hard disk, while installing the Virtio driver of the NIC

The rest is the general operating system installation procedures, no longer repeat. The effect is as follows:

Reference:http://www.mamicode.com/info-detail-126255.html

III: Make ISO system image of Virtio Drive

This method mainly uses NLite (XP/2K3) and DISM (win7/20008 ... ) tool, see Https://miefen.com/201405/how-to-install-virtio-drivers-for-windows

Follow the tutorial using NLite to add the disk and network card Virtio driver, but the installation is always prompted to find no SCSI driver, driver version is also used Virtio-win-0.1.96.iso. But someone made a merit (using the Virtio-win-0.1-74.iso), I try not to.

KVM under Windows virtual machine using Virtio driver

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.