I recently setup a QEMU virtual machine with KVM running on Debian. The guest OS is FreeNAS (based on FreeBSD). I have given the guest access to a physical hard-disk on the host (not just a partition). I am using the virtio bus. The configuration in Libvirt is:

<disk type='file' device='disk'>
  <driver name='qemu' type='raw' cache='none'/>
  <source file='/dev/disk/by-id/ata-XXYYZZ'/>
  <target dev='vdb' bus='virtio'/>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>

Will I be able to use all features available from the hard-disk as if it were physically attached to the guest? For example, can I access SMART data, spindown the disk, modify the partition table from the guest?

  • You'll be able to modify the partition table, but I don't think virtio supports anything more than what's needed to read/write from/to block devices. Reference the virtio API to see if it has what you need. – Emmanuel Rosa Oct 6 '18 at 6:33
  • Use virtio SCSI, not virtio-blk. – Michael Hampton Oct 6 '18 at 17:52
  • @MichaelHampton How can I change it to virtio-scsi? – wispi Oct 6 '18 at 19:40
  • @MichaelHampton If you're referring to SCSI LUN-Passthrough, I tried adding a SATA disk through virt-manager, but it says the disk is not configured for device='lun'. – wispi Oct 6 '18 at 21:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.