Storage pool type: lvm

LVM is a lightweight software layer that sits on top of hard disks and partitions. It can be used to divide available disk space into smaller logical volumes.

Another use case is placing LVM on top of a large iSCSI LUN (Logical Unit Number) or a SAN (Storage Area Network) connected via Fibre Channel. This allows you to easily manage the space on the iSCSI LUN, which would otherwise be impossible because the iSCSI specification does not define a management interface for space allocation.

Configuration

The LVM backend supports the common storage properties content, nodes, disable, and the following LVM specific properties:

vgname

LVM volume group name. This must point to an existing volume group.

base

Base volume. This volume is automatically activated before accessing the storage. This is mostly useful when the LVM volume group resides on a remote iSCSI server.

saferemove

Called "Wipe Removed Volumes" in the web UI. Zero-out data when removing LVs. When removing a volume, this makes sure that all data gets erased and cannot be accessed by other LVs created later (which happen to be assigned the same physical extents). This is a costly operation, but may be required as a security measure in certain environments.

Storage devices that support the "write zeroes" operation use it to zero blocks. Otherwise, zeroes are written manually. The volume is processed range by range, according to saferemove-stepsize.

on-volume-remove

Configure additional actions to run before an LV is removed. The LV is first renamed to del-*; if cleanup fails, it is kept and renamed to failed-<N>-del-*, so it can be inspected, cleaned up manually, or removed explicitly.

Set discard=1 to issue discard (TRIM) requests for the LV’s blocks before the LV is removed, so thin-provisioned backing storage, such as a SAN LUN, can reclaim space the LV occupied. This is called "Discard Removed Volumes" in the web UI. Configuring the discard option fails if any backing device in the LV’s volume group is detected as not supporting it.

If saferemove and discard are both enabled, the LV is processed range by range. Ranges are zeroed until reaching a boundary aligned with both the zeroing step size and the discard granularity. The accumulated range is then discarded before processing continues. This prevents complete discard chunks from being skipped and avoids allocating the whole LV with zeroes on thin-provisioned backing storage before the space can be reclaimed again.

saferemove-stepsize

Wipe step size in MiB, capped to the maximum step size supported by the underlying storage. Up to 32 MiB (maximum) by default.

saferemove_throughput

Limits wipe throughput. If the backing storage supports the "write zeroes" operation, throughput is unlimited by default. Otherwise, manually written zeroes are limited to 10 MiB/s by default.

snapshot-as-volume-chain

Set this flag to enable snapshot support for virtual machines on LVM with a volume backing chain. With this setting, taking a snapshot persists the current state under the snapshot’s name and starts a new volume backed by the snapshot.

A volume based on a snapshot references its parent snapshot volume as its backing volume and records only the differences to that backing volume. Snapshot volumes are currently thick-provisioned LVM logical volumes.

This design avoids issues with native LVM snapshots, such as significant input/output (I/O) penalties and unexpected, dangerous behavior when running out of pre-allocated space.

Snapshots as volume chains provide vendor-agnostic support for snapshots on any storage system that supports block storage. This includes iSCSI and Fibre Channel-attached SANs.

Note that, although this feature relies on qcow2, it only uses qcow2’s ability to layer multiple volumes in a backing chain, not qcow2’s snapshot functionality. The snapshot functionality is managed by the PVE storage system.

Enabling or disabling this flag only affects newly created virtual disk volumes.

For efficient support of snapshot-as-volume-chain, the backing storage must support thin-provisioning and discard. Each snapshot will appear to use the full volume size on the PVE side, but the actual space usage on the underlying storage will be smaller if those requirements are met.

Warning Snapshots as volume chains are currently a technology preview in Proxmox VE.
Configuration Example (/etc/pve/storage.cfg)
lvm: myspace
        vgname myspace
        content rootdir,images

File naming conventions

The backend use basically the same naming conventions as the ZFS pool backend.

vm-<VMID>-<NAME>      // normal VM images

Storage Features

LVM is a typical block storage system. Unfortunately, regular LVM snapshots are inefficient because they interfere with all write operations within the entire volume group while the snapshot is active, which causes significant I/O degradation. This is why LVM does not support linked clones, and why Proxmox VE added support for snapshots as volume chains. This feature manages the snapshot volume through the storage plugin and uses qcow2 to layer separate volumes as a backing chain. This creates a single disk state that is exposed to the guest.

A benefit of LVM is that it can be used with shared storage. For example, an iSCSI LUN. The backend implements proper cluster-wide locking if the storage is marked as shared in the configuration.

Note If you extend a shared volume group onto another device on one node, the other nodes may only see the added physical volume after LVM has scanned their devices again, for example with pvscan --cache. This command also resets the autoactivation records of LVM, which can let LVM activate logical volumes on its own later. Proxmox VE disables autoactivation for the logical volumes it creates. Before you run the command, make sure that autoactivation is also disabled for all other logical volumes of the volume group, for example with lvchange --setautoactivation n <vg>/<lv>. Proxmox VE runs the same rescan on its own when it does not find the volume group of a storage at all, so keep autoactivation disabled for all logical volumes of a shared volume group.
Tip You can use the LVM-thin backend for non-shared local storage. It supports snapshots and linked clones.
Table 1. Storage features for backend lvm
Content types Image formats Shared Snapshots Full Clones Linked Clones

images rootdir

raw, qcow21

possible

yes1

yes

no

1: Since Proxmox VE 9, snapshots as a volume chain have been available for VMs, for details see the LVM configuration section.

Examples

You can get a list of available LVM volume groups with:

# pvesm scan lvm

See Also