Linux Logical Volume Management Concepts

From NovaOrdis Knowledge Base
Jump to navigation Jump to search

External

Internal

Overview

LVM provides a higher-level view of the disk storage than the traditional view of disks and partitions. Storage volumes created under the control of the logical volume manager can be resized and moved around. The logical volume manager also allows management of storage volumes in user-defined groups, allowing the system administrator to deal with sensibly named volume groups such as "development" and "sales" rather than physical disk names such as "sda" and "sdb".

The whole disk can be allocated to a single volume group and logical volumes created to hold various file systems. If, for example the /home logical volume later filled up but there was still space available on /usr then it would be possible to shrink /usr by a few megabytes and reallocate that space to /home. When new drives are added to the system, it is no longer necessary to move users files around to make the best use of the new storage; simply add the new disk into an existing volume group or groups and extend the logical volumes as necessary.

The boot partition should not be included boot on the LV because some bootloaders don't understand LVM.

LogicalVolumeManagementComponents.png

Physical Volumes (PVs)

Is typically a hard disk, or any device that looks like a hard disk. Physical volumes are allocated to a volume group (VG).

Physical Extent (PE ) / Logical Extents (LE)

Each physical volume is divided in chunks of data - they have the same size as the logical extents for the volume group. Each logical volume is also split into chunks of data with the same size for all logical volumes in the volume group.

Volume Group (VG)

A Volume Group (VG) gathers together a collection of Logical Volumes and Physical Volumes into one administrative unit.

The Volume Groups are mapped under /dev:

/dev/<VG-name>

Logical Volume (LV)

The equivalent of a partition on a non-LVM system. The LV is visible as a standard block device, it can contain a file system.

The LV is mapped under /dev/<VG-name>:

/dev/<VG-name>/<LV-name>

Linear Volumes

A linear volume aggregates space from one or more physical volumes into one logical volume. The physical storage is concatenated.The physical extents are assigned to an area of the logical volume in order.

Topology

Volume Groups present on a system are available as directories right under /dev. Each Volume Group directory contains "Logical Volumes", which are links to /dev/mapper block devices:

    /dev
     |      
     + VolGroup00
           |
           + LogVol00           -> /dev/mapper/VolGroup00-LogVol00
           + LogVol01           -> /dev/mapper/VolGroup00-LogVol01
           + borabora           -> /dev/mapper/VolGroup00-borabora
           + centos55reference  -> /dev/mapper/VolGroup00-centos55reference
           + raiatea 
           ...

Physical Extent

Logical Extent