November 16, 2001, 12:00 AM — A partition is a set of contiguous blocks on a physical disc whose size
and location are static. The tight coupling between a partition and its
physical layout has been a major source of inconveniences for both
users and sysadmins. System installers have to predict how much data a
partition will ever need to store; if they run out of space on a
partition, they will have to repartition (and consequently, reinstall
the system) or use symbolic links.
Repartitioning a system with a single hard-drive is a snag. You are
probably familiar with situations where a file system is nearing its
maximal capacity and you wish you could magically extend the partition.
Now imagine the drudgery of managing a server with 50 disks and their
partitions. This is where a logical volume (LVM) manager comes in
handy. The LVM project's goal was to implement a flexible, virtual-disk
subsystem to handle disk storage and online allocation, expansion and
shrinking of storage space.
Logical vs. Physical Representations
An LVM adds an additional layer between the physical storage devices
and the kernel's I/O interfaces. It bundles multiple disks (known
as "physical volumes", or PVs in LVM parlance) to form a "volume group"
(VG or volg) with allocation units called "physical extents" (PEs).
Thus, a user can split physical discs into an arbitrary number of
logical units or pool several physical disks into a single logical unit.
Portions of volume groups can be allocated in the form of logical
volumes (lvols, the logical equivalent of a partition) in units
called "logical extents" (LEs), where each logical extent is mapped to
a corresponding physical extent of equal size. The physical extents in
turn are mapped to offsets and blocks on the physical disk(s). As the
volume groups and logical volumes are a virtual representation of hard
disks and partitions, you can easily expand or shrink a logical volume,
even at run-time.
Under the hood
The LVM operates as follows: when you define volume groups and logical
volumes, it records configuration information for each of these logical
entities in the corresponding physical volume. A backup copy of this
information is automatically placed under the /etc/lvmtab.d directory.
Starting with kernel 2.3.47, Linux has a built-in LVM driver that
maintains mapping tables between the volume groups and logical volumes
and their corresponding physical disks and partitions. Special LVM
commands (that only a root user can execute) create and modify these
tables. Whenever a process accesses a file block on an LVM-managed
logical volume, the driver uses these tables to map the block to its
real address on the disk. Read more on the Linux LVM here: