Move of TPM State disk fails

oester

Member
Jan 9, 2021
19
2
8
68
I'm trying to move a Win11 VM storage from and NFS share back to a local (ZFS) store. I moved the system disk and EFI disks, but when I try and move the TPM disk it fails with this error:

create full clone of drive tpmstate0 (vmstore-NFS:500/vm-500-disk-0.qcow2)
transferred 0.0 B of 4.0 MiB (0.00%)
qemu-img: Could not open '/mnt/pve/vmstore-NFS/images/500/vm-500-disk-0.qcow2': Image is not in qcow2 format
TASK ERROR: storage migration failed: copy failed: command '/usr/bin/qemu-img convert -p -n -t none -f qcow2 -O raw /mnt/pve/vmstore-NFS/images/500/vm-500-disk-0.qcow2 zeroinit:/dev/zvol/vmstore3/vm-500-disk-2' failed: exit code 1

Node is powered off for the move. Running PVE 7.1-10.
 
Hi,
if the disk is raw (check with qemu-img info /path/to/disk), try to rename your disk to .raw (both in the configuration and on the storage). The disk should always be raw, but there is a bug when moving the disk to a file-based storage where it is wrongly converted to qcow2. I guess on the next start swtpm probably created a new one. It's already fixed in git, but it's not packaged yet (will be in qemu-server >= 7.1-5).
 
Hi,
if the disk is raw (check with qemu-img info /path/to/disk), try to rename your disk to .raw (both in the configuration and on the storage). The disk should always be raw, but there is a bug when moving the disk to a file-based storage where it is wrongly converted to qcow2. I guess on the next start swtpm probably created a new one. It's already fixed in git, but it's not packaged yet (will be in qemu-server >= 7.1-5).
Hi, the person you replied to referred to moving vm's with tpm disk. Does the fixed issue fix things for cloning vm's as well?

I cloned vm1 which converted the raw tpm file to qcow2. I ran your command on the target tpm disk and it was in qcow2 format. I didn't try to start it, I just replaced vm2's qcow2 tpm disk with the original one from vm1 and renamed the entry in vm2's config from .qcow2 to .raw and the vm started.

Does the fixed issue in git mean that if a vm with a tpm disk is cloned, even if qcow2 is chosen as the format, the tpm disk will ignore that and clone as raw, while the rest of the non-tpm disks will respect the chosen format of qcow2?
 
Hi, the person you replied to referred to moving vm's with tpm disk. Does the fixed issue fix things for cloning vm's as well?
Yes, the same code is used when cloning a disk as part of a move disk operation and as part of a clone VM operation.

I cloned vm1 which converted the raw tpm file to qcow2. I ran your command on the target tpm disk and it was in qcow2 format. I didn't try to start it, I just replaced vm2's qcow2 tpm disk with the original one from vm1 and renamed the entry in vm2's config from .qcow2 to .raw and the vm started.

Does the fixed issue in git mean that if a vm with a tpm disk is cloned, even if qcow2 is chosen as the format, the tpm disk will ignore that and clone as raw, while the rest of the non-tpm disks will respect the chosen format of qcow2?
Yes, the fix forces raw format for TPM disks, but doesn't affect the logic for other disks. Unfortunately, there is no package with the fix available yet.
 
Yes, the same code is used when cloning a disk as part of a move disk operation and as part of a clone VM operation.


Yes, the fix forces raw format for TPM disks, but doesn't affect the logic for other disks. Unfortunately, there is no package with the fix available yet.
That is great...

What is the appropriate place to monitor the status of this particular issue if I am interested in it being merged?

Also, could you provide any advisory regarding when the tpm disk is stored on storage not supporting snapshots like nfs? (nfs requires qcow2 for snapshots, tpm disk must be raw...)
 
That is great...

What is the appropriate place to monitor the status of this particular issue if I am interested in it being merged?
The fix is already merged as mentioned above. I don't know when the package with the fix (should be qemu-server 7.1-5) will be released.

Also, could you provide any advisory regarding when the tpm disk is stored on storage not supporting snapshots like nfs? (nfs requires qcow2 for snapshots, tpm disk must be raw...)
You cannot use snapshots in that case.
 
  • Like
Reactions: Replicant

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!