How to delete unused disks from local-lvm?

osrex

New Member
Sep 9, 2017
7
0
1
39
Guys,
don't know why simple tasks are as hard as ****

want to simply delete old lxc disks from local-lvm

root@ded01:~# lvremove -f local-lvm/vm-102-disk-2
Volume group "local-lvm" not found
Cannot process volume group local-lvm

why is it complaining?
 
Volume group "local-lvm" not found
That's why. Blindly guessing that you did a standard setup, local-lvm is the name of storage, not the name of the volume group. The VG is name 'pve' by default. So you'll want to use
Code:
# lvremove pve/vm-102-disk-2
Don't force it.
You can actually do this from the WebUI. Select the VM, select the appropriate disk on the hardware tab and click the remove button. The VM needs to be off for this change to take effect. This will stop the volume being mounted to the vm when it starts. Selecting the disk again and clicking remove again will remove the LV.
 
thanks and yes that did it.
any chance to shirk the disks?
cause
pct resize 100 rootfs 50G
doesn't work
 
and forgive my ignorance, why destroying an LXC doesn't remove its associated disks?!
 
Are you using a container or a VM? pct is for containers, qm is for VMs.
 
and forgive my ignorance, why destroying an LXC doesn't remove its associated disks?!
Because someone might want to destroy the container and create a new one in its place, reusing the disks. E.g. if it has data that's still required but they want to switch the linux distro.
 
pct help resize said:
Shrinking disk size is not supported.
Are you trying to shrink the rootfs? Otherwise I'll need more info than "doesn't work."
 
Are you trying to shrink the rootfs? Otherwise I'll need more info than "doesn't work."
root@ded01:~# pct resize 100 rootfs 40
unable to shrink disk size
root@ded01:~#
thats when the container is on and off, it's status doesn't matter
 
As I already said, shrinking is not supported.
 
If you have the rootfs on lvm-thin you don't need to do anything, except not use the space. With thin provisioning the size is a limit, not a fixed value.
If you want to lower the limit you can do it manually:
  • Make a backup!
  • Verify that you can restore from the backup and the restored container works.
  • If the container uses ext4:
    • Code:
      # lvreduce 50G -r pve/vm-100-disk-1
  • If it doesn't:
    1. Shrink the FS to a little less than the target size (50G)
    2. Code:
      # lvreduce 50G pve/vm-100-disk-1
    3. Grow the FS to fit the volume.
  • Verify the container works as desired. Restore from backup otherwise.
 

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!