Need to create VM disk with exact size

Darkblue

New Member
Mar 2, 2025
7
1
3
Hello everyone,
I have a problem I cannot solve. I need to create a virtual disk the exact size of a physical one for technical reasons (it must match the hardware disk it was cloned from or the software inside will not work).
The space presented to the VM must be exactly 32017047552 bytes.
When I use 29GB I get this shown to the VM : 31138512896 bytes
When I set 30GB no good either : 32212254720 bytes

Command qm resize takes only MB or GB afaik.

How would I do this? Thank you.
 
Hi @Darkblue , welcome to the forum.

Assuming that you are using QCOW files for virtual disks, you can : qemu-img create -f qcow2 mydisk.qcow2 32017047552
Placing the file into correct location with appropriate name, i.e. vm-100-disk-0.qcow , you can then discover file via: qm disk rescan --vmid 100

Cheers


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
 
Last edited:
  • Like
Reactions: waltar
Sorry, I should have been more specific. My only storage option on the node is local-lvm, I cannot choose QCOW AFAIK with LVM storage... 1740883782356.png
 
Hmm, probably doing something wrong... Or is this for a non-thin volume?
Rescanning you mean using command qm disk rescan --vmid 443
Edit : added LVM volume summary screenshot.
1740885135877.png
1740886776046.png
 
Last edited:
Thank you both for the help, but still unsure what's wrong. Command doesn't like the absolute path it seems :
(For the record LVM-Thin partition is named data, and is part of pve VG, of course I tried with just data instead of pve-data too, it says volume not found).
1740921567165.png

1740921534202.png1740921548668.png
 
Last edited:
You got me on the right track.
lvcreate -V 32017047552B -T -n vm-443-disk-0 pve/data
works. But the size is 32019316736, it got rounded again. Not sure if this is even possible then.
1740926089722.png
 
I think I'll resort to VirtualBox, makes it easier with
vboxmanage createmedium --filename imagename.vdi --sizebyte=32017047552
even if I'd have preferred it on my PVE server... Will do the job for now.
 
Your solution example goes from block storage to file storage which is available in proxmox too, see eg. dir or nfs storage, vbox not needed :)
You just should have file storage defined and ...
fallocate -l 32017047552 vm-443-disk-0.raw
l vm-443-disk-0.raw
-rw-r--r-- 1 root root 32017047552 Mar 2 16:48 vm-443-disk-0.raw
 
  • Like
Reactions: Kingneutron
Your solution example goes from block storage to file storage which is available in proxmox too, see eg. dir or nfs storage, vbox not needed :)
You just should have file storage defined and ...
fallocate -l 32017047552 vm-443-disk-0.raw
l vm-443-disk-0.raw
-rw-r--r-- 1 root root 32017047552 Mar 2 16:48 vm-443-disk-0.raw
Nice, I'll have to try that at some point when I'll add other drives to the server.
Thank you.
 
  • Like
Reactions: waltar