shrink raw disk but vm windows still shows same size after I re-sized.

weester

New Member
May 21, 2012
20
1
3
Hi,
I use this command to shrink my vm windows disk from 100G to 50G. The physical raw file shows 50G after I resized it but VM windows still shows 100G. How can I fix it?

qemu-img resize vm-102-disk-1.raw -- -50GB

thank you,
Joe.
 
You have to resize the filesystem INSIDE the vm, then resize the "virtual hard disk". With your command you did something like "removing a pair of platter from the hard disk", no matter if data were there.
Your filesytem data structure that knows about disk size has not been updated, relevant part of the filesystem has just be removed, and I do hope you have a backup.
Next time mount the hard disk booting with i.e. systemrescuecd image cdrom, resize the hard disk partition (it resizes the filesystem automatically for most FS, but a backup is as always recomended) and only then resize the "virtual hard disk".
 
Just wondering. How do you resize the filesystem INSIDE the vm?
thank you for your help.

You have to resize the filesystem INSIDE the vm, then resize the "virtual hard disk". With your command you did something like "removing a pair of platter from the hard disk", no matter if data were there.
Your filesytem data structure that knows about disk size has not been updated, relevant part of the filesystem has just be removed, and I do hope you have a backup.
Next time mount the hard disk booting with i.e. systemrescuecd image cdrom, resize the hard disk partition (it resizes the filesystem automatically for most FS, but a backup is as always recomended) and only then resize the "virtual hard disk".
 
Just wondering. How do you resize the filesystem INSIDE the vm?
thank you for your help.
Hi,
you can boot the live-cd gparted to resize most filesystems, then resize VM-disk (stop VM, and start again) and check partition-table (perhaps resize the FS to the full size - it's good to use an safety margin before ;-).

Udo
 
I suggest you to upload in proxmox a systemrescuecd iso. Then add that iso to the VM you want to resize, set the cdrom high in boot priority (from web interface), and start the VM.
You will boot the vm using the iso then, so you can run usual systemrescuecd tools to resize the unmounted hard disk.
After you have done, shutdown the vm.
Then you can resize the vm image as you did, but do the match correctly (better leave some more space and then reboot the VM with systemrescuecd to expand the partition and filesytem to the max hardware size of the hd, shutdwown).
Remove the cdrom iso for vm storage of the Vm, reset boot priority to the hard disk.
Boot the vm, will start with the new hd size.
 
first of all,, thank you so much for your help mmenaz and udo. You both have pointed me to a right direction. I use gprated to shrink filesystem and and qemu-img resize to resize the vm hard disk. It seems to work ok except I don't see the 50Gig free space that I shrunk back to the /var/lib/vz partition. Just wondering , where did it go :).

I suggest you to upload in proxmox a systemrescuecd iso. Then add that iso to the VM you want to resize, set the cdrom high in boot priority (from web interface), and start the VM.
You will boot the vm using the iso then, so you can run usual systemrescuecd tools to resize the unmounted hard disk.
After you have done, shutdown the vm.
Then you can resize the vm image as you did, but do the match correctly (better leave some more space and then reboot the VM with systemrescuecd to expand the partition and filesytem to the max hardware size of the hd, shutdwown).
Remove the cdrom iso for vm storage of the Vm, reset boot priority to the hard disk.
Boot the vm, will start with the new hd size.
 

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!