Why is shrinking disks not supported?

forbin

Member
Dec 16, 2021
30
5
8
44
The ProxMox CLI says, "shrinking disks is not supported." I did it manually and it seems to have worked fine, but maybe I made a mistake and I just don't realize it.

I have PVE 8.0.3 running a Windows Server 2022 guest with a 2 TB drive 0 and a 6 TB drive 1. Drive 0 is partitioned as a 50 GB drive C:, and the rest of the disk is unused. I realized that I was never going to need all that extra space on drive 0, so I wanted to resize it, but the CLI would not let me. After doing a lot of Googling and coming up with all kinds of complicated answers, I eventually did the following, which seems pretty simple:

1. Since my drive C partition was much smaller than the disk, I didn't have to worry about resizing that first.
2. Used lvdisplay to identify the LVM volume associated with drive 0,
3. Ran lvreduce to shrink the volume.
4. Edited the VM guest .conf file and changed the size of disk 0 from 2 T to 60 G.
5. Started the VM. It booted fine.
6. Used Windows Disk Management to verify that drive 0 is now 60G with a 50G drive C partition.

That's it, and all seems well. Did I miss something that will bite me later?
 
Last edited:
If there is no guest-data in the end of the LV your steps seem like they should work (have never tried shrinking a disk in Windows - so could not tell if the empty space in the disk is completely unused). One thing that might need a bit of fixup - is wrting the GPT table once more (it should have a copy at the end of the disk (which would have vanished through the reduction) - but I'm sure windows offers tools for this (or even fixes it itself...?)

Shrinking disks, as opposed to expanding them always has a chance for dataloss (if some of the step is forgotten, and any of the layers inside the guest of partition table, volume manager, filesystem,... (not all of them need to exist) is not reduced before actually reducing the disk) - this is the main reason, why it is not exposed on the GUI/CLI by PVE.

I hope this helps!
 
If there is no guest-data in the end of the LV your steps seem like they should work (have never tried shrinking a disk in Windows - so could not tell if the empty space in the disk is completely unused). One thing that might need a bit of fixup - is wrting the GPT table once more (it should have a copy at the end of the disk (which would have vanished through the reduction) - but I'm sure windows offers tools for this (or even fixes it itself...?)

Shrinking disks, as opposed to expanding them always has a chance for dataloss (if some of the step is forgotten, and any of the layers inside the guest of partition table, volume manager, filesystem,... (not all of them need to exist) is not reduced before actually reducing the disk) - this is the main reason, why it is not exposed on the GUI/CLI by PVE.

I hope this helps!
Hi Stoiko,

Thanks for the feedback. When I booted the Windows Server 2022 guest after shrinking the disk, I did not get any error messages about a missing GPT table, so hopefully that is a good sign?

Speaking as a new ProxMox fan, I wish you guys would enable the shrink option through the GUI and/or CLI, even with all the risks. Just warn people about all the possible problems and require them to confirm TWICE that they know what they are doing, and put a disclaimer that ProxMox takes no responsibility for the outcome.
 

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!