qemu-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Reopen qcow2 backing file from new location


From: Stanislav Datskevych
Subject: Reopen qcow2 backing file from new location
Date: Fri, 23 Jun 2023 11:50:10 +0200

Hello all, 

I'm trying to implement migrating virtual machine's storage from one local 
directory to another one. 

The virtual machine's disk consists of two files: the backing file (a disk 
containing OS template), and the actual VM disk file. 

So far it works using this algorithm:
1. Migrate the actual VM disk file:
virsh blockcopy <vmname> <old_disk_path> <new_disk_path> --shallow --finish 
--pivot

2. Copy the backing file to the new directory:
cp <old_backingfile_path> <new_backingfile_path>

3. Use change-backing-file QMP command to change backing file path to 
<new_backingfile_path> in the disk's metadata.

Unfortunately, change-backing-file only changes the string in the image's 
metadata and doesn't cause QEMU to reopen it on the running VM.
So in order to fully migrate VM to its new storage, the VM must be stopped and 
started.

Maybe there is a way to force qemu to reopen the backing file? 

Thanks in advance.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]