first, the basic concept
1) Physical volume (physical VOLUME,PV): Direct access to the device (directly access Storage DEVICE,DASD) with fixed and mobile points. The representative DASD is the hard disk, the hard disk is divided into internal hard disk and extended hard disk, the own hard disk is used to install AIX operating system, extended hard disk is used to store data, mainly to hold user data. A hard disk is a physical volume, and the number of hard disks in the device is the number of physical volumes. Physical volumes are generally in the form of HDISKN.
2) Volume Group (Volume GROUP,VG): The largest storage unit in an AIX system, a volume group consisting of a set of hard disks in a house, i.e. one or more physical volumes. AIX4.3.3 and previous versions, a VG up to 32 pv,aix5l, can have up to 128 PV. A system, at least one VG, which is ROOTVG,ROOTVG is the most basic Vg,bos installed in ROOTVG, ROOTVG in the installation of the operating system when created. In addition to ROOTVG, you can create additional volume groups, and if a device has only two PV, create a maximum of two VG (because ROOTVG must have, and at least one PV).
3) Physical partition (physical partition,pp): Divides PV into contiguous, size equivalent storage units. The VG is made up of PP, and all the PP in a VG are equal in size . PP is the smallest allocation unit on PV.
4) logical partition (Logical PARTITION,LP): LP is the logical unit for mapping pp. A LP can correspond to a PP, or it can correspond to multiple pp. The corresponding PP for LP is the place where the data is actually stored, but the file system level only sees LP. In a VG, the LP size is the same as the PP size, and the default is 4MB. The size range of PP and LP is 1MB to 1024MB. From a user perspective/application perspective, LP is continuous, and the PP mapped by LP is transparent to the user/application, and PP may be discontinuous.
5) Logical Volume (Logical volume,lv): Refers to a set of multiple LP in a VG, in a LV, LP is continuous, but the LP map of PP is continuous unknown. Therefore: All into LV pp can be on a PV, can also exist on more than one PV, if the equivalence is distributed on multiple PV, it constitutes what we call the mirror. --LV is a logical space, a storage structure for users and applications, and PV is a physical space, a storage structure for the operating system and the machine, between them through the mapping relationship between the PP and LP .
6) filesystem (file System,fs): FS is a user-oriented storage space in an AIX system, a filesystem is a directory tree, and users can create subdirectories and files in the file system. AIX manages the storage space through the LV, but the user cannot read and write to the LV through commands in the operating system, and only if FS is established on the LV, the user can complete the access to the LV by the operation of FS ( Therefore, we often call a LV with no FS as the health device or raw equipment or bare equipment, corresponding to the concept of raw equipment, FS called the cooked equipment )
A LV corresponds to a FS, a LV can only establish one FS, delete the LV, and also delete the upper established FS.
second, storage institutions
In Aix systems, the file system is built on the LV, the LV belongs to a certain VG, and the VG is composed of one or several PV. LV is not contiguous in the actual physical hard disk, it can exist across multiple physical hard disks (PV). The system administrator can dynamically change the size of the LV, LV can also be mirror, so in the AIX system can dynamically increase the space of FS, copy FS. In Aix, the VG is the largest storage unit, and system administrators can easily add hard disks to the VG and dynamically allocate all the LVS in a VG. Storage Management in Aix systems is done by the Logical Volume Manager (LVM).
The LV is a collection of information located on the PP, typically created on the LV with a journaled file system (JFS), page space (Paging spaces), logging (Journal log), or a boot logical volume (boot Logical Volume) . LP on LV can be mapped to a PP, or to multiple PP, this way becomes a logical volume image (mirroring). Under Mirroring, you can create 2 to 3 PP for one LP. If you do not do mirror, then LP and PP are one by one corresponding. LP in LV is continuous for the user, and is arranged in order, but the corresponding physical partition can be scattered and unordered.
Aix's storage management is controlled from the bottom up to the top level by LVM . AIX systems are low to high and consist of PV, VG, PP, LP, LV,FS, directories, and files. Which PV, VG, PP, LP, LV is the concept of operating system-oriented. While FS, directory, files are user-oriented concepts.
third, Logical Volume Manager (LVM)
1) LVM consists of each of the following components:
• High-level commands-located in/usr/sbin, most of them are shell scripts or binary programs written by C.
• Middle-tier commands-called by high-level commands, are located in/usr/sbin, all binary programs.
· LVM Interface Function Library
• Logical Volume device driver (Logical Volume device DRIVER,LVDD)
• Disk device drivers
• Adapter device drivers
2) configuration data for LVM
The Volume Group description area (VGDA), the Volume Group status area (Vgsa), and the Logical Volume Control block (LVCB) Form the configuration data for the LVM.
The Vgda and VGSA data for the VG belonging to the physical volume are stored at the beginning of each PV. Vgda is a volume group description area information that contains all the LV and PV in the VG. Vgsa is the volume group status area information that contains the status information for PV and PP in the VG. Vgda recorded in the VG of each LV LP and PP mapping relationship, when activating a VG, VGSA can determine which pp in the VG is invalid (stale), which PV has been lost, in order to determine whether the PV is available in the VG.
Both Vgda and Vgsa have a start timestamp and an end timestamp, which can be used to determine which Vgda and Vgsa are up-to-date when a VG is activated. LVM requires the same timestamp for the selected Vgda and Cgsa.
The AIX system reads Vgda from a hard disk to find out which PV and LV the VG contains, and the Vgda on all PV in a volume group are the same, meaning Vgda can synchronize. If a hard disk in the VG fails to run, it can cause Vgda to fail to sync and update the VGDA on the hard disk. Therefore, when you restore a damaged hard disk, and then activate the volume group, update the VGDA data on the hard disk.
When turning a hard disk into PV, the hard disk has a space to store Vgda, and when the PV is added to the VG, the specific information of Vgda is written to this area. When the PV is removed from the VG, at the same time the Vgda information is deleted.
The information describing the composition of the LVM is not stored in one place, and the data about the VG and LV,PV are stored in various parts of the operating system. Most of the system configuration information for AIX resides in the ODM database. The Import/export volume group needs to delete/Add Vgda information to the ODM database at the same time.
The logical Volume Control block (LVBC) is at the beginning of each logical volume, which contains information about the logical volume and accounts for hundreds of bytes.
Four, disk quorum
When a volume group contains only one PV, then this PV contains two copies of Vgda and VGSA information; If a VG is created on two PV, the VG's hard disk contains two copies of Vgda and Vgsa, and the other hard disk contains a Vgda and Vgsa If a VG is composed of three or more PV, each PV contains a copy of Vgda and Vgsa.
Disk Quorum is a volume group in the normal access to the number of Vgda and vgsa copies of the volume group of Vgda and Vgsa the ratio of the total number of copies, opened the disk quorum VG, only if the ratio is greater than 51%, the VG can be activated. One thing to note, the two PV combination of VG, if that contains two parts of Vgda and Vgsa PV hanging off, then there is lost 66%, this time, this VG can not be activated. Therefore, the volume group of three or more disks can provide high reliability.
You can turn off the disk quorum feature on any VG and turn off the check function of the disk quorum to ensure that the volume group is still active if most Vgda and Vgsa or disk quorum are lost. This is where the volume group works-it provides a cheap image-making scheme, but increases the risk of losing data.
v. Limitations of logical storage management
Vi. Physical Volume (PV)
Before adding a hard drive to a VG, you must configure the hard disk in the system as PV, assign it a unique physical volume identifier and physical volume name, and make it available. When a hard disk becomes PV, it is divided into 512-byte-sized physical blocks.
Depending on the location of the logical volume on the hard disk, it can be said that the hard disk section is divided into 5 concentric areas: outer edge (Outer-edge), outer Middle (outer-middle), Central (center), Inner Middle (inner-middle), Inner Edge (Inner-edge)
The Edge region has the longest search time, so it is unwise to choose the data that is frequently accessed by the application at the edge, and the shortest time to search in the central area, where the most commonly used data should be placed.
to add a hard disk to the system:
1) method One: After adding the hard disk offline, the system automatically runs cfgmgr after the boot, and then enter the system LSPV view, if found that the newly discovered PV does not pvid, then need to execute the following command (assuming Hdisk2):
#chdev-L hdisk2-a pv=yes----> This command assigns a unique pvid to the hard disk Hdisk2 and writes pvid to the boot record of the drive.
2) Method Two: After adding the hard disk online, run #cfgmgr-no pvid, then, LSPV view the newly added hard disk, if it still appears
If there is no pvid hard drive, then use method one manually added to PV.
3) Method Three: If the cfgmgr also cannot recognize the hard disk, you need to Mkdev or #smitty Makdsk manually add the hard drive.
to migrate content on a physical volume:
#lsvg-P ROOTVG----> see which PV is included in the volume group
#lsdev-CC Disk----> lists which PV systems are in the system
#extendvg ROOTVG hdisk2----> Add this new PV to ROOTVG
#lspv hdisk0|grep-i "used pps"----> See how much pp Hdisk0 used.
#lspv hdisk2|grep-i "free pps"----> See how many pp Hdisk2 there are, and if the number is more than Hdisk0, then you can move
#lspv-L hdisk0|grep HD5----> see if the boot logical volume is on Hdisk0
#migratepv-L HD5 hdisk0 hdisk2----> If so, migrate this boot logical volume to Hdisk2
#bosboot-a-d/dev/hdisk2----> Setting up a boot image on the Hdisk2
#bootlist-M normal hdisk2----> Add hdisk2 to boot device list
#mkboot-C-d/dev/hdisk0----> Delete the original hdisk0, (the command is not recommended, that is not recommended, it is generally such a hard drive should be unplugged)
#smitty MIGRATEPV----> If you are not migrating ROOTVG data, but rather a user-defined VG data, do this directly
#reducevg vgname HDISKN----> Remove a PV from the VG
#rmdev-dl HDISKN----> Remove a PV from the system completely
Seven, Volume Group (VG)
When the system is installed, a ROOTVG volume group is created, and a system can have only one ROOTVG. The volume group is best to include only the internal hard disk, because the extended hard drive can be moved, and it needs to be configured after the move, and the logical volumes in the ROOTVG volume group are affected accordingly.
There are several things to consider when creating a volume group:
1) The volume group name must be unique, preferably to reflect the role of the volume group
2) Make sure that the VG contains which PV,PV are in a usable state in the system and are not used by other VG
3) determine the new VG PP size, the range is 1MB-1024MB, because a PV contains up to 1016 PP, so if a VG contains a more than 4.5G of PV, then PP must be greater than 4MB
4) Whether the new VG is activated automatically when the system starts
5) To determine the maximum number of PV that can be accommodated in the new VG.
LTG (Logical track Group, logical record Group)
LTG is a concept in disk write operations, which is equivalent to the maximum number of transmission units that allow disk I/O. Any write operations that exceed LTG size are automatically decomposed into multiple LTG-sized writes.
LTG is a property of a volume group, and a volume group has a fixed LTG size. There may be multiple physical volumes in a volume group, and if the types of physical volumes are different, the maximum allowable LTG size for the volume group is the smallest transmission unit that all disks in the volume group can support.
5L previous system, only support 128k LTG size, 5L LTG can take different values, the default is still 128kb,5l now support 128KB,256KB,512KB and 1024KB, etc.
hot spare feature for setting volumes
In aix5l, you can define a disk in a volume group as a hot backup disk and specify a hot backup policy when the disk fails. Both the CHPV and CHVG commands add an-h parameter to this parameter, which is to define a hot backup disk in a volume group and specify a hot backup policy. These commands do not replace the available features of the SSAS disk entirely, but rather complement it, and you can use SSAS disks when you add a hot spare disk to a volume group.
#chvg-H hotsparepolicy -S syncpolicy Volumegroup
Among them, the Hotsparepolicy parameter has 4 kinds of values:
y----> automatically migrates partition content on a failed disk to a hot spare disk. If there are multiple hot spare disks (typically called hot backup disk pools) in a volume group, a disk with the smallest capacity and enough to replace the failed disk is selected from it.
• N----> does not automatically migrate physical partition content, this is the default policy for volume groups
· Y----> automatically migrates partition content on a failed disk to a hot backup disk, but may use all disks in a hot-backed disk pool
• R----> Delete all disks in a hot-backed disk pool
There are two types of synpolicy parameters
y----> automatically try to sync old partitions
• N----> does not automatically attempt to synchronize the old partition, the volume group default mode.
Import/Export a volume group
In the AIX system, the definition information of the device is stored in the system's ODM database, import a volume group, that is, the definition of the volume group is imported into the system, and stored in the ODM database, so that the system can recognize the volume group; Export a volume group to delete the definition information of this volume group from the system's ODM database , but its organizational structure still exists in the Vgda of each physical volume in the volume group--Exporting a volume group does not delete the data on that volume group, but deletes the definition information about the volume group in the ODM.
1) Before exporting a volume group, you must first deactivate the VG with the VARYOFFVG command
2) #exportvg datavg----> This command simply deletes the definition information for the DATAVG volume group from the ODM database and does not delete the data in the volume group
3) The EXPORTVG command removes the file systems from the /etc/filesystem in the volume group and does not remove the installation points for these file systems
4) If you want to export a volume group that contains page space (Paging spaces), you will also need to change the page space to an inactive state:
#swapoff paging_space_name This command only shows the system after 5L, 5L of the previous system, requires #chps-a N paging_space_name so that the page space will not be automatically started, and then restart the system
5) #importvg-y datavg hdisk5----> The command imports DATAVG into the target system, the IMPORTVG command must have a PV name (this is HDISK5), IMPORTVG will automatically find all the other PV in the volume group through the Vgda of this PV.
6) When the specified volume group name already exists on the target system, the IMPORTVG command will fail with the need to reassign the new distinct volume group name, and if you do not specify the volume group name with the-y parameter, the system assigns a default name to the volume group to be imported.
redefining volume groups in ODM
The information in the device configuration database is consistent with the information in the logical Volume Manager on the physical volume retention area during normal system operation. The device configuration database is part of the ODM database, and each physical volume starts with the configuration information for the volume group that this physical volume belongs to, typically the Vgda and VGSA information on the physical volume. These two kinds of information must be consistent under normal circumstances, if the ambiguity occurs, you can use the REDEFINEVG command to synchronize the information between the device configuration database and the specific volume group, the physical volume
#redefinevg-D hdisk0 ROOTVG----> where hdisk0 is any of the physical volumes in the ROOTVG volume group that is used to read Vgda information from Vgid.
There is also an easy way to restore the definition information for a volume group in the ODM database: First varyoff the VG, then EXPORTVG, in IMPORTVG, and finally Varyon this VG
To re-create a volume group with the RECREATVG command
When you want to complete a copy from one disk to another, if the original disk is a physical volume that already exists in the volume group, the destination disk is mirrored on the original disk, and a new volume group is created on the target disk (the mirrored disk that was created), and the new group name is required to be unique in the system. Then you need to use the RECREATVG command.
When a disk copy is made directly using the DD command, all information on one disk (including Vgda and LV) is copied to the other disk, resulting in two identical disks, which cannot be used if the volume group is not created on the target disk. Because if the volume group is imported directly with the target disk, the volume group ID, the logical Volume ID, and the file system mount point conflict will be created in the system. With the RECREATVG command, you can avoid duplicate volume groups, logical volumes, and file system installation points.
#chdev-L hdiskn-a pv=clear----> clears the target disk pvid because this pvid is the identifier of the source physical volume
#recreatevg-y newvg_name-l/newfs-y newlv hdiskn---->newvg_name is the newly assigned volume group name, and NEWLV and NEWFS are the prefixes of the newly assigned logical volume names and file system names in this volume group, which are preceded The prefix is used to modify the original logical volume name and the original file system name.
Mirror a volume group
By default, the MIRRORVG command mirrors the logical volume to any disk in the volume group if you want to save the mirrored copy to the specified physical volume, you must indicate these PV lists. When you mirror a logical volume with MIRRORVG, it enforces a strict mirroring policy.
If you want to mirror ROOTVG, you must execute the bosboot,bootlist and reboot commands. Bosboot is used to create a boot record on a new mirrored drive, and bootlist is used to customize a list of boot devices that are easy to boot from a mirrored device. Finally, because the MIRRORVG command turns off the ROOTVG quorum function by default, you need to restart the system with the reboot command (ROOTVG command for the VARYOFFVG volume group)
If you are mirroring a volume group that is not a ROOTVG volume group, the MIRRORVG command turns off the quorum feature of the volume group by default, so the user must close all logical volumes and then perform VARYOFFVG and VARYONVG commands on the volume group. Let the volume group continue to work with its original quorum setting (open or closed).
The system's dump device should not be mirrored, the MIRRORVG command detects that the dump device and the page device, will automatically mirror the logical volume device, when the MIRRORVG detects that the dump device and the page device is not the same, it will automatically mirror the page device, However, the dump device is not automatically mirrored.
#unmirrorvg [-C Copies] volumegroup [Physicalvolume]. ---->-C is used to specify the number of mirrors remaining after the UNMIRRORVG command executes. If you want to remove the specified PV, specify it at Physicalvolume.
Eight, logical Volume (LV)
Logical volumes consist of logical Partitions (LP), one LP maps a PP, and if done mirror, then one LP maps multiple pp.
Logical volume size (MB) =pp size (MB) *LV contains the number of LP
Logical volume physically occupies physical space (MB) =pp size (MB) *LV contains mirror number of LP number *LV
The logical Volume Control block (LVCB) holds important information about the logical volume, which is located at the beginning of the logical volume, occupies 512 bytes, contains information such as the LV creation date, the number of mirrored copies of the LV, and the installation point (as long as the JFS file system is created on the LV).
In most cases, the user creates a bare logical volume in order to allow the application to access the LV directly. The application may often overwrite the LVCB content of the LV, but the user can still perform read and write operations on the bare logical volume. Bare Logical Volume Primary User database management system. The database management system has direct access to bare logical volumes, which store data on bare logical volumes. Database management system can improve the performance of database by using bare device to store data.
In Aix systems, to back up bare devices can only be used with the DD command, when backed up with the DD command, be careful not to damage the LVCB of the bare logical volume.
policies that affect the performance of logical volumes
1) disk internal allocation policy
2) allocation policy between disks: distribution range, strict allocation policy
3) I/O operation scheduling policy: sequential (sequential), parallel (parallel), parallel/sequential (parallel/sequential), Parallel/round bobin (parallel/loop)
4) Write Validation policy
Stripe technology : RAID0 inside Aix
Mirrored write Consistency (MWC)
1) Active MWC: In Memory a LTG (Logical track Group, logical record Group) write operations table, abbreviated LTG table, while in a separate area of the disk also holds a LTG table, this individual area becomes the checkpoint area, there is a write operation, In the cloud song memory of the LTG table refreshed once the disk LTG table, if suddenly crashes, take the disk this LTG table to recover.
2) Passive MWC: no LTG table, but use the dirty (dirty) bit, only to successfully synchronize and close the logical volume, only clear dirty bit, if the system occurs, based on this dirty bit to determine what data needs to be synchronized.
ROOTVG logical volumes in a volume group
Synchronizing or rebuilding LVM information
In order for the system to function properly, the LVM information in the device configuration database (part of the ODM) must be consistent with the LVM information in the logical Volume Control block (LVCB) and consistent with the VGDA information on the physical volume.
If for some reason the device configuration database and the actual LVM information are inconsistent, you need to use the SYCNVODM command to synchronize or rebuild the information about LVM in the device configuration database
Command format:
#sycnlvodm-V-P [volumegroup] [logicalvolume ...]
During the synchronization process, the VG must be active. If a logical volume name is specified, only the information associated with this logical volume is updated. Specify the volume group name with Volumegroup, and specify the logical volume name with Logicalvolume. If the-p parameter is used, SYCNVODM protects the owner and permission of the logical volume device file during synchronization. Use the-v parameter to output more information.
Eighth Chapter Storage Management