Logical volume management

From Wikipedia, the free encyclopedia

Jump to: navigation, search

In computer storage, logical volume management or LVM is a method of allocating space on mass storage devices that is more flexible than conventional partitioning schemes. In particular, a volume manager can concatenate, stripe together or otherwise combine partitions into larger virtual ones that can be resized or moved, possibly while it is being used.

Volume management is one of many forms of storage virtualization, the one implemented as a layer in the OS disk driver stack.

Contents

[edit] Design

Linux Logical Volume Manager (LVM) v1

Most volume manager implementations share the same basic design and start with physical volumes (PVs), which can be hard disk partitions, RAID devices or a SAN. PVs are split into chunks called physical extents (PEs). Some volume managers (such as that in HP-UX and Linux) will have PEs of a uniform size; others (such as that in Veritas) will have variably-sized PEs that can be split and merged at will.

Normally, PEs are simply mapped one-to-one to logical extents (LEs). With mirroring, multiple PEs are mapped onto each LE. These PEs are drawn from a physical volume group (PVG), a set of same-sized PVs which act similarly to hard disks in a RAID1 array. PVGs are usually laid out so that they reside on different disks and/or data buses for maximum redundancy.

The LEs are pooled into a volume group (VG). The pooled LEs can then be concatenated together into virtual disk partitions called logical volumes or LVs. LVs are usable as raw block devices just as disk partitions are: mountable file systems can be created on them, or they can be used as swap storage.

On striped LVs, each successive LE is allocated from a different PV; depending on the size of the LE, this can improve performance on large sequential reads by bringing to bear the combined read throughput of multiple PVs.

The LVs can be grown or shrunk by concatenating more LEs from or returning them to the pool. The concatenated LEs do not have to be contiguous. This allows LVs to be grown without having to move already-allocated LEs. Some volume managers allow LVs to be resized in either direction while online. Changing the size of the LV does not necessarily change the size of a filesystem on it; it merely changes the size of its containing space. A file system that can be resized online is recommended because it allows the system to adjust its storage on-the-fly without interrupting applications.

PVs and LVs cannot be shared between or span different VGs (although some volume managers may allow them to be moved at will between VGs on the same host). This allows VGs to be conveniently brought online, taken offline or moved between host systems as a single administrative unit.

VGs can grow their storage pool by absorbing new PVs or shrink by retracting from PVs. This may involve moving already-allocated LEs out of the PV. Most volume managers can perform this movement online; this allows storage (if the underlying hardware is hot-pluggable) to be upgraded or replaced without system downtime.

[edit] Snapshots

Some volume managers also implement snapshots by applying copy-on-write to each LE. In this scheme, the volume manager will copy the LE to a copy-on-write table just before it is written to. This preserves an old version of the LV—the snapshot—which can later be reconstructed by overlaying the copy-on-write table atop the current LV. Snapshots which are read-write are branching snapshots because they implicitly allow diverging versions of an LV.

Snapshots can be useful for backing up self-consistent versions of volatile data like table files from a busy database, or for rolling back large changes in one swoop, such as an operating system upgrade. Some Linux-based Live CD systems also use snapshots to simulate read-write access on a read-only compact disc.

[edit] Implementations

Vendor Introduced in Volume manager Allocate anywhere[1] Snapshots RAID0 RAID1 RAID5 Mirroring with striping Notes
IBM AIX 3.0 (1989) Logical Volume Manager Yes No[2] Yes Yes No Yes [3] [4]
Hewlett-Packard HP-UX 9.0 HP Logical Volume Manager Yes Yes Yes Yes No Yes
FreeBSD Vinum Volume Manager Yes No Yes Yes Yes
Linux 2.2 Logical Volume Manager Yes Yes Yes Yes No
Linux 2.4 Enterprise Volume Management System Yes Yes Yes Yes Yes
Silicon Graphics Irix or Linux XVM Volume Manager Yes Yes Yes Yes Yes
Sun Microsystems SunOS Solaris Volume Manager (was Solstice DiskSuite). No No Yes Yes Yes Yes [5]
Sun Microsystems Solaris 10 ZFS Yes Yes Yes Yes Yes Yes
Veritas[6] Cross-OS Veritas Volume Manager (VxVM) Yes Yes Yes Yes Yes Yes [7]
Microsoft Windows 2000 and later NT-based operating systems Logical Disk Manager Yes Yes [8] Yes Yes Yes [9]


[edit] Disadvantages

  • The levels of indirection that volume managers introduce can complicate the boot process and make disaster recovery difficult, especially when the base operating system and other essential tools are themselves on an LV.
  • Logical volumes can suffer from external fragmentation when their PEs are not allocated contiguously on underlying storage. This can reduce I/O performance on slow-seeking media (such as magnetic disks), which have to seek over the gaps between extents during large sequential reads or writes. Volume managers which use fixed-size PEs, however, typically make PEs relatively large (a default of 4MB on the Linux LVM, for example) in order to amortize the cost of these seeks.

[edit] Notes

  1. ^ Denotes whether the volume manager allows LVs to grow and span onto any PV in the VG.
  2. ^ Does not have a copy-on-write snapshot mechanism; snapshots are created by freezing one volume of a mirror pair.
  3. ^ AIX 5.1
  4. ^ Refers to PEs as PPs (physical partitions), and to LEs as LPs (logical partitions).
  5. ^ Refers to PVs as volumes (which can be combined with RAID0, RAID1 or RAID5 primitives into larger volumes), LVs as soft partitions (which are contiguous extents placeable anywhere on volumes, but which cannot span multiple volumes) and VGs as disk sets.
  6. ^ Third-party product; available for Windows and many Unix-like OSes.
  7. ^ Refers to LVs as volumes, VGs as disk groups, has variably-sized PEs called subdisks and LEs called plexes.
  8. ^ Windows Server 2003 and later
  9. ^ Does not have a concept of PEs or LEs; can only RAID0, RAID1, RAID5 or concatenate disk partitions into larger volumes; file systems must span whole volumes.

[edit] References

Personal tools