Issues importing qcow2

Jun 3, 2022
4
0
1
Code:
root@pve02:/mnt/import# qm disk import 170 /mnt/import/<REDACTED>/VVS-SEKLV-DC01--f43d62a6-4ba9-459a-814d-4510ec3f1fe4/20230308T191114/VVS-SEKLV-DC01-hdd0.qcow2 ceph-RBD --format qcow2
importing disk '/mnt/import/<REDACTED>/VVS-SEKLV-DC01--f43d62a6-4ba9-459a-814d-4510ec3f1fe4/20230308T191114/VVS-SEKLV-DC01-hdd0.qcow2' to VM 170 ...
transferred 0.0 B of 100.0 GiB (0.00%)
qemu-img: Could not open '/mnt/import/<REDACTED>/VVS-SEKLV-DC01--f43d62a6-4ba9-459a-814d-4510ec3f1fe4/20230308T191114/VVS-SEKLV-DC01-hdd0.qcow2': Could not open backing file: Could not open '/mnt/vstorage/vols/datastores/DS-SSD2TB/f43d62a6-4ba9-459a-814d-4510ec3f1fe4/harddisk.hdd': No such file or directory
copy failed: command '/usr/bin/qemu-img convert -p -n -f qcow2 -O raw /mnt/import/<REDACTED>/VVS-SEKLV-DC01--f43d62a6-4ba9-459a-814d-4510ec3f1fe4/20230308T191114/VVS-SEKLV-DC01-hdd0.qcow2 'zeroinit:rbd:cephFS_data/vm-170-disk-2:conf=/etc/pve/ceph.conf:id=admin:keyring=/etc/pve/priv/ceph/ceph-RBD.keyring'' failed: exit code 1

I managed to import another without issues, seems to be this specific disk i have issues with.
I'm unsure what a backing file is, I can see one located in the same directory as the qcow2 named harddisk.hdd but it is not located in /mnt/vstorage/vols/datastores/DS-SSD2TB/f43d62a6-4ba9-459a-814d-4510ec3f1fe4/

Any suggestions on what to do?
 
--format qcow2
Hi,
since you are importing the qcow2 disk to a RBD storage backend, have you tried to use --format raw instead (although the qemu-img sets it to -O raw).

Also, is /mnt/import a network share? Maybe a permission problem?
 
Hi,
since you are importing the qcow2 disk to a RBD storage backend, have you tried to use --format raw instead (although the qemu-img sets it to -O raw).

Also, is /mnt/import a network share? Maybe a permission problem?
Seems to spit out the same error,

I am able to modify and remove to the share, it's a mounted NFS share from a NAS.

Code:
root@pve02:/mnt/import# qm disk import 170 /mnt/import/<REDACTED>/VVS-SEKLV-DC01--f43d62a6-4ba9-459a-814d-4510ec3f1fe4/20230308T191114/VVS-SEKLV-DC01-hdd0.qcow2 ceph-RBD --format raw
importing disk '/mnt/import/<REDACTED>/VVS-SEKLV-DC01--f43d62a6-4ba9-459a-814d-4510ec3f1fe4/20230308T191114/VVS-SEKLV-DC01-hdd0.qcow2' to VM 170 ...
transferred 0.0 B of 100.0 GiB (0.00%)
qemu-img: Could not open '/mnt/import/<REDACTED>/VVS-SEKLV-DC01--f43d62a6-4ba9-459a-814d-4510ec3f1fe4/20230308T191114/VVS-SEKLV-DC01-hdd0.qcow2': Could not open backing file: Could not open '/mnt/vstorage/vols/datastores/DS-SSD2TB/f43d62a6-4ba9-459a-814d-4510ec3f1fe4/harddisk.hdd': No such file or directory
 
rather than import do this.

1. Create an empty qcow2 for your target virtual machine ie 170 . This will appear in /mnt/pve/dev-sdb/images/170/vm-170-disk-0.qcow2 where dev-sdb is name of storage.
2.Use winscp and upload your qcow2 file to same directory.
3. delete the original and rename your file to vm-170-disk-0.qcow2
4. Do qm rescan 170 and the disc will be allocated to the virtual machine.
5. From there you can convert to raw if required
 
the issue is that this particular qcow2 file refers to another one (backing file), see the error message for the exact path. you need to copy that one as well, or use `qemu-img rebase` to convert the original image into a single, complete one (see "man qemu-img")
 
  • Like
Reactions: Chris