[kvm] Failed to get shared “write” lock Is another process using the image?

jackxiang 2023-5-12 15:54 | |
原因
此磁盘已经被其他进程占用。

解决方法
方法1
ps -aux |grep " image(创建的磁盘名称)"
//通过上述命令找到相关进程杀死(该磁盘可能被别人占用,建议询问后在杀)
kill -9 “上述命令查出的进程号”
重新拉虚拟机
方法2
sb.img文件镜像大小制作: qemu-img create -f qcow2 sb.img 50G
启动虚拟机 fdisk -l 查看查看磁盘信息 一般会输出/dev/vda或/dev/vdb信息
mkfs.ext4 /dev/vda 格式化磁盘(分区磁盘,查看本地/document/Newer_enviroment_construct/分区磁盘命令)
新建一个文件夹mkdir /tmp , 并挂载磁盘 mount /dev/vda /tmp
替换原来的disk

实践如下:
ps -aux|grep "win10"
root     1519052  2.3  0.1 883548 92928 ?        Sl   14:51   1:25 /usr/bin/qemu-img convert -f qcow2 -O qcow2 -o compat=1.1,lazy_refcounts /backup/virtImages/win10_bak_10_10_0_119.img /backup/virtImages/win10_bak_10_10_0_168.img


kill -9 1519052


错误如下:
启动域时出错: 内部错误:process exited while connecting to monitor: 2023-05-12T07:49:37.817008Z qemu-kvm: -blockdev {"node-name":"libvirt-2-format","read-only":false,"driver":"qcow2","file":"libvirt-2-storage","backing":null}: Failed to get "write" lock
Is another process using the image [/backup/virtImages/win10_bak_10_10_0_119.img]?

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 1280, 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: 内部错误:process exited while connecting to monitor: 2023-05-12T07:49:37.817008Z qemu-kvm: -blockdev {"node-name":"libvirt-2-format","read-only":false,"driver":"qcow2","file":"libvirt-2-storage","backing":null}: Failed to get "write" lock
Is another process using the image [/backup/virtImages/win10_bak_10_10_0_119.img]?

来自:https://blog.csdn.net/qq_36657175/article/details/124748507

作者:jackxiang@向东博客 专注WEB应用 构架之美 --- 构架之美,在于尽态极妍 | 应用之美,在于药到病除
地址:https://jackxiang.com/post/11826/
版权所有。转载时必须以链接形式注明作者和原始出处及本声明!


最后编辑: jackxiang 编辑于2023-5-12 16:45
评论列表
发表评论

昵称

网址

电邮

打开HTML 打开UBB 打开表情 隐藏 记住我 [登入] [注册]