Normally, when I passthrough a disk to a VM I use the entire disk. I am looking at attempting to passthrough a partition in KVM. First question is that possible/ok? Looking at this doc it seems to be the way to go which supprised me.
Important
Guest virtual machines should not be given write access to whole disks or block devices (for example, /dev/sdb). Guest virtual
machines with access to whole block devices may be able to modify
volume labels, which can be used to compromise the host physical
machine system. Use partitions (for example, /dev/sdb1) or LVM
volumes to prevent this issue.
My next question is I have read about how to do this via /dev/sdX and by diskID, but DiskID seems to be the entire disk, IE:
https://lime-technology.com/forums/topic/34659-hard-drive-passthrough/
<disk type='block' device='disk'>
<source dev='/dev/disk/by-id/ata-Corsair_CSSD-F120GB2_1109650632000461003B' />
<target dev='hdc' bus='virtio' />
</disk>
And the whole point of using the by-id is because /sdX can change. I was wondering if I can use LABEL or UUID? Anybody with experience, I'd like some input.
Thank you
Best Answer
If you look carefully at the disk symlinks in
/dev/disk/by-id
you will see that there are also links for each partition on the block devices. For instance:Use the one corresponding to your desired partition.