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 compute ...
, 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 together or otherwise combine partitions (or
block device
In Unix-like operating systems, a device file or special file is an interface to a device driver that appears in a file system as if it were an ordinary file. There are also special files in DOS, OS/2, and Windows. These special files allow an ...
s 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 singl ...
; 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 services for computer programs.
Time-sharing operating systems schedule tasks for efficient use of the system and may also in ...
(OS) (as opposed to within storage devices or in a network).
Design
![LVM1](https://upload.wikimedia.org/wikipedia/commons/b/ba/LVM1.svg)
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 magnet ...
s, hard disk
partition
Partition may refer to:
Computing Hardware
* Disk partitioning, the division of a hard disk drive
* Memory partition, a subdivision of a computer's memory, usually for use by a single job
Software
* Partition (database), the division of a ...
s, 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 Honesty, truthfulness, which was considered one of the main virtues any good Roman should possess. The Greek goddess of truth is Aletheia (Ancient Greek language, Ancient Greek: ). The German phi ...
) 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 device
In Unix-like operating systems, a device file or special file is an interface to a device driver that appears in a file system as if it were an ordinary file. There are also special files in DOS, OS/2, and Windows. These special files allow an ...
s 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 larg ...
s on them, or using them as
swap
Swap or SWAP may refer to:
Finance
* Swap (finance), a derivative in which two parties agree to exchange one stream of cash flows against another
* Barter
Science and technology
* Swap (computer programming), exchanging two variables in t ...
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
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 ...
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 as ...
or
dm-cache
dm-cache is a component (more specifically, a target) of the Linux kernel's device mapper, which is a framework for mapping block devices onto higher-level virtual block devices. It allows one or more fast storage devices, such as flash-based ...
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 space ...
may be used on OS X.
ZFS
ZFS (previously: Zettabyte File System) is a file system with volume management capabilities. It began as part of the Sun Microsystems Solaris operating system in 2001. Large parts of Solaris – including ZFS – were published under an ope ...
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 larg ...
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 ...
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 file ...
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
quiesce
To quiesce is to pause or alter a device or application to achieve a consistent state, usually in preparation for a backup or other maintenance.
Description
In software applications that modify information stored on disk, this generally involves f ...
nt, and are similar to the
shadow copy
Shadow Copy (also known as Volume Snapshot Service, Volume Shadow Copy Service or VSS) is a technology included in Microsoft Windows that can create backup copies or snapshots of computer files or volumes, even when they are in use. It is imple ...
(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 fro ...
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 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
Amortization or amortisation may refer to:
* The process by which loan principal decreases over the life of an amortizing loan
* Amortization (accounting), the expensing of acquisition cost minus the residual value of intangible assets in a syste ...
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
The device mapper is a framework provided by the Linux kernel for mapping physical block devices onto higher-level ''virtual block devices''. It forms the foundation of the logical volume manager (LVM), software RAIDs and dm-crypt disk encryption, ...
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