How to resize vm disk (decrement)

m3a2r1

Active Member
Feb 23, 2020
162
5
38
48
I've got machine with 1000GB disk but it uses only about 60GB (when I backup it, it's 240GB of data) and I would like to change it to 100GB. It's Windows Server VM so I can shrink it in system. How to shrink it safely in pve?
 
I do it this way (even though usually it is 10-25 GB I reduce)
1. Shrink the filesystem within the guest. I usually go as low as possible (or at least way below the planned size)
2. Then I power off the VM
3 decrease the size of the disk - this usually involves the CLI (or at least I am doing it that way
4. Adjust VM configuration file (/etc/pve/qemu-server)
5. Power on VM
6. Increase partition to maximum size.

By this approach I avoid potential issues in size calculations
 
Thank you. I like especially: What happens after running this command? After starting the server, the system won’t boot :)
 
Damn it. Haven't read the whole thing through.
But what you always can do in such cases:
Attach a second disk with desired size to your VM and after shrinking partitions DD things over.