FeaturesWP CloudPricingEE CLIContactMy Account

Features

Team Access & User Permissions

Server Setup & Management

Site Creation & Management

Deployments & Developer Tools

Firewall Protection

Speed & Caching

Backups & Recovery

Logs & Monitoring

Create WP Cloud Sites

All Features

Read Documentation

Install

Installation Guide

FAQ

Roadmap

Explore EE CLI

Resources

Commands

Handbook

Blog

Community

Forum

EasyExperts

Tutorials

Subscribe

Github

CLEAR

Start For Free

separator Tutorials separator KVM separator Enable virtio for existing VM’s

Topics

On this page

Backup VM config

Edit VM Config

Changes to Guest VM's filesystem

For changes to reflect

Enable virtio for existing VM’s

On one of our host machine, we get around 70MB/second disk write speed, but KVM guest machine was giving us around 18MB/s write performance.

At that point we came to know about virtio driver. Here is guide to enable virtio

Backup VM config


			virsh dumpxml <vmname> > ~/vmname.xml
		

Replace vmname with Virtual Machine (Domain) name. You can find correct name by running virsh list --all

Edit VM Config

Run following command to open editor.


			virsh edit <vmname>
		

Find lines like below:


			<disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/ubuntu-kvm/tmpU2z98r.qcow2'/>
      <target dev='hda' bus='ide'/>
      <address type='drive' controller='0' bus='0' unit='0'/>
    </disk>
		

Make following changes:

  1. Replacehda withvda ANDide with virtio
  2. Remove following line: <address type='drive' controller='0' bus='0' unit='0'/>
  3. Add cache='none' io='native' option to driver.

Your update config will look like below:


			<disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='none' io='native'/>
      <source file='/var/lib/libvirt/images/ubuntu-kvm/tmpU2z98r.qcow2'/>
      <target dev='vda' bus='virtio'/>
    </disk>
		

Save your changes and exit editor.

Changes to Guest VM’s filesystem

I am not sure if this step is necessary but one tutorial mentions this. I did not try outcome without this step as VM’s I was playing with has some critical data.

Anyway, login to Guest VM’s shell and open in editor vim /etc/fstab

Fine lines like /dev/sdX. Replace 's' with 'v'.

So /dev/sda1 will become /dev/vda1 and /dev/sda2 will become /dev/vda2 and so on.

For changes to reflect

Shutdown Guest VM for its shell. You can use command shutdown 0

Next, from Host machine, run following commands:


			virsh destroy <vmname>
virsh start <vmname>
		

virsh reboot won’t work.

At this point you can run your disk I/O benchmarks again to check speed.

In our case performance shoot-up from 18MB/s to 40.8 MB/s.

Convert qcow2 to raw format

PREVIOUS

Mac

NEXT


Comments

  1. shrijan Avatar

    shrijan

    February 23, 2014

    Hi

    Am using KVM in linux. My guest is windows 7. I had a problem windows 7, so i deleted it and left the virtio disk Windows7-KVM.qcow2 untouched.

    After that i build one more vm “Virtual_Client_for_Linux_Windows_7-KVM”, whose virtio disk is Virtual_Client_for_Linux_Windows_7-KVM.qcow2.

    Now added the “Windows7-KVM.qcow2” to my new virtual machine through virt-manager, but once virtual machine boots up, am not able to see the newly added “Windows7-KVM-qcow2”.

    Below is the xml configuration of new vritual machine “Virtual_Client_for_Linux_Windows_7-KVM” for two disk:

    <disk type='file' device='disk'> <driver name='qemu' type='qcow2' cache='writeback'/> <source file='/var/lib/libvirt/images/Virtual_Client_for_Linux_Windows_7-KVM.qcow2'/> <target dev='vda' bus='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/> </disk> <disk type='file' device='disk'> <driver name='qemu' type='qcow2' cache='writeback'/> <source file='/var/lib/libvirt/images/Windows7-KVM.qcow2'/> <target dev='vdb' bus='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/> </disk>

    Could you let me know, why its not detecting new disk.

    1. Rahul Bansal Avatar

      Rahul Bansal

      February 26, 2014

      Sorry. I won’t be able to help with this as I haven’t used Windows in long time.

Features

Useful Links

Product

Other Products

Subscribe for curated product updates, tips, and announcements.

"*" indicates required fields

Phone

This field is for validation purposes and should be left unchanged.

Email*

SIGN ME UP

Δ


© rtCamp, since 2009. All rights reserved.

Powered by