In
computer storage
Computer data storage is a technology consisting of computer components and recording media that are used to retain digital data. It is a core function and fundamental component of computers.
The central processing unit (CPU) of a comput ...
, logical volume management or LVM provides a method of allocating space on
mass-storage devices that is more flexible than conventional
partitioning schemes to store volumes. In particular, a volume manager can concatenate,
stripe
Stripe, striped, or stripes may refer to:
Decorations
* Stripe (pattern), a line or band that differs in colour or tone from an adjacent surface
* Racing stripe, a vehicle decoration
* Service stripe, a decoration of the U.S. military
Entertainme ...
together or otherwise combine partitions (or
block devices in general) into larger virtual partitions that administrators can re-size or move, potentially without interrupting system use.
Volume management represents just one of many forms of
storage virtualization
In computer science, storage virtualization is "the process of presenting a logical view of the physical storage resources to" a host computer system, "treating all storage media (hard disk, optical disk, tape, etc.) in the enterprise as a single ...
; its implementation takes place in a layer in the
device-driver stack of an
operating system
An operating system (OS) is system software that manages computer hardware, software resources, and provides common daemon (computing), services for computer programs.
Time-sharing operating systems scheduler (computing), schedule tasks for ef ...
(OS) (as opposed to within storage devices or in a network).
Design

Most volume-manager implementations share the same basic design. They start with physical volumes (PVs), which can be either
hard disk
A hard disk drive (HDD), hard disk, hard drive, or fixed disk is an electro-mechanical data storage device that stores and retrieves digital data using magnetic storage with one or more rigid rapidly rotating platters coated with mag ...
s, hard disk
partitions, or
Logical Unit Numbers (LUNs) of an external storage device. Volume management treats each PV as being composed of a sequence of chunks called physical extents (PEs). Some volume managers (such as that in HP-UX and Linux) have PEs of a uniform size; others (such as that in
Veritas
Veritas is the name given to the Roman virtue of truthfulness, which was considered one of the main virtues any good Roman should possess. The Greek goddess of truth is Aletheia (Ancient Greek: ). The German philosopher Martin Heidegger argues ...
) have variably-sized PEs that can be split and merged at will.
Normally, PEs simply map one-to-one to logical extents (LEs). With mirroring, multiple PEs map to 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 or
data buses for maximum redundancy.
The system pools LEs into a ''volume group'' (VG). The pooled LEs can then be concatenated together into virtual disk partitions called logical volumes or
LVs. Systems can use LVs as raw
block devices just like disk partitions: creating mountable
file system
In computing, file system or filesystem (often abbreviated to fs) is a method and data structure that the operating system uses to control how data is stored and retrieved. Without a file system, data placed in a storage medium would be one lar ...
s on them, or using them as
swap storage.
Striped LVs allocate each successive LE 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.
Administrators can grow LVs (by concatenating more LEs) or shrink them (by returning LEs to the pool). The concatenated LEs do not have to be contiguous. This allows LVs to grow without having to move already-allocated LEs. Some volume managers allow the re-sizing of LVs in either direction while online. Changing the size of the LV does not necessarily change the size of a file system on it; it merely changes the size of its containing space. A file system that can be resized online is recommended in that 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 moving them at will between VGs on the same host). This allows administrators conveniently to bring VGs online, to take them offline or to move them 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; if the underlying hardware is hot-pluggable this allows engineers to upgrade or replace storage without system downtime.
Concepts
Hybrid volume
A
hybrid volume is any volume that intentionally and opaquely makes use of two separate physical volumes. For instance, a workload may consist of random seeks so an SSD may be used to permanently store frequently used or recently written data, while using higher-capacity rotational magnetic media for long-term storage of rarely needed data. On Linux,
bcache
bcache (abbreviated from ''block cache'') is a cache in the Linux kernel's block layer, which is used for accessing secondary storage devices. It allows one or more fast storage devices, such as flash-based solid-state drives (SSDs), to act a ...
or
dm-cache may be used for this purpose, while
Fusion Drive
Fusion Drive is a type of hybrid drive technology created by Apple Inc. It combines a hard disk drive with a NAND flash storage ( solid-state drive of 24 GB or more) and presents it as a single Core Storage managed logical volume with the ...
may be used on OS X.
ZFS also implements this functionality at the
file system
In computing, file system or filesystem (often abbreviated to fs) is a method and data structure that the operating system uses to control how data is stored and retrieved. Without a file system, data placed in a storage medium would be one lar ...
level, by allowing administrators to configure multi-level read/write caching.
Hybrid volumes present a similar concept as
hybrid drive
In computing, a hybrid drive (solid state hybrid drive – SSHD) is a logical or physical storage device that combines a faster storage medium such as solid-state drive (SSD) with a higher-capacity hard disk drive (HDD). The intent is adding ...
s, which also combine solid-state storage and rotational magnetic media.
Snapshots
Some volume managers also implement
snapshots
Snapshot, snapshots or snap shot may refer to:
* Snapshot (photography), a photograph taken without preparation
Computing
* Snapshot (computer storage), the state of a system at a particular point in time
* Snapshot (file format) or SNP, a fil ...
by applying
copy-on-write
Copy-on-write (COW), sometimes referred to as implicit sharing or shadowing, is a resource-management technique used in computer programming to efficiently implement a "duplicate" or "copy" operation on modifiable resources. If a resource is dupl ...
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 may be later reconstructed by overlaying the copy-on-write table atop the current LV. Unless the volume management supports both thin provisioning and discard, once an LE in the origin volume is written to, it is permanently stored in the snapshot volume. If the snapshot volume was made smaller than its origin, which is a common practice, this may render the snapshot inoperable.
Snapshots can be useful for backing up self-consistent versions of volatile data such as table files from a busy database, or for rolling back large changes (such as an operating system upgrade) in a single operation. Snapshots have a similar effect as rendering storage
quiescent, and are similar to the
shadow copy (VSS) service in Microsoft Windows.
Some Linux-based
Live CD
A live CD (also live DVD, live disc, or live operating system) is a complete bootable computer installation including operating system which runs directly from a CD-ROM or similar storage device into a computer's memory, rather than loading f ...
s also use snapshots to simulate read-write access to a read-only
optical disc
In computing and optical disc recording technologies, an optical disc (OD) is a flat, usually circular disc that encodes binary data (bits) in the form of pits and lands on a special material, often aluminum, on one of its flat surfaces. ...
.
Implementations
Disadvantages
Logical volumes can suffer from
external fragmentation
External may refer to:
* External (mathematics), a concept in abstract algebra
* Externality, in economics, the cost or benefit that affects a party who did not choose to incur that cost or benefit
* Externals, a fictional group of X-Men antagon ...
when the underlying storage devices do not allocate their PEs contiguously. This can reduce I/O performance on slow-seeking media such as magnetic disks and other rotational media. Volume managers that use fixed-size PEs, however, typically make PEs relatively large (for example,
Linux LVM uses 4 MB by default) in order to
amortize the cost of these seeks.
With implementations that are solely volume management, such as
Core Storage and Linux LVM, separating and abstracting away volume management from the file system loses the ability to easily make storage decisions for particular files or directories. For example, if a certain directory (but not the entire file system) is to be permanently moved to faster storage, both the file system layout and the underlying volume management layer need to be traversed. For example, on Linux it would be needed to manually determine the offset of a file's contents within a file system and then manually the extents (along with data not related to that file) to the faster storage. Having volume and file management implemented within the same subsystem, instead of having them implemented as separate subsystems, makes the overall process theoretically simpler.
Notes
See also
*
Device mapper
References
Sources
* .
* .
* .
* .
* .
* .
*
* {{citation, author=Chris Gibson, title = Using JFS2 snapshots on AIX 6.1, url = http://www.ibm.com/developerworks/aix/library/au-jfs2_snapshot.html, publisher = IBM, year = 2010.
Computer data storage
File system management