Skip to contentSkip to conversation

hdd and ssd passthrough

Qemu-devel Mario Giammarco 2 participants 2 messages Oct 17, 2012 – Oct 18, 2012

lore
Share & tools
lore
#0 lore raw

Hello,
I hope I am in the right list.
I would like to pass a real disk to a guest (freenas) in kvm/qemu without iommu/vt-d.

I need guest to be able to:

- use hdd smart;
- configure hdd params like power saving;
- understand real make and model of hdd;
- understand when the hdd is an ssd.

How can I do it?
I have configured the guest with virt-manager.

Thanks you very much in advance.

Mario

#1 lore raw

Il 17/10/2012 23:20, Mario Giammarco ha scritto:

Quoted 11 lines

Hello,
I hope I am in the right list.
I would like to pass a real disk to a guest (freenas) in kvm/qemu without iommu/vt-d.

I need guest to be able to:

- use hdd smart;
- configure hdd params like power saving;
- understand real make and model of hdd;
- understand when the hdd is an ssd.

This is really a libvirt question more than QEMU... anyway if your guest is new enough (Linux 3.4 or RHEL/CentOS 6.3) you can probably use virtio-scsi with XML that looks like this (using "virsh edit"):

<controller type='scsi' model='virtio-scsi'/>
<disk type='block' device='lun'>

      <driver name='qemu' type='raw' cache='none'/>
      <source dev='/dev/sdb'/>
      <target dev='sda' bus='scsi'/>

</disk>

For passthrough you need the "device='lun'" setting.

You can also use virsh from the command line to achieve the same. Write the <controller> and <disk> elements to a new file, like hba.xml and sdb.xml. Then:

# virsh attach-device --persistent Guest1 ~/hba.xml
# virsh attach-device --persistent Guest1 ~/sdb.xml

virt-manager and virt-install don't yet fully support virtio-scsi.

Paolo