Decrease a VM Disk Size

I've never used LVM before, after trying vgs and vgdisplay, I get nothing on on the screen, the command goes through but just blank.
 
I've never used LVM before, after trying vgs and vgdisplay, I get nothing on on the screen, the command goes through but just blank.

I suggest you start a new thread, but if you used a ZFS-based boot/root instead of ext4 + LVM when you installed Proxmox, you're not even using LVM

You should also do some research into LVM if you want to use it - not having a grasp of the basics and trying commands blindly leads to pitfalls
 
not having a grasp of the basics and trying commands blindly leads to pitfalls
Especially when running commands like lvreduce that might destroy data...especially without the needed prequisites like shrinking filesystems and partitions on that LV first.
Thats also the reason why PVE webUI/API/CLI won't allow you to do that.
 
Last edited:
  • Like
Reactions: Kingneutron
excellent tutorial, a lot of fear but actually it was 2 commands:
Code:
lvm lvreduce -L -32g pve/vm-103-disk-0
qm rescan
and from 64GB it became 32GB
Did the command reduce it by 32G or reduce it to 32G. In this case it is the same answer but I'm looking at different numbers. I couldn't find the syntax definition of "lvreduce" anywhere in the Proxmox admin guide! All I could find was "resize".

In my case I want to reduce it from 100G to 66G (ie. reduce by 34G). Would I use -34g or -66g in the first command? I wasn't sure it the - implied "minus" or simple a dash in the syntax! You'll have to excuse me, but I'm a novice with all of this!

Your assistance is much appreciated.
 
I couldn't find the syntax definition of "lvreduce" anywhere in the Proxmox admin guide!

because thats not a PVE thing. man lvreduce show the docs to that command:

Code:
-L|--size [-]Size[m|UNIT]
    Specifies the new size of the LV.  The --size and
    --extents options are alternate methods of specifying
    size.  The total number of physical extents used will be
    greater when redundant data is needed for RAID levels.
    When the plus + or minus - prefix is used, the value is
    not an absolute size, but is relative and added or
    subtracted from the current size.

so should be -34g.
 
And a warning again, as this is a destructive command:
If you shrink a virtual disk without shinking its partitions and filesystems first, you will lose data. If you want to shrink it by 34GB, the last 34GB should be unallocated on that LV.
 
Last edited:
  • Like
Reactions: Kingneutron
I know this thread is an antique...but I'm kind of in a pickle.

Will Gparted live be able to resize an LVM I accidentally shrank? The VM was having disk issues (100% usage) and showed plenty of space inside the vm.

I now know I made 3 mistakes:
didn't check discard & shut off defrag inside the vm
Over provisioned
Shrank the LVM instead of making it larger (this was my last and fatal mistake)
EDIT: this was in GUI under VM hardware, not LVM command or in storage menu if that helps...I don't know what the underlying commands for that setting are).
Oh, I also moved the VM recently to a larger hard drive(my backup drive) and was getting everything all set up feeling protected by snapshots before I made a new backup
So maybe 6 or 7 mistakes.

Current status: borked
LVM errors out on boot saying it needs manual repair and I have scoured the Internet looking for hope. I added an additional 1tb SSD to VG but it won't extend the LVM because it can't load it.

I have 80+ android VMs running on the guest windows machine (actually not running now) and about 6 months into the project so I would prefer not to wipe it.

I'm betting if I can get in, select discard, and run trim it will fix this issue. Then I'll backup and recreate the VM.

If it helps I have a windows back up of the VM...inside the same container along with 4 worthless snapshots .

Any help would be greatly appreciated
 
Last edited:

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!