Adding Passthrough Physical Disk in KVM Guests

I found myself needing to add a physical disk thats installed on a KVM host on to one of its guests. Although this is not always advised, it can be helpful in data recovery scenarios.

Find which disk you want to add by using ‘fdisk -l’, looking at the listed partitions.

Second, you can make sure its not mounted with the ‘mount’ command.

third, use virsh to edit the VM ‘virsh edit VMNAME’.

fourth add a disk config:

<disk type=’block’ device=’disk’>
<driver name=’qemu’ type=’raw’/>
<source dev=’/dev/sdd’/>
<target dev=’vdb’ bus=’virtio’/>

last, define the new config in the VM:
virsh define /etc/libvirt/qemu/VMNAME.xml