qemu drive-mirror not restore in VM

okt2077

New Member
Jan 23, 2025
1
0
1
Hi,
I'm trying to use qemu QMP command drive-mirror to live restore remote NBD device qcow2 image to my local PVE vm.

Restore steps are shown all successfully but in VM show file is as same as before restore. But I use qemu-nbd to mount VM qcow2 show restore file correctly. What parts that I may missing? VM filesystem cache not update?

Is Proxmox VM has cache or something?

Steps is in below:
Code:
// 1. Connect and mount to NBD to /dev/nbd0
qemu-nbd --connect=/dev/nbd0 --image-opts \
'driver=nbd,host=172.17.34.43,port=10809,export=hdp-restore'

// 2. QMP execute add NBD block command
{
  "execute": "blockdev-add",
  "arguments": {
    "node-name": "remote_disk",
    "driver": "qcow2",
    "file": {
      "driver": "host_device",
      "filename": "/dev/nbd0"
    }
  }
}

3. Mirror to VM disk
{
  "execute": "drive-mirror",
  "arguments": {
    "device": "remote_disk",
    "target": "drive-scsi0",
    "sync": "full",
    "format": "qcow2",
    "job-id": "restore-job2"
  }
}

// Finalize
// The drive-mirror job is in a pending/ready state
{
  "execute": "block-job-complete",
  "arguments": {
    "device": "restore-job2"
  }
}

{ "execute": "quit" }


I executed these above commands in VM running.
However, I tried stop VM, and delete VM disk, and use qemu-convert command
Code:
qemu-img convert -O qcow2 /dev/nbd0 /mnt/pve/NAS/images/100/vm-100-disk-0.qcow2
and start VM then show restore file correctly.

Thanks.
 
Last edited: