KVM uses Virtio to drive Windows Server virtual machines

Source: Internet
Author: User
Tags ide hard drive

KVM installation Windows uses the QEMU virtualized IDE hard drive mode by default, in which case the IO performance is relatively low, and if you use Virtio, you can improve the performance of virtual machine IO. The Virtio-driven network card also expands the original hundred megabytes to gigabit. Here's a quick introduction to installing Windows Server 2008 using the Virtio driver. Other Windows versions operate the same, just select the corresponding driver.


Installing the window virtual machine using Virtio

KVM installation Windows requires the use of Virtio drivers:

Https://fedoraproject.org/wiki/Windows_Virtio_Drivers#Direct_download


To install the virtual machine steps:

1, install Virtio drive:

wget Https://fedorapeople.org/groups/virt/virtio-win/virtio-win.repo-O/etc/yum.repos.d/virtio-win.repo
Yum Install Virtio-win-y

2. Check the driver provided by Virtio-win:

RPM-QL Virtio-win | grep Iso/usr/share/virtio-win/virtio-win-0.1.126.iso/usr/share/virtio-win/virtio-win.iso

3. Install Windows:

Create a virtual machine disk:

Qemu-img create-f qcow2 win-2c8g150g.img 150G

To install a virtual machine using the Virtio driver:

Virt-install-n win-2c8g150g--vcpus=2--ram=8192--os-type=windows--os-variant=win2k8-c/vm/iso/cn_windows_server_ 2008_r2_sp1_x64.iso--disk path=/usr/share/virtio-win/virtio-win-0.1.126_amd64.vfd,device=floppy--disk path=/vm/ Win-2c8g150g.img,format=qcow2,bus=virtio--graphics vnc,listen=0.0.0.0--noautoconsole

Tip: Here is the use of floppy mode loading, if the mirror and driver are loaded using CDROM, in some cases the system will not find the boot image, resulting in the failure to start. The loaded drivers have x86 and AMD64 two types, and the 64-bit system selects AMD64. 32 Select x86 for the system.

4, the installation process, in the selection of disk interface will not find the disk, select "Load Driver", "Browse", find "floppy disk drive", click to select "Server 2008" to determine, after the driver loading is complete, the disk appears, continue to install.


5, after the installation is complete, you can see that the virtio is used in Device Manager:

650) this.width=650; "src=" https://s5.51cto.com/wyfs02/M01/9D/F3/wKiom1mJM9vToPJuAAF7LT_WF-M343.jpg "title=" 1111. JPG "alt=" wkiom1mjm9vtopjuaaf7lt_wf-m343.jpg "/>




Adding Virtio drivers to installed KVM virtual machines


If you are installing in a traditional IDE hard disk mode, you can use the following command:

Virt-install--virt-type KVM--name win-2c8g100g--ram 8192-vcpus=2-s 100-c/vm/iso/cn_windows_server_2008_r2_sp1_x6 4.iso--os-type=windows-f/vm/win-2c8g100g.img--graphics vnc,listen=0.0.0.0--noautoconsole


To use the Virtio driver after installation, you can choose to load the Virtio-driven ISO file to the virtual machine CD drive:

Virsh attach-disk win-2c8g100g/usr/share/virtio-win/virtio-win.iso HDB--type CDROM

or use the following command:

Virsh Change-media win-2c8g100g Hdb/usr/share/virtio-win/virtio-win.iso

Reference Link: Https://superuser.com/questions/239870/change-cd-rom-via-virsh


Modify the virtual machine's XML file so that it can discover the Virtio type of device, otherwise the driver cannot install:

Add a piece of Virtio drive:

Qemu-img create-f qcow2 test.img 1G

Modify the virtual machine's XML file and add a test disk configuration to the original "Disk type" area:

<disk type= ' file ' device= ' disk ' > <driver name= ' qemu ' type= ' qcow2 '/> <source file= '/vm/test.img '/&      Gt <target dev= ' vdb ' bus= ' virtio '/> </disk>

Modify the Model type= ' Virtio ' in the interface type area by modifying the network card types Virtio:

<interface type= ' bridge ' > <mac address= ' 52:54:00:39:f9:60 '/> <source bridge= ' br0 '/> <m Odel type= ' Virtio '/>

Tip: If you do not use VNC remote connection, you need to add a network card configuration, before the installation of the driver, using the above configuration, the virtual machine is off-network state.

After the modification is complete, restart the virtual machine:

Virsh shutdown Win-2c8g100gvirsh Start win-2c8g100g


After entering the virtual machine, after successfully adding the ISO driver, go to the Device Manager interface of the virtual machine and update the corresponding driver in "System device":

The update driver needs to find the corresponding file in Virtio-win.iso on the mounted CD. There are four drivers in the drive image, and their corresponding relationships are:

  • Balloon, the balloon driver, affects the PCI standard RAM Controller in the System devicesGroup.

  • vioserial , the serial driver, affects The  PCI Simple communication Controller  in the  System devices   Group.

  • NETKVM , the network driver, affects The  network adapters  group. This driver are only available if a virtio NICs is configured. Configurable parameters for this driver is documented in appendix a,  NETKVM driver Parameters .

  • viostor, the block driver, affects the Disk drives group. This driver are only available if a Virtio disk is configured.

Reference Links:

Https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Virtualization_Host_ Configuration_and_guest_installation_guide/form-virtualization_host_configuration_and_guest_installation_ Guide-para_virtualized_drivers-mounting_the_image_with_virt_manager.html



If you cannot find the corresponding device in the English description, use the following method:

Add Virtio driver to unknown device, 650) this.width=650; "Src=" Https://s4.51cto.com/wyfs02/M00/9D/F9/wKiom1mJcb7QkcQhAAGRHg_ Cpee735.jpg "title=" 333.jpg "alt=" Wkiom1mjcb7qkcqhaagrhg_cpee735.jpg "/>

After the driver is installed:

650) this.width=650; "src=" https://s4.51cto.com/wyfs02/M00/9D/F8/wKioL1mJcg7Sjv5TAAGNZdlc8LI143.jpg "title=" 444. JPG "alt=" wkiol1mjcg7sjv5taagnzdlc8li143.jpg "/>

Successful installation of the corresponding disk driver:

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M02/9D/F9/wKiom1mJcnTDxwC4AAHyf7OtQOM892.jpg "title=" 222. JPG "alt=" wkiom1mjcntdxwc4aahyf7otqom892.jpg "/>

At this point the Virtio driver is added, modify the virtual machine's XML file, delete the test.img virtual disk configuration, modify the Startup disk drive type:

<disk type= ' file ' device= ' disk ' > <driver name= ' qemu ' type= ' qcow2 '/> <source file= '/vm/win-2c8g100  G.img '/> <target dev= ' vda ' bus= ' virtio '/> <address type= ' pci ' domain= ' 0x0000 ' bus= ' 0x00 ' slot= ' 0x07 ' function= ' 0x0 '/> </disk>

Restart the virtual machine.


Reference Links:

https://access.redhat.com/solutions/17463

Https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Virtualization_Host_ Configuration_and_guest_installation_guide/form-virtualization_host_configuration_and_guest_installation_ Guide-para_virtualized_drivers-installing_with_a_virtualized_floppy_disk.html

Https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Virtualization_Host_ Configuration_and_guest_installation_guide/form-virtualization_host_configuration_and_guest_installation_ Guide-para_virtualized_drivers-mounting_the_image_with_virt_manager.html

http://blog.csdn.net/ks_is_fighting/article/details/38358793

This article is from the "Trying" blog, make sure to keep this source http://tryingstuff.blog.51cto.com/4603492/1954531

KVM uses Virtio to drive Windows Server virtual machines

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.