[SOLVED] convert vhdx image to zfspool disk

DarkAGeS

Member
Jan 7, 2017
6
1
23
40
Hello!
I created vhdx image with disk2vhd and put it to proxmox server.
I create VM with disk on local-zfs storage (rpool/data/vm-101-disk-1)


root@pve1:~# zfs list
NAME USED AVAIL REFER MOUNTPOINT
rpool 594G 1.18T 96K /rpool
rpool/ROOT 243G 1.18T 96K /rpool/ROOT
rpool/ROOT/pve-1 243G 1.18T 243G /
rpool/data 351G 1.18T 230G /rpool/data
rpool/data/vm-100-disk-1 85.3G 1.18T 56.1G -
rpool/data/vm-100-disk-2 24.7G 1.18T 23.8G -
rpool/data/vm-100-state-crypto_pro 10.9G 1.18T 10.9G -

rpool/data/vm-101-disk-1 64K 1.18T 64K -

Then I wanted to convert vhdx to this disk:

# qemu-img convert -O row ./SERVER.VHDX /rpool/data/vm-101-disk-1

image is about 300gb and after some time process finished without error.
I can see that size of rpool/data/vm-101-disk-1 didn't changed, but size of rpool and rpool/data had increased on about 300gb exactly

BUT, after starting VM I've seen that there is nothing on the disk.

Now I have 2 questions:
1) after deleting rpool/data/vm-101-disk-1 size of rpool didn't changed - how to reduce it back? I don't understand where is 300gb of data is??
2) how to convert vhdx image to zfspool disk - is it possible?
 
  • Like
Reactions: chrone
OK, I've figured out.
1) I converted image not to ZFS dataset rpool/data/vm-101-disk-1, but to file with this name - /rpool/data/vm-101-disk-1. After I deleted it - free place come back
2) I convert vhdx to qcow2 (same command, but with "qcow2" instead "row"), create second HDD in VM with qcow2 format, then just replace proxmox image with my image and started VM with 2 HDD (zfs dataset and qcow2). Then just clone HDD from livecd
 
Tnank you! I'll try on other server. Do you know how exactly this mechanism ("move" from the gui) works behind the scenes?
 
Tnank you! I'll try on other server. Do you know how exactly this mechanism ("move" from the gui) works behind the scenes?

it uses either "qemu-img convert" (VM not running) or qemu's "drive-mirror" functionality (VM running)
 
  • Like
Reactions: chrone
Thank you for answers! Do you know exact commands to covert qcow2 image to zfs dataset manualy? I understand that it is not question about Proxmox, but...
 
Thank you for answers! Do you know exact commands to covert qcow2 image to zfs dataset manualy? I understand that it is not question about Proxmox, but...

  1. Create a ZFS volume (not filesystem) with correct size
  2. qemu-img convert -O raw input.qcow2 /dev/zvol/<poolname>/<path-to-dataset>/vm-<vmid>-disk-1
(should work like this, I have not actually run the command)
 

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!