Skip to main content
  1. Posts/
  2. Proxmox/

How to Merge local-lvm and local into a Single Storage in Proxmox

··510 words·3 mins· loading · loading · ·
Stilicho2011
Author
Stilicho2011
Writing about homelab, self-hosting, automation and open-source solutions
Table of Contents
Proxmox - This article is part of a series.
Part : This Article

Why merge local-lvm and local?
#

After installing Proxmox VE, two local storages are created by default:

  • local - the /var/lib/vz folder, intended for ISO images, templates, and backups.
local storage
  • local-lvm - an LVM pool where the disks of virtual machines and containers are stored.
local-lvm storage

At first glance this is convenient, but this separation has downsides:

  • The size of local-lvm is fixed, and it’s hard to free up space for ISOs or backups.
  • Files in local-lvm are not directly visible in the file system.
  • Expanding or migrating the pool is problematic.

That’s why many administrators prefer to merge local-lvm and local into a single file-based storage, where everything is stored as regular files.


Available approaches
#

There are two approaches:

  1. Remove the LVM pool and use all the space for ext4 (or ZFS).
  2. Migrate the disks from local-lvm to local, then remove the LVM pool.

We’ll go with the first option, since it’s simpler if you’re installing Proxmox from scratch - it’s safer, and you won’t lose data.


Step 1. Remove the LVM storage from the Storage list in the Datacenter section of our Proxmox
#

Go to the Datacenter menu, select Storage, select the local-lvm storage we don’t need, and click the remove button.

Removing local-lvm

As a result, we’re left with only the local storage. However, the problem is that the “supposedly” freed disk space isn’t actually freed yet.

Step 2. Freeing up space
#

Go into the shell of our node and start the magic session.

First, let’s actually remove the logical volume with the command

lvremove /dev/pve/data
Removing local-lvm

and confirm the action.

Step 3. Increasing the size of the logical volume
#

Now let’s use the following command to increase the size of the logical volume (LVM) so it takes up all the available unallocated space on the physical volume (PV).

lvresize -l +100%FREE /dev/pve/root
increasing lvm

What does the command above mean, you ask me, my curious little friend. Good question.

What happens step by step

  • lvresize is a utility for resizing a Logical Volume in LVM.
  • -l +100%FREE is a flag that says: “Add all the remaining free space from the volume group (VG) to this logical volume.”

That is, if our pve group has, say, 50 GB of unused space left, this command will add all of it to /dev/pve/root.

/dev/pve/root is the path to the logical volume where the main file system is installed (usually /).

And finally, today’s last command

Step 4. Expanding our file system
#

resize2fs /dev/mapper/pve-root

expands our ext4 file system inside the specified partition.

expanding local

Now let’s check what we’ve done.

test
test2

As you can see, now all disk space is used within a single local storage.

But there’s one more, final and mandatory, touch needed.

Step 5. The final touch
#

We need to tell the system that the local storage should now be used for all data types, including the type that was previously only used by local-lvm.

Storage

Post scriptum
#

If you enjoyed this article or found this knowledge useful, consider supporting the channel on Boosty via the link in the contacts.

Proxmox - This article is part of a series.
Part : This Article

Related

Storage for HA in a Proxmox Cluster

··831 words·4 mins· loading · loading
An overview of the main types of storage in Proxmox with support for High Availability (HA). Covers local-lvm, Ceph, NFS, and other solutions, their advantages and limitations, plus recommendations for choosing a reliable and scalable cluster.