Mega Optimising Disk I/O for Windows Guests on KVM

  1. jimbo45's Avatar
    Posts : 10,491
    Windows / Linux : Arch Linux
       #1

    Mega Optimising Disk I/O for Windows Guests on KVM


    Hi folks
    Two ways -- pass the pci device of say the SSD or whatever to your Windows Guest - then use Native file system
    If you can't pass the pci device then create a virtio disk - then before booting up change the xml for that disk to :

    <disk type="file" device="disk">
    <driver name="qemu" type="raw" cache="none" io="native"/> "This line only -- leave every thing else !!!!
    <source file="/mnt/DV2/XPVIORAW"/>
    <target dev="vdb" bus="virtio"/>
    <address type="pci" domain="0x0000" bus="0x00" slot="0x0a" function="0x0"/>
    </disk>

    The RAW and native I/O file is the key -- then on ist boot of the VM use DISKPART windows command to format the disk and assign a letter and then use any live linux distro (can be 64 bit OS for this purpose) with dd command to clone existing disk to new one if you want to use that as your Windows OS disk. the disk will be /dev/vda /dev/vdb . You can also use Macrium stand alone bootable iso provided it has the virtio drivers in it - that's why probably better to use Linux live iso for cloning.

    (If you use the GUI virtual machine manager just enable xml editing and open the XML section for the disk if you don't like virsh command line - probably better to use the GUI if you are relative beginners at this).

    Mega Optimising Disk I/O for Windows Guests on KVM-screenshot_20210323_092736.png

    For Windows 10 using Macrium to clone to RAW (Native FS) HDD

    Mega Optimising Disk I/O for Windows Guests on KVM-screenshot_20210323_112236.png

    BTW for people using XP VM's the easiest way to clone a disk is to boot any current linux iso (the bios will support 64 bit virtual OS) from WITHIN the GUEST, note you have to add the cd as a SATA cd rom on the VM -- boot it, clone your HDD,
    shut down the VM , remove the sata CD rom and the sata controller and now boot from the relevant HDD --remove the original one.

    here's the clone process of the XP virtual disks using a Fedora live iso image set as boot device from the XP VM -- doesn't matter that it's 64 bit OS. The HDD's show up as vda and vdb.

    Mega Optimising Disk I/O for Windows Guests on KVM-screenshot_20210323_105813.png

    For XP printing - install win2pdf printer - still works on XP and print to pdf file (FF handles pdf OK to view in XP) then print pdf on host or a W10 VM with modern laser printer driver or whatever.

    Mega Optimising Disk I/O for Windows Guests on KVM-screenshot_20210323_160728.png

    I think I've re-jigged XP enough now to keep it useful for a few more years for those who need to use it for all sorts of reasons -- legacy games work fine too if you are in that sort of thing.

    KVM has come such a long way these days and on modern kernels it runs rings around HYPER-V (on a Non server edition of a Windows Host), VBOX and VMWare too. You can also experiment by running any Linux as a VM on whatever Windows you like and then enabling KVM to try nested VM just to "have a go with it" .

    It's 100% free as well - and really obsoleting things now like CITRIX and XEN.

    Also you don't need poor I/O pergormance any more on Windows VM's - whether or not you pass thru a whole HDD or use "Raw Native " Virtual disks.

    Cheers
    jimbo
    Last edited by jimbo45; 4 Weeks Ago at 11:37. Reason: added info about cloning the virtual disks especially on XP
      My Computer

  2. Hopachi's Avatar
    Posts : 1,168
    Linux: Fedora 33 64-bit / Windows 10 Pro 64-bit in VM
       #2

    Thanks for posting this.
    I'll try it on new disks with raw but it seem to improve my exisiting qcow2 as well.
    I did a P2V conversion, via Macrium Reflect, from my old Win10 host and put in under QEMU/KVM. I'm late for the type="raw" for this disk since I made a type="qcow2". But I was already using cache="none" since I read that somewhere after I noticed bad performance. But your mention of io="native" is interesting: so I've applied it on qcow2 and it improves the performance a bit further.
    Nice!

    EDIT:
    I see it depends on what the defaults are, varies per host:
    7.3. I/O Mode Red Hat Enterprise Linux 7 | Red Hat Customer Portal
    Better to choose io manually then to make sure you are indeed using "native".
      My Computers


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd
All times are GMT -5. The time now is 12:39.
Find Us




Windows 10 Forums