Restore to a zfs/thin provision from a .qcow2 file?

nertskull

New Member
Sep 13, 2020
12
7
3
124
I have a .qcow2 file of a VM that I used to have in a 'directory' storage system. I have a backup of this VM from a week ago that I used to "restore" the VM with and then restored it to a new location in my datacenter storage that I made ZFS (with thin provision checked when I made that storage).

This all works, but there is a week of no backups that would be nice to have. I already re-installed proxmox. I guess I could (I think?) make a regular directory storage and load the qcow2 file in there, make a backup of the current data, and then restore again to the new ZFS storage system.

But I'm wondering if I could just directly do this right now.

I found this command

pvesm path SlowVMs:vm-120-disk-0

Which tells me my VM is now at:

/dev/zvol/poolData/VMs/vm-120-disk-0

I'm wondering if I could just do something akin to

dd if=/path/to/my/qcow/vm-123-disk-0.qcow2 of=/dev/zvol/poolData/VMs/vm-120-disk-0

That also seems potentially dangerous. Can this be done?

edit: Okay, I tried the dd thing. It didn't work. It said "No space left on device". So that must not be the way to do this.
 
Last edited:
dd probably would have worked if the file was in raw format. But qcow2 is a bit more sophisticated than just the raw content of the disk.

Checkout the command qm importdisk [0].

Code:
qm importdisk <vmid> <source> <storage>

Source is the path to the source file and storage the name of the storage as you see it in the GUI. With that you can import the qcow2 file to the storage you prefer and the conversion between different formats will be done for you.


[0] https://pve.proxmox.com/pve-docs/qm.1.html
 
is this correct? I dont read this in the docs?
What exactly do you mean? If it is about the command, keep in mind that my last response is over 3 years old. The command is now qm disk import, but the old one will still work as well. See the man page for qm.
 
qm disk import, aka qm importdisk will convert the source format to whatever is needed for the target storage. If the target storage is directory based, where you can specify the format, you can add the optional --format paramter.

From the previously linked man page:
Code:
 --format <qcow2 | raw | vmdk>
    Target format
 
  • Like
Reactions: Kingneutron

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!