Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

unRAID 6 Beta 6: VM Quick Start Guide (KVM / Xen)

Featured Replies

I was looking to move my Win7, Win8 and Pfsense VM's over from XEN to KVM but i think i'm just going to recreate them from scratch as KVM machines. I've got pretty good at creating XEN .cfg files with PCI pass through but this will be my first KVM .xml. Can anyone post and example of a full KVM .xml with PCI pass through so that i can use it as a guide? I've had a look through the forums but i havnet been able to find an example with pass through.

 

Thanks

 

I posted an XML file for Win8 a couple pages back. Using the one on the first post won't work will with Windows due to mouse tracking.

 

I converted my XEN images for KVM but the Xen drivers installed in the image caused it to bluescreen at boot.

  • Replies 87
  • Views 39.5k
  • Created
  • Last Reply

Ok I've got a basic machine up and running but how do i pass through a pcie card. My XEN version of this machine has "pci = ['02:00.0']" in it's config, whats the equivalent of this in kvm?

Ok I've got a basic machine up and running but how do i pass through a pcie card. My XEN version of this machine has "pci = ['02:00.0']" in it's config, whats the equivalent of this in kvm?

I was trying to find this out as well.    I was also wondering if there as an equivalent to the xen-pciback.hide entries to go into the syslinux.cfg file as I am interested in passing through the built in GPU so do not want it to not be used by unRAID as a console.

I can post some info in the KVM thread about syslinux and windows.xml file.

 

EDIt

 

I have posted info about KVM & W8.1 pass trough.

 

 

iGPU will not work in this beta

 

//Peter

iGPU will not work in this beta

Since that is what I want to try and achieve for a Windows VM I guess I need to wait for the next beta (assuming the issues is fixed by then)

iGPU will not work in this beta

Since that is what I want to try and achieve for a Windows VM I guess I need to wait for the next beta (assuming the issues is fixed by then)

 

I'm in the exact same boat!  fingers crossed it's no too much longer, and that they've nailed the iGPU passthru for next beta (last I heard, they still didn't have it working reliably)

hey jonp, just created my first windows vm using kvm, got tripped up on your example xml, as i had created a qcow2 image but the default xml is set for raw img files, might be worth adding this into the OP example xml?.

hey jonp, just created my first windows vm using kvm, got tripped up on your example xml, as i had created a qcow2 image but the default xml is set for raw img files, might be worth adding this into the OP example xml?.

 

Would you care to share your xml?  I'm having no luck doing this myself :(

hey jonp, just created my first windows vm using kvm, got tripped up on your example xml, as i had created a qcow2 image but the default xml is set for raw img files, might be worth adding this into the OP example xml?.

 

Would you care to share your xml?  I'm having no luck doing this myself :(

 

If I was you...

 

Forget libvirt for now.

 

There isn't a lot of info on libvirt XML files on the web and it's more complicated without a webGUI.

 

My advice...

 

You will find TONS of info / examples if you go the QEMU route instead. It's easier to read and can make quick changes to the command line to test it out. Plus, Libvirt is converting all the XML stuff to the qemu code below anyway. Figure it out in QEMU first and then convert the QEMU code to Libvirt using the convertor (or just put your working QEMU code in your go file to start up on boot).

 

Example:

 

qemu-system-x86_64 -enable-kvm -M q35 \
-m 8196 -mem-prealloc -mem-path /mnt/hugepages \
-cpu Opteron_G5 \
-smp 4,sockets=1,cores=2,threads=2 \
-bios /root/kvm-vga-passthrough/vfio-post3.13/seabios/seabios/out/bios.bin -vga none \
-boot order=cd,menu=on \
-device ioh3420,bus=pcie.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1 \
-device vfio-pci,host=04:00.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on \
-device vfio-pci,host=00:1d.0,bus=root.1,addr=00.1 \
-device vfio-pci,host=00:1b.0,bus=root.1,addr=00.2 \
-device ahci,bus=pcie.0,id=ahci \
-net nic,model=virtio -net bridge,br=br0
-device virtio-net-pci,netdev=hostnet0,id=net0 \
-drive file=/var/lib/libvirt/images/ubuntu_1404_x64-disk01.qcow2,id=disk,format=qcow2 -device ide-hd,bus=ahci.0,drive=disk \
-drive file=/var/lib/libvirt/images/ubuntu-14.04-desktop-amd64.iso,id=isocd -device ide-cd,bus=ahci.2,drive=isocd

Here is my Win8 XML file. Note my bridge is "br0". I added USB to the profile to get the mouse to track properly in VNC.

 

<domain type="kvm">
<name>Win8</name>
	<uuid>d9fce53d-a056-4096-a05a-a79c2f852df9</uuid><!-- uuidgen -->
<memory unit="GB">2</memory>
<currentMemory unit="GB">2</currentMemory>
<vcpu>2</vcpu>
<os>
	<type arch="x86_64" machine="q35">hvm</type>
	<loader>/usr/share/qemu/bios-256k.bin</loader>
	<boot dev="cdrom" />
</os>
<features>
	<acpi />
</features>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
	<disk type="file" device="disk">
		<driver name="qemu" type="qcow2" />
		<source file="/mnt/vm/Win8/Win8.qcow2" />
		<target dev="vda" bus="virtio" />
	</disk>
	<disk type="file" device="cdrom">
		<source file="/mnt/vm/setup/Win8.1_64bit.iso" />
		<target dev="hdc" bus="usb" />
		<readonly />
	</disk>
	<disk type="file" device="cdrom">
		<source file="/mnt/vm/setup/virtio-win-0.1-81.iso" />
		<target dev="hdd" bus="usb" />
		<readonly />
	</disk>
	<graphics type="vnc" port="5902">
		<listen type="address" address="0.0.0.0" />
	</graphics>
	<interface type="bridge">
		<source bridge="br0" />
		<mac address='52:54:00:00:00:00'/>
	</interface>
	<emulator>/usr/bin/qemu-system-x86_64</emulator>
	<!-- <input type='mouse' bus='ps2' /> -->
	<controller type='usb' index='0' model='ich9-ehci1'>
		<address type='pci' domain='0' bus='0' slot='4' function='7'/>
	</controller>
	<controller type='usb' index='0' model='ich9-uhci1'>
		<master startport='0'/>
		<address type='pci' domain='0' bus='0' slot='4' function='0' multifunction='on'/>
	</controller>
	<hub type='usb'>
		<address type='usb' bus='0' port='1'/>
	</hub>
	<input type='tablet' bus='usb'/>
	<memballoon model="virtio" />
</devices>
</domain>

hey jonp, just created my first windows vm using kvm, got tripped up on your example xml, as i had created a qcow2 image but the default xml is set for raw img files, might be worth adding this into the OP example xml?.

If I was you...

Forget libvirt for now.

There isn't a lot of info on libvirt XML files on the web and it's more complicated without a webGUI.

My advice...

 

Example:

 

qemu-system-x86_64 -enable-kvm -M q35 \
-m 8196 -mem-prealloc -mem-path /mnt/hugepages \
-cpu Opteron_G5 \
-smp 4,sockets=1,cores=2,threads=2 \
-bios /root/kvm-vga-passthrough/vfio-post3.13/seabios/seabios/out/bios.bin -vga none \
-boot order=cd,menu=on \
-device ioh3420,bus=pcie.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1 \
-device vfio-pci,host=04:00.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on \
-device vfio-pci,host=00:1d.0,bus=root.1,addr=00.1 \
-device vfio-pci,host=00:1b.0,bus=root.1,addr=00.2 \
-device ahci,bus=pcie.0,id=ahci \
-netdev bridge,br=br0,id=hostnet0 \
-device virtio-net-pci,netdev=hostnet0,id=net0 \
-drive file=/var/lib/libvirt/images/ubuntu_1404_x64-disk01.qcow2,id=disk,format=qcow2 -device ide-hd,bus=ahci.0,drive=disk \
-drive file=/var/lib/libvirt/images/ubuntu-14.04-desktop-amd64.iso,id=isocd -device ide-cd,bus=ahci.2,drive=isocd

I started over again and look at qemu config files, that I was using before Libvirt

 

but with your example I got this error when creating the ethernet interface

 

root@tower:/mnt/vm_disk/KVM/ArchVM# ./arch.sh
failed to parse default acl file `/etc/qemu/bridge.conf'
failed to launch bridge helper
qemu-system-x86_64: -netdev bridge,br=br0,id=hostnet0: Device 'bridge' could not be initialized

 

Do you now what is missing in your example? would be great if we could solve this :-)

 

//Peter

 

nice posts guys!, ok here is my xml, this does NOT include any sort of passthrough, tweaks from the example xml file in OP by jonp:-

 

1. changed disk reference from raw img to qcow2

2. added in virtio for vnic and specify mac address

3. added in usb devices and changed mouse to usb - thanks jbarlett!

4. changed cdrom from ide to sata and added in secondary cdrom to mount virtio drivers on install (prevent arsing about unmounting and re-mounting during install)

 

<domain type='kvm'>

<name>windows-8-1-pro</name>
<uuid>554cbf6b-aa75-4044-b1b3-c1005bea6062</uuid>

<memory unit='GB'>3</memory>
<currentMemory unit='GB'>3</currentMemory>

<vcpu>4</vcpu>

<os>
	<type arch='x86_64' machine='q35'>hvm</type>
	<loader>/usr/share/qemu/bios-256k.bin</loader>
	<boot dev='cdrom'/>
</os>

<features>
	<acpi/>
</features>

<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>

<devices>

	<emulator>/usr/bin/qemu-system-x86_64</emulator>

	<!-- VIRTUAL DISK (QCOW2)-->
	<disk type='file' device='disk'>
		<driver name='qemu' type='qcow2'/>
		<source file='/mnt/cache/cache-only/vms/windows/windows-8-1/windows-8-1-pro.qcow2'/>
		<target dev='vda' bus='virtio'/>
	</disk>

	<!-- VIRTUAL CD-ROM OS (ISO) -->
	<disk type='file' device='cdrom'>
		<source file='/mnt/cache/cache-only/vms/windows/windows-8-1/en-gb_windows_8_1_x64_dvd_2707421.iso'/>
		<target dev='hda' bus='ide'/>
		<readonly/>
	</disk>

	<!-- VIRTUAL CD-ROM VIRTIO (ISO) -->
	<disk type='file' device='cdrom'>
		<source file='/mnt/cache/cache-only/vms/windows/windows-8-1/virtio-win-0.1-81.iso'/>
		<target dev='hdb' bus='sata'/>
		<readonly/>
	</disk>

	<graphics type='vnc' port='5900'>
		<listen type='address' address='0.0.0.0'/>
	</graphics>

	<!-- VIRTUAL NETWORKING VIRTIO -->	
	<interface type='bridge'>
		<mac address='52:54:00:f8:2e:8e'/>
		<model type='virtio'/>
		<source bridge='xenbr0'/>
	</interface>

	<!-- VIRTUAL USB DEVICES (used for mouse) -->	
	<controller type='usb' index='0' model='ich9-ehci1'>
		<address type='pci' domain='0' bus='0' slot='4' function='7'/>
	</controller>

	<controller type='usb' index='0' model='ich9-uhci1'>
		<master startport='0'/>
		<address type='pci' domain='0' bus='0' slot='4' function='0' multifunction='on'/>
	</controller>

	<hub type='usb'>
		<address type='usb' bus='0' port='1'/>
	</hub>

	<!-- VIRTUAL MOUSE POINTER (usb to stop track issue in vnc) -->	
	<input type='tablet' bus='usb'/>

</devices>

</domain>

 

i dont seen any posts referencing virtio for vnic yet, so that might be of interest to some people

hey jonp, just created my first windows vm using kvm, got tripped up on your example xml, as i had created a qcow2 image but the default xml is set for raw img files, might be worth adding this into the OP example xml?.

 

 

If I was you...

Forget libvirt for now.

My advice...

Example:

 

qemu-system-x86_64 -enable-kvm -M q35 \
-m 8196 -mem-prealloc -mem-path /mnt/hugepages \
-cpu Opteron_G5 \
-smp 4,sockets=1,cores=2,threads=2 \
-bios /root/kvm-vga-passthrough/vfio-post3.13/seabios/seabios/out/bios.bin -vga none \
-boot order=cd,menu=on \
-device ioh3420,bus=pcie.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1 \
-device vfio-pci,host=04:00.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on \
-device vfio-pci,host=00:1d.0,bus=root.1,addr=00.1 \
-device vfio-pci,host=00:1b.0,bus=root.1,addr=00.2 \
-device ahci,bus=pcie.0,id=ahci \
-net nic,model=virtio -net bridge,br=br0
-device virtio-net-pci,netdev=hostnet0,id=net0 \
-drive file=/var/lib/libvirt/images/ubuntu_1404_x64-disk01.qcow2,id=disk,format=qcow2 -device ide-hd,bus=ahci.0,drive=disk \
-drive file=/var/lib/libvirt/images/ubuntu-14.04-desktop-amd64.iso,id=isocd -device ide-cd,bus=ahci.2,drive=isocd

@LT

In some case above config file would be good to use, however it will nor work on unraid B6, but its' a easy fix :-)

 

what we need is a config file added to qemu.

 

 /etc/qemu/bridge.conf

this file needs to include our bridge

 

allow br0

 

then we need this line in above example

 

-net nic,model=virtio-net bridge,br=br0 \

 

I prefer libvirt, but these fix should be added on next beta

 

can you also look into macvlan? there is 2 modules that needs to be added.

CONFIG_MACVLAN=m
CONFIG_MACVTAP=m

 

//Peter

Archived

This topic is now archived and is closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.