×


Unable to allow access for disk path in libvirtd - Fix it Now

Are you facing the error, Unable to allow access for disk path in libvirtd?

This guide will help you.


Recently one of our customer using a guest virtual machine informed that he was unable to migrate because libvirt cannot access the disk image(s):

The error looks like the one given below:

# virsh migrate qemu qemu+tcp://name_of_host/system
error: Unable to allow access for disk path /var/lib/libvirt/images/qemu.img: No such file or directory.

Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to fix Linux related errors.

In this context, we shall look into how to fix this issue.


Nature of the error , Unable to allow access for disk path in libvirtd ?

Generally, migration only transfers the in-memory state of a running guest (such as memory or CPU state). Although disk images are not transferred during migration, they need to remain accessible at the same path by both hosts.


How to fix the error , Unable to allow access for disk path in libvirtd ?

We need to set up and mount shared storage at the same location on both hosts.

This can be done in the simplest way using NFS.


We can do this using the following steps:

1. Firstly, we will set up an NFS server on a host serving as shared storage.

We can use the following command:

# mkdir -p /exports/images
# cat >>/etc/exports <<EOF
/exports/images 192.168.122.0/24(rw,no_root_squash)
EOF

2. Mount the exported directory at a common location on all hosts running libvirt.

We can use the following command:

# cat >>/etc/fstab <<EOF
123.123.123.123:/exports/images /var/lib/libvirt/images nfs auto 0 0
EOF
# mount /var/lib/libvirt/images

Note: replace Ip with the address of the NFS server.

If the above configuration is not set up correctly, the guest virtual machine may lose access to its disk images during migration.

This is because the source host's libvirt daemon may change the owner, permissions, and SELinux labels on the disk images after it successfully migrates the guest to its destination.

Once libvirt detects that the disk images are mounted from a shared storage location, it will not make these changes.


[Still facing this libvirtd issue? We are available 24*7. ]


Conclusion

This article covers tips to fix the error Unable to allow access for disk path in libvirtd. By default, migration only transfers the in-memory state of a running guest (such as memory or CPU state). Although disk images are not transferred during migration, they need to remain accessible at the same path by both hosts.


To fix Unable to allow access for disk path in libvirtd error:

Set up and mount shared storage at the same location on both hosts. The simplest way to do this is to use NFS:

1. Set up an NFS server on a host serving as shared storage. The NFS server can be one of the hosts involved in the migration, as long as all hosts involved are accessing the shared storage through NFS.

# mkdir -p /exports/images
# cat >>/etc/exports <<EOF
/exports/images    192.168.122.0/24(rw,no_root_squash)
EOF


2. Mount the exported directory at a common location on all hosts running libvirt. For example, if the IP address of the NFS server is 192.168.122.1, mount the directory with the following commands:

# cat >>/etc/fstab <<EOF
192.168.122.1:/exports/images  /var/lib/libvirt/images  nfs  auto  0 0
EOF
# mount /var/lib/libvirt/images