Delete the local-lvm partition on a new installation on Proxmox

After a new installation, the main disk on which Proxmox is installed consists of two partitions.

local and local-lvm

By default, the virtual machines and containers will be stored on the local-lvm partition.

And on the local partition, the backups, templates, and iso files will be stored.

If you have a second disk or several in a raid, it may be useful to delete the local-lvm partition in order to allocate its space to the local partition to store more content (backups, iso, template, etc.).

Screenshot of Datastores on a Proxmox server

Let’s check the name of the local-lvm partition as well as its size on the hypervisor from the Proxmox terminal.

lvs
  LV   VG  Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  data pve twi-a-tz-- 56.37g             0.00   1.59                            
  root pve -wi-ao---- 24.75g                                                    
  swap pve -wi-ao----  4.00g   

Our partition is named “data”, so we will delete it.

lvremove /dev/pve/data
Do you really want to remove active logical volume pve/data? [y/n]: y
  Logical volume "data" successfully removed

After a quick check, we see that our partition has been successfully deleted.

lvs
  LV   VG  Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root pve -wi-ao---- 24.75g                                                    
  swap pve -wi-ao----  4.00g                                                    

Let’s reallocate the free space on the disk to the root (local) partition.

lvresize -l +100%FREE /dev/pve/root
  Size of logical volume pve/root changed from 24.75 GiB (6336 extents) to <95.50 GiB (24447 extents).
  Logical volume pve/root successfully resized.

Then resize the file system.

resize2fs /dev/mapper/pve-root
resize2fs 1.46.2 (28-Feb-2021)
Filesystem at /dev/mapper/pve-root is mounted on /; on-line resizing required
old_desc_blocks = 4, new_desc_blocks = 12
The filesystem on /dev/mapper/pve-root is now 25033728 (4k) blocks long.

A quick check.

lvs

  LV   VG  Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root pve -wi-ao---- <95.50g                                                    
  swap pve -wi-ao----   4.00g  

We can see that our partition has successfully reclaimed the space from the data partition.

Edit the storage.cfg file.

nano /etc/pve/storage.cfg

And delete the section concerning the local-lvm disk.

dir: local
        path /var/lib/vz
        content iso,vztmpl,backup

lvmthin: local-lvm
        thinpool data
        vgname pve
        content rootdir,images

You can see that the said disk has indeed disappeared from the hypervisor.

Screenshot of the Datastores of a Proxmox server after repartitioning

Leave a Comment