Logical Volume Manager (LVM) is a storage management system that lets you allocate and manage disk space for file systems or raw data. Historically, you treated your disks individually and in terms of fixed-sized partitions; each disk or partition held a file system, swap space, boot area, or raw data. With LVM, you do not need to assign a disk or fixed-sized partition to a single purpose. Instead, consider the disks as a pool (or volume) of data storage, consisting of equal-sized extents. Extents are allocated into virtual storage devices known as logical volumes, which can be treated as disks.
An LVM system starts by initializing disks for LVM usage. An LVM disk is known as a physical volume (PV). A disk is marked as an LVM physical volume using either the HP System Management Homepage (HP SMH) or the pvcreate command. Physical volumes use the same device special files as traditional HP-UX disk devices.
LVM divides each physical volume into addressable units called physical extents (PEs). Starting after the LVM metadata at the beginning of the disk, extents are allocated sequentially, with an index starting at zero and incrementing by one for each unit. The physical extent size is configurable at the time you form a volume group and applies to all disks in the volume group. You can select a size from 1 MB to 256 MB.
Physical volumes are organized into volume groups (VGs). A volume group can consist of one or more physical volumes, and there can be more than one volume group in the system. Once created, the volume group, not the disk, is the entity that represents data storage. Thus, whereas earlier you moved disks from one system to another, with LVM, you move a volume group from one system to another. Therefore, it is often convenient to have multiple volume groups on a system.
The pool of disk space that is represented by a volume group can be divided into logical volumes (LVs) of various sizes. Once created, logical volumes can be treated just like disk partitions. They are accessible through device special files. A logical volume can span a number of physical volumes in a volume group or represent only part of one physical volume.
The basic allocation units for a logical volume are called logical extents (LEs). A logical extent is mapped to a physical extent. Thus, if the physical extent size is 4 MB, the logical extent size is also 4 MB. The size of a logical volume is determined by the number of logical extents configured.
Starting with volume group Version 2.2, LVM introduced a new type of logical volume: snapshot logical volume. Snapshots are point-in-time image of a logical volume. Snapshots allow you to create another copy of the logical volume (which can be used for a backup) without taking up as much of the physical space as the size of the logical volume. See “Creating and Administering Snapshot Logical Volumes”.
All LVM components are represented by device special files located in the /dev directory. Device special files act as agents for managing the interactions with the disk space. The LVM device files are created by both HP SMH and HP-UX commands. This section describes the device special files used by LVM, and naming conventions for LVM objects
A cluster device special files provides a consistent set of device special files across a set of cluster nodes. The cluster device special files of a LUN will be the same on any node in a specified set of nodes that share the LUN. The set of cluster nodes across which cluster device special files need to be created can be specified using the cmsetdsfgroup command. The cluster device special files can be displayed using the io_cdsf_config command.
Each volume group must have a unique name, up to 255 characters. For example, typical volume group names are vg01, vgroot, or vg_sales. Although the name does not need to start with vg, HP recommends using this prefix. By default, HP SMH uses the names of the form /dev/vgnn.
The number nn starts at 00 and is incremented in the order that volume groups are created. By default, the root volume group is vg00.
Logical volumes are identified by their device file names, which can either be assigned by you or assigned by default when you create a logical volume using the lvcreate command.
LVM is a sophisticated subsystem. It requires time to learn, it requires maintenance, and in rare cases, things can go wrong.
HP recommends using logical volumes as the preferred method for managing disks. Use LVM on file and application servers. On servers that have only a single disk and are used only to store the operating system and for swap, a “whole-disk” approach is simpler and easier to manage. LVM is not necessary on such systems.
By default, LVM configurations are automatically backed up each time you change them, in the default directory, /etc/lvmconf. Mirroring provides insurance against data loss that is not available under the whole-disk method.
Shared LVM (SLVM) allows multiple systems in a Serviceguard cluster to share (read/write) disk resources in the form of volume groups. SLVM is designed to be used by specialized distributed applications that use raw access to disks, rather than going through a file system.
Shared mode is configured with the vgchange command. The vgdisplay command will show the current activation mode for the volume group.