Storage: LVM: Difference between revisions

From Proxmox VE
Jump to navigation Jump to search
(fix duplicate import)
No edit summary
(4 intermediate revisions by the same user not shown)
Line 5: Line 5:
<pvehide>
<pvehide>
Storage pool type: lvm
Storage pool type: lvm
LVM is a thin software layer on top of hard disks and partitions. It
LVM is a light software layer on top of hard disks and partitions. It
can be used to split available disk space into smaller logical
can be used to split available disk space into smaller logical
volumes. LVM is widely used on Linux and makes managing hard drives
volumes. LVM is widely used on Linux and makes managing hard drives
Line 23: Line 23:
on a remote iSCSI server.
on a remote iSCSI server.
saferemove
saferemove
Zero-out data when removing LVs. When removing a volume, this makes
Called "Wipe Removed Volumes" in the web UI. Zero-out data when removing LVs.
sure that all data gets erased.
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.
saferemove_throughput
saferemove_throughput
Wipe throughput (cstream -t parameter value).
Wipe throughput (cstream -t parameter value).
Line 34: Line 37:
The backend use basically the same naming conventions as the ZFS pool
The backend use basically the same naming conventions as the ZFS pool
backend.
backend.
vm-<VMID>-<NAME>     // normal VM images
vm-&lt;VMID&gt;-&lt;NAME&gt;     // normal VM images
Storage Features
Storage Features
LVM is a typical block storage, but this backend does not support
LVM is a typical block storage, but this backend does not support
snapshot and clones. Unfortunately, normal LVM snapshots are quite
snapshots and clones. Unfortunately, normal LVM snapshots are quite
inefficient, because they interfere all writes on the whole volume
inefficient, because they interfere with all writes on the entire volume
group during snapshot time.
group during snapshot time.
One big advantage is that you can use it on top of a shared storage,
One big advantage is that you can use it on top of a shared storage,
for example an iSCSI LUN. The backend itself implement proper cluster
for example, an iSCSI LUN. The backend itself implements proper cluster-wide
wide locking.
locking.
The newer LVM-thin backend allows snapshot and clones, but does
The newer LVM-thin backend allows snapshots and clones, but does
not support shared storage.
not support shared storage.
Table 1. Storage features for backend lvm
Table 1. Storage features for backend lvm
Line 57: Line 60:
no
no
Examples
Examples
List available volume groups:
You can get a list of available LVM volume groups with:
# pvesm lvmscan
# pvesm scan lvm
See Also
See Also
Storage
Storage
</pvehide>
</pvehide>
<!--PVE_IMPORT_END_MARKER-->
<!--PVE_IMPORT_END_MARKER-->

Revision as of 12:12, 9 April 2025

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.

saferemove_throughput

Wipe throughput (cstream -t parameter value).

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, but the underlying block storage may provide thin provisioning.

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.

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.

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, qcow2

possible

yes1

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