Proxmox virtual disk size change

6.1k views Asked by At

i have problem with disk resize.

I try to change size in Proxmox, but show size in virtual machine not showing.

But if I try qemu-img info vm-100-disk-1.qcow2 i have this result:

image: vm-100-disk-1.qcow2
file format: qcow2
virtual-size: 491G (527207235584 bytes)
disk size: 161G
cluster_size: 65536
Format specific information:
compat: 1.1
lazy refcounts: false

What is virtual size? This as I tried to adjust the size, I increased the size of the virtual disk more than really has.

I need this: virtual size: 250G disk size: 250G

Can you help me wih this problem?

Thank you in advance.

ps. Debian wheezy (updated)

2

There are 2 answers

0
kirrmann On

Qcow2 disk images are not preallocated. So it's only as large as the data it contains.

You did resize the disk successfully to 491GB (virtual-size), but the disk contains only 161GB of data.

After you resize a virtual disk, you also need to extend the partitions and or filesystems inside the virtual disk to make use of the new extended disk space.

You wrote that you only need to extend your disk to 250GB, but instead you did (multiple) resizes to the current 491GB. If you did not yet resize the partitions and filesystems, you can still shrink the image. This command will basically just cut off the file. So be sure you didn't make any use of the new extended disk size.

At the Monitor in the VM on Proxmox you can execute this command:

block_resize drive-ide0 250G
0
nmishin On

In a nutshell you need to do the next:

  • extend your VM drive in proxmox UI;
  • login to your VM (if you have free space for login work), and extend linux partition via fdisk;
  • extend LVM physical volume (PV);
  • extend filesystem via resize2fs or xfs_growfs, depending from your fs;
  • enjoy!

Full instruction you can find in my article: https://hackernoon.com/resize-filesystem-or-change-any-file-on-your-proxmox-vm-if-locked-out