13.3.2. Adding Hard Drives and Other Block Devices to a Guest

Latest response

I've read this:

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.

and I've read a view posts from:
KVM Pass through disk Partition - By Label or UUID
Hard drive passthrough
Add physical disk to KVM virtual machine

and did this,

<disk type="block" device="disk">
  <driver name="qemu" type="raw"/>
  <source dev="/dev/disk/by-uuid/92E8-A359"/>
  <target dev="sdf" bus="sata"/>
  <boot order="2"/>
  <alias name="sata0-0-1"/>
  <address type="drive" controller="0" bus="0" target="0" unit="1"/>
</disk>

and added a secondary drive:

<disk type="file" device="disk">
  <driver name="qemu" type="qcow2"/>
  <source file="/home/administrator/StorageVolII/images/sle15sp2OfficeHD2.qcow2"/>
  <target dev="sdc" bus="sata"/>
  <boot order="3"/>
  <address type="drive" controller="0" bus="0" target="0" unit="2"/>
</disk>

However I get this error when trying to start:

Error starting domain: Cannot access storage file '/dev/disk/by-uuid/92E8-A359': No such file or directory

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 75, in cb_wrapper
    callback(asyncjob, *args, **kwargs)
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 111, in tmpcb
    callback(*args, **kwargs)
  File "/usr/share/virt-manager/virtManager/object/libvirtobject.py", line 66, in newfn
    ret = fn(self, *args, **kwargs)
  File "/usr/share/virt-manager/virtManager/object/domain.py", line 1279, in startup
    self._backend.create()
  File "/usr/lib64/python3.6/site-packages/libvirt.py", line 1234, in create
    if ret == -1: raise libvirtError ('virDomainCreate() failed', dom=self)
libvirt.libvirtError: Cannot access storage file '/dev/disk/by-uuid/92E8-A359': No such file or directory

and checking the disk information with Disks, the information is no longer valid. So, how do you set this up correctly?

Responses