Return to Level1Techs.com

Storage device pass through for qemu/kvm VM

Hey everybody! I have a feeling this is going to be an easy fix but for the life of me I can’t seem to figure it out. It has to be after getting a Windows 10 VM up and running smooth on my Fedora machine. All I want to do is add a 2Tb HDD so my VM can see it. But I just want it to be a pass through so only the VM has access to it. Looking at the RedHad instructions, it just has you add a “drive” to the .XML. Which I tried (both ways they describe). The drive is viable from Fedora but it’s not mounted. Which I have read it doesn’t need to be if only the Windows VM is going to be accessing it. The drive I want to add is sda:

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 1.8T 0 disk
sdb 8:16 0 1.8T 0 disk
nvme0n1 259:0 0 477G 0 disk
├─nvme0n1p1 259:1 0 1G 0 part /boot
└─nvme0n1p2 259:2 0 476G 0 part
└─luks-e9d6c3ae-f519-4b02-b7a5-c4e286b3d1c9 253:0 0 476G 0 crypt
├─fedora-root 253:1 0 50G 0 lvm /
├─fedora-swap 253:2 0 15.8G 0 lvm [SWAP]
└─fedora-home 253:3 0 410.2G 0 lvm /home

Here is what my XML looks like (with the ‘drive’ added) but Windows still can’t see it:

 <devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<disk type='file' device='disk'>
  <driver name='qemu' type='qcow2'/>
  <source file='/home/Surfking55/Win10.qcow2'/>
  <target dev='vda' bus='virtio'/>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
</disk>
 <disk type='block' device='disk'> (The drive in question)
  <driver name='qemu' type='raw'/>
  <source dev='/dev/sda'/>
  <target dev='vdc' bus='virtio'/>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
</disk>
<disk type='file' device='cdrom'>
  <driver name='qemu' type='raw'/>
  <source file='/home/Surfking55/Downloads/Win10_1607_English_x64.iso'/>
  <target dev='hdb' bus='ide'/>
  <readonly/>
  <address type='drive' controller='0' bus='0' target='0' unit='1'/>
</disk>
<disk type='file' device='cdrom'>
  <driver name='qemu' type='raw'/>
  <source file='/usr/share/virtio-win/virtio-win.iso'/>
  <target dev='hdc' bus='ide'/>
  <readonly/>
  <address type='drive' controller='0' bus='1' target='0' unit='0'/>
</disk>
<controller type='usb' index='0' model='ich9-ehci1'>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x7'/>
</controller>
<controller type='usb' index='0' model='ich9-uhci1'>
  <master startport='0'/>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0' multifunction='on'/>
</controller>
<controller type='usb' index='0' model='ich9-uhci2'>
  <master startport='2'/>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x1'/>
</controller>
<controller type='usb' index='0' model='ich9-uhci3'>
  <master startport='4'/>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x2'/>
</controller>
<controller type='pci' index='0' model='pci-root'/>
<controller type='ide' index='0'>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
</controller>
<controller type='virtio-serial' index='0'>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
</controller>
<controller type='sata' index='0'>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
</controller>

Can anybody see what I’m doing wrong?

EDIT: WOW i didnt notice this was 2 years old. my bad

Just to make sure “(The drive in question)” is not actually in the file right?

Do you have the virtio drivers installed in windows?