问题现象
PVE虚拟化平台,虚拟机执行快照回滚报错

qemu-img: Could not apply snapshot 'a260204': Device has active dirty bitmaps
TASK ERROR: command '/usr/bin/qemu-img snapshot -a a260204 /var/lib/vz/images/102/vm-102-disk-0.qcow2' failed: exit code 1

再次执行快照回滚,提示虚拟机已锁定“TASK ERROR: VM is locked (rollback)”

解决方法
使用命令qemu-img info vm-102-disk-0.qcow2检查快照回滚报错的虚拟机磁盘镜像,检查结果如下

image: vm-102-disk-0.qcow2
file format: qcow2
virtual size: 100 GiB (107374182400 bytes)
disk size: 99.4 GiB
cluster_size: 65536
Snapshot list:
ID      TAG               VM_SIZE                DATE        VM_CLOCK     ICOUNT
1       a260204               0 B 2026-02-04 10:50:07  2449:48:03.922         --
Format specific information:
    compat: 1.1
    compression type: zlib
    lazy refcounts: false
    bitmaps:
        [0]:
            flags:
                [0]: auto
            name: VeeamTmp_10600bcb-c183-4236-a82d-c27ad903f644_e15ccd60-cbcc-4f55-9219-81806030565f
            granularity: 65536
    refcount bits: 16
    corrupt: false
    extended l2: false
Child node '/file':
    filename: vm-102-disk-0.qcow2
    protocol type: file
    file length: 99.4 GiB (106678977024 bytes)
    disk size: 99.4 GiB

可以看到bitmaps中有Veeam备份的残留信息在里面

使用命令移除残留的bitmaps信息
qemu-img bitmap --remove vm-102-disk-0.qcow2 VeeamTmp_10600bcb-c183-4236-a82d-c27ad903f644_e15ccd60-cbcc-4f55-9219-81806030565f

解锁虚拟机

qm unlock 102
rm -rf /var/lock/qemu-server/lock-*

来源:https://www.reddit.com/r/Proxmox/comments/1i9sy3r/vms_get_locked_after_rollbacking_a_snapshot

标签: none