A hierarchy of structures is used to manage fixed-disk storage. Each individual fixed-disk drive, called a physical volume (PV) has a name, such as /dev/hdisk0 . Every physical volume in use belongs to a volume group (VG). All of the physical volumes in a volume group are divided into physical partitions (PPs) of the same size (by default 2MB in volume groups that include physical volumes smaller than 300MB, 4MB otherwise). For space-allocation purposes, each physical volume is divided into five regions (outer_edge, inner_edge, outer_middle, inner_middle and center). The number of physical partitions in each region varies, depending on the total capacity of the disk drive.
Within each volume group, one or more logical volumes (LVs) are defined. Logical volumes are groups of information located on physical volumes. Data on logical volumes appears to be contiguous to the user but can be discontiguous on the physical volume. This allows file systems, paging space, and other logical volumes to be resized or relocated, span multiple physical volumes, and have their contents replicated for greater flexibility and availability in the storage of data.
Each logical volume consists of one or more logical partitions (LPs). Each logical partition corresponds to at least one physical partition. If mirroring is specified for the logical volume, additional physical partitions are allocated to store the additional copies of each logical partition. Although the logical partitions are numbered consecutively, the underlying physical partitions are not necessarily consecutive or contiguous.
Logical volumes can serve a number of system purposes, such as paging, but each logical volume that holds ordinary system or user data or programs contains a single journaled file system (JFS). Each JFS consists of a pool of page-size (4KB) blocks. When data is to be written to a file, one or more additional blocks are allocated to that file. These blocks may or may not be contiguous with one another or with other blocks previously allocated to the file. In AIX 4.1, a given file system can be defined as having a fragment size of less than 4KB (512 bytes, 1KB, 2KB).
After installation, the system has one volume group (the rootvg volume group) consisting of a base set of logical volumes required to start the system and any others you specify to the installation script. Any other physical volumes you have connected to the system can be added to a volume group (using the extendvg command). You can add the physical volume either to the rootvg volume group or to another volume group (defined by using the mkvg command). Logical volumes can be tailored using the commands or the menu-driven System Management Interface Tool (SMIT) interface.
This overview contains information about the following:
The five basic logical storage concepts are physical volumes, volume groups, physical partitions, logical volumes, and logical partitions. The Volume Group figure illustrates the relationships among these concepts.
A disk must be designated as a physical volume and be put into an available state before it can be assigned to a volume group. A physical volume has certain configuration and identification information written on it. This information includes a physical volume identifier that is unique to the system. When a disk becomes a physical volume, it is divided into 512-byte physical blocks. You designate a disk as a physical volume with the mkdev or chdev commands or by using the System Management Interface Tool (SMIT) to add a physical volume.
The first time you start up the system after connecting a new disk, the operating system detects the disk and examines it to see if it already has a unique physical volume identifier in its boot record. If it does, the disk is designated as a physical volume and a physical volume name (typically, hdiskx where x is a unique number on the system) is permanently associated with that disk until you undefine it.
The physical volume must now become part of a volume group. A volume group is a collection of 1 to 32 physical volumes of varying sizes and types. A physical volume may belong to only one volume group per system; there can be up to 255 volume groups per system.
When a physical volume is assigned to a volume group, the physical blocks of storage media on it are organized into physical partitions of a size you specify when you create the volume group. Physical partitions are discussed below.
When you install the system, one volume group (the root volume group, called rootvg) is automatically created. The rootvg contains a base set of logical volumes required to start the system plus any other logical volumes you specify to the install script. The rootvg volume group includes paging space, the journal log, boot data, and dump storage, each in its own separate logical volume. The rootvg has attributes that differ from other, user-defined volume groups. For example, the rootvg cannot be imported or exported. When performing a command or procedure on the rootvg, you need to be familiar with its unique characteristics.
You create a new volume group with the mkvg command. You add a physical volume to a volume group with the extendvg command and remove it from a volume group with the reducevg command. Some of the other commands that you will be using on volume groups include: change (chvg), list (lsvg), remove (exportvg), install (importvg), reorganize (reorgvg), synchronize (syncvg), make available for use (varyonvg), and make unavailable for use (varyoffvg).
Small systems may require only one volume group to contain all the physical volumes attached to the system. You may want to create separate volume groups, however, for security reasons, because each volume group can have its own security permissions. Separate volume groups also make maintenance easier because groups other than the one being serviced can remain active. Because the rootvg must always be online, it should contain only the minimum number of physical volumes necessary for system operation.
You can move data from one physical volume to other physical volumes in the same volume group with themigratepv command. This command allows you to free a physical volume so it can be removed from the volume group. For example, you could move data off of a physical volume that is to be replaced.
When you add a physical volume to a volume group, the physical volume is partitioned into contiguous, equal-sized units of space called physical partitions. A physical partition is the smallest unit of storage space allocation and is a contiguous space on a physical volume.
Physical volumes inherit the volume group's physical partition size, which you can set only when you create the volume group (for example, using the mkvg -s command). A Volume Group Containing Three Physical Volumes shows the relationship between physical partitions on physical volumes and volume groups.
After you create a volume group, you can create logical volumes within that volume group. A logical volume, although it may reside on noncontiguous physical partitions or even on more than one physical volume, appears to users and applications as a single, contiguous, extensible disk volume. You can create additional logical volumes with the mklv command. This command allows you to specify the name of the logical volume and define its characteristics, including the number and location of logical partitions to allocate for it. After you create a logical volume, you can change its name and characteristics with the chlv command, and you can increase the number of logical partitions allocated to it with the extendlv command. The default maximum size for a logical volume at creation is 128 logical partitions, unless specified to be larger. The chlv command is used to relax this limitation.
Note: After you create a logical volume, the characteristic LV STATE, which can be seen using the lslv command, will be closed . It will become open when, for example, a file system has been created in the logical volume and mounted.
Logical volumes can also be copied (cplv), listed (lslv), removed (rmlv), and have the number of copies they maintain increased or decreased (mklvcopy and rmlvcopy). They can also be relocated when the volume group is reorganized.
The system will allow you to define up to 256 logical volumes per volume group, but the actual number you can define depends on the total amount of physical storage defined for that volume group and the size of the logical volumes you define.
When you create a logical volume, you specify the number of logical partitions for the logical volume. A logical partition is one, two, or three physical partitions, depending on the number of instances of your data you want maintained. Specifying one instance means there is only one copy of the logical volume (the default). In this case, there is a direct mapping of one logical partition to one physical partition. Each instance, including the first, is termed a copy. Where physical partitions are located (for example, how near each other physically) is determined by options you specify when you create the logical volume.
The logical volume defines allocation of disk space down to the physical-partition level. Finer levels of data management are accomplished by higher level software components such as the Virtual Memory Manager or the file system. Therefore, the final step in the evolution of a disk is the creation of file systems. You can create one file system per logical volume. To create a file system, use the crfs command. For more information on file systems, see "File Systems Overview" .
The following table shows the limitations for logical storage management. Although the default maximum number of physical volumes per volume group is 32, you can set the maximum for user-defined volume groups when you use the mkvg command. For the rootvg, however, this variable is automatically set by the system during an installation. The actual maximum is based on the number of physical volumes in the rootvg at the time of the installation, and the volume group descriptor area (VGDA) space is fixed to allow it to fit into memory when booting. After adding one or two disks to the rootvg (using the extendvg command), the VGDA space may get filled, and you may get an error. To be able to add more physical volumes to the rootvg, you must reinstall with all of the new disks attached to the system. This applies only to the rootvg. This is one of the reasons for the recommendation that all physical volumes not needed for installation be in one or more user-defined volume groups, not in the rootvg.
Limitations for Logical Storage Management | |
Volume group | 255 per system |
Physical volume | (32 / volume group factor) per volume group |
Physical partition | (1016 x volume group factor) per physical volume up to 1024MB each in size. |
Logical volume | 256 per volume group |
Logical partition | 32,512 per logical volume |
If you previously created a volume group before the 1016 physical partitions per physical volume restriction was enforced, stale partitions in the volume group are not correctly tracked unless you convert the volume group to a supported state. You can convert the volume group with the chvg -t command. A suitable factor value is chosen by default to accommodate the largest disk in the volume group.
For example, if you created a volume group with a 9GB disk and 4Mb partition size, this volume group will have approximately 2250 partitions. Using a conversion factor of 3 (1016 * 3 = 3048) allows all 2250 partitions to be tracked properly. Converting a volume group with a higher factor enables inclusion of a larger disk of partitions up to the 1016* factor. You can also specify a higher factor when you create the volume group in order to accommodate a larger disk with a small partition size.
These operations reduce the total number of disks that you can add to a volume group. The new maximum number of disks you can add would be a 32/factor. For example, a factor of 2 decreases the maximum number of disks in the volume group to 16 (32/2).
Note: Once you convert a volume group, you cannot import it back to any level prior to AIX Version 4.3.1.
The set of operating system commands, library subroutines, and other tools that allow you to establish and control logical volume storage is called the Logical Volume Manager (LVM). The Logical Volume Manager (LVM) controls disk resources by mapping data between a more simple and flexible logical view of storage space and the actual physical disks. The LVM does this using a layer of device driver code that runs above traditional disk device drivers.
The Logical Volume Manager (LVM) consists of the logical volume device driver (LVDD) and the LVM subroutine interface library. The logical volume device driver (LVDD) is a pseudo-device driver that manages and processes all I/O. It translates logical addresses into physical addresses and sends I/O requests to specific device drivers. The LVM subroutine interface library contains routines that are used by the system management commands to perform system management tasks for the logical and physical volumes of a system. The programming interface for the library is available to anyone who wishes to expand the function of the system management commands for logical volumes.
For more information about how LVM works, see "Understanding the Logical Volume Device Driver" in AIX Version 4 Kernel Extensions and Device Support Programming Concepts and "Logical Volume Programming Overview" in AIX Version 4 General Programming Concepts: Writing and Debugging Programs.
The following sections describe the vary-on process and the quorum, which are how the LVM ensures that a volume group is ready to use and contains the most up-to-date data.
The varyonvg and varyoffvg commands activate or deactivate (make available or unavailable for use) a volume group that you have defined to the system. The volume group must be varied on before the system can access it. During the vary-on process (activation), the LVM reads management data from the physical volumes defined in the volume group. This management data, which includes a volume group descriptor area (VGDA) and a volume group status area (VGSA), is stored on each physical volume of the volume group.
The VGDA contains information that describes the mapping of physical partitions to logical partitions for each logical volume in the volume group, as well as other vital information, including a time stamp. The VGSA contains information such as which physical partitions are stale and which physical volumes are missing (that is, not available or active) when a vary-on operation is attempted on a volume group.
If the vary-on operation cannot access one or more of the physical volumes defined in the volume group, the command displays the names of all physical volumes defined for that volume group and their status. This helps you decide whether to continue operating with this volume group. For more information about the meanings of the physical volume status that can be displayed from the varyonvg command, refer to the lvm_varyonvg subroutine.
A quorum is a vote of the number of Volume Group Descriptor Areas and Volume Group Status Areas (VGDA/VGSA) that are active. A quorum ensures data integrity in the event of a disk failure. Each physical disk in a volume group has at least one VGDA/VGSA. When a volume group is created onto a single disk, it initially has two VGDA/VGSA areas residing on the disk. If a volume group consists of two disks, one disk still has two VGDA/VGSA areas, but the other disk has one VGDA/VGSA. When the volume group is made up of three or more disks, then each disk is allocated just one VGDA/VGSA.
A quorum is lost when enough disks and their VGDA/VGSA areas are unreachable so that a 51% majority of VGDA/VGSA areas no longer exists. In a two-disk volume group, if the disk with only one VGDA/VGSA is lost, a quorum still exists because two of the three VGDA/VGSA areas still are reachable. If the disk with two VGDA/VGSA areas is lost, this statement is no longer true. The more disks that make up a volume group, the lower the chances of quorum being lost when one disk fails.
When a quorum is lost, the volume group varies itself off so that the disks are no longer accessible by the Logical Volume Manager (LVM). This prevents further disk I/O to that volume group so that data is not lost or assumed to be written when physical problems occur. Additionally, as a result of the vary off, the user is notified in the error log that a hardware error has occurred and service must be performed.
There are cases when it is desirable to continue operating the volume group even though a quorum is lost. In these cases, quorum checking may be turned off for the volume group. This type of volume group is referred to as a nonquorum volume group. The most common case for a nonquorum volume group is when the logical volumes have been mirrored. When a disk is lost, the data is not lost if a copy of the logical volume resides on a disk that is not disabled and can be accessed. However, there can be instances in nonquorum volume groups, mirrored or nonmirrored, when the data (including copies) resides on the disk or disks that have become unavailable. In those instances, the data may not be accessible even though the volume group continues to be varied on.
Attention: Overriding a vary-on failure is an unusual operation; all other possible problem sources such as hardware, cables, adapters, and power sources should be checked before proceeding. Overriding the quorum failure during a vary-on process should be used only in an emergency and only as a last resort (for example, to salvage data from a failing disk). Data integrity cannot be guaranteed for management data contained in the chosen copies of the VGDA and the VGSA when a quorum failure is overridden.
When you choose to forcibly vary on a volume group by overriding the absence of a quorum, the PV STATE of all physical volumes that are missing during this vary-on process will be changed to removed . This means that all the VGDA and VGSA copies will be removed from these physical volumes. Once this is done, these physical volumes will no longer take part in quorum checking, nor will they be allowed to become active within the volume group until you return them to the volume group.
Under one or more of the following conditions, you may want to override the vary-on failure so that the data on the available disks in the volume group can be accessed:
The following procedure provides a way to avoid losing quorum when one disk is missing or may soon fail and requires repair.
Note: The chpv command is used only for quorum-checking alteration. The data that resides on the disk is still there and must be moved or copied to other disks if the disk is not to be returned to the system.
The Logical Volume Manager (LVM) automatically deactivates the volume group when it lacks a quorum of VGDAs or VGSAs. However, you can choose an option that allows the group to stay online as long as there is one VGDA/VGSA intact. This option produces a nonquorum volume group. The LVM requires access to all of the disks in nonquorum volume groups before allowing reactivation to ensure up-to-date VGDA and VGSA.
You might want to use this procedure in systems where every logical volume has at least two copies.
If a disk failure occurs, the volume group remains active as long as there is one logical volume copy intact on a disk.
Note: Both user-defined and rootvg volume groups can operate in nonquorum status, but the methods used to configure user-defined volume groups and rootvg volume groups as nonquorum and for recovery after hardware failures are different. Be sure you use the correct method for the appropriate volume group.