1/20/14 AIX for System Administrators aix4admins.blogspot.in/2011/05/lvm-logical-volume-manager-lvm-manages.html 1/9 LVM (Logical Volume Manager): LVM manages the storage to have a structured overview of it. /var/adm/ras/lvmcfg.log lvm log file shows what lvm commands were used (alog -ot lvmcfg) alog -ot lvmt shows lvm commands and libs The LVM consists of: -high level commands: can be used by users, e.g.: mklv (this can call an intermediate level command) -intermediate level commands: these are used by high-level commands, e.g. lcreatelv (users should not use these) -LVM subroutine interface library: it contains routines used by commands, e.g. lvm_createlv -Logical Volume Device Driver (LVDD): manages and processes all I/O; it is called by jfs or lvm library routines -Disk Device Driver: It is called by LVDD -Adapter Device Driver: it provides an interface to the physical disk This shows how the execution of a high level command goes through the different layers of LVM: LOGICAL VOLUME After you create a volume group, you can create logical volumes within that volume group. Logical partitions and logical volumes make up the logical view. Logical partitions map to and are identical in size to the physical partitions. A physical partition is the smallest unit of allocation of disk where the data is actually stored. A logical volume is a group of one or more logical partitions that can span multiple physical volumes. All the physical volumes it spans must be in the same volume group. A logical volume consists of a sequence of one or more logical partititons. Each logical partition has at least one and a maximum of three corresponding physical partitions that can be located on different physical volumes. When you first define a logical volume, the characteristics of its state (LV STATE) will be closed. It will become open when, for example, a file system has been created in the logical volume and mounted. It is also possible that you might want to create a logical volume and put nothing on it. This is known as a raw logical volume. Databases frequently use raw devices Logical Volume types: - log logical volume: used by jfs/jfs2 - dump logical volume: used by system dump, to copy selected areas of kernel data when a unexpected syszem halt occurs - boot logical volume: contains the initial information required to start the system - paging logical volume: used by the virtual memory manager to swap out pages of memory users and appl.-s will use these lvs: - raw logical volumes: these will be controlled by the appl. (it will nit use jfs/jfs2) - journaled filesystems: Striped logical volumes: Striping is a technique spreading the data in a logical volume across several physical volumes in such a way that the I/O capacity of the physical volumes can be used in parallel to access the data. LVCB (Logical Volume Control Block) First 512 byte of each logical volume in normal VGs (In big VGs it moved partially into the VGDA, and for scalable VGs completely.)(traditionally it was the fs boot block) The LVCB stores the attributes of the LV. Jfs does not access this area. # getlvcb -AT <lvname> <--shows the LVCB of the lv -------------------- LOGICAL VOLUM E: hd2 VOLUM E GROUP: rootvg LV IDENTIFIER: 0051f2ba00004c00000000f91d51e08b.5 PERMISSION: read/write VG STATE: active/complete LV STATE: opened/syncd TYPE: jfs WRITE VERIFY: off M AX LPs: 512 PP SIZE: 32 megabyte(s) COPIES: 2 SCHED POLICY: parallel LPs: 73 PPs: 146 STALE PPs: 0 BB POLICY: relocatable INTER-POLICY: minimum RELOCATABLE: yes INTRA-POLICY: center UPPER BOUND: 32 M OUNT POINT: /usr LABEL: /usr MIRROR WRITE CONS IS TENCY: on/ACTIVE EACH LP COPY ON A S EPARATE PV ?: yes Serialize IO ?: NO inter-policy inter-physical volume allocation policy, can be minimum or maximum
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
LVM manages the storage to have a structured overview of it.
/var/adm/ras/lvmcfg.log lvm log file shows what lvm commands were used (alog -ot lvmcfg)
alog -ot lvmt shows lvm commands and libs
The LVM consists of:
-high level commands: can be used by users, e.g.: mklv (this can call an intermediate level command)
-intermediate level commands: these are used by high-level commands, e.g. lcreatelv (users should not use these)
-LVM subroutine interface library: it contains routines used by commands, e.g. lvm_createlv
-Logical Volume Device Driver (LVDD): manages and processes all I/O; it is called by jfs or lvm library routines
-Disk Device Driver: It is called by LVDD
-Adapter Device Driver: it provides an interface to the physical disk
This shows how the execution of a high level command goes through the different layers of LVM:
LOGICAL VOLUME
After you create a volume group, you can create logical volumes within that volume group. Logical partitions and logical volumes make up the logical view. Logical partitions map to and are identical in size to
the physical partitions. A physical partition is the smallest unit of allocation of disk where the data is actually stored. A logical volume is a group of one or more logical partitions that can span multiple
physical volumes. All the physical volumes it spans must be in the same volume group.
A logical volume consists of a sequence of one or more logical partititons. Each logical partition has at least one and a maximum of three corresponding physical partitions that can be located on different
physical volumes.
When you first define a logical volume, the characteristics of its state (LV STATE) will be closed. It will become open when, for example, a file system has been created in the logical volume and mounted.
It is also possible that you might want to create a logical volume and put nothing on it. This is known as a raw logical volume. Databases frequently use raw devices
Logical Volume types:
- log logical volume: used by jfs/jfs2
- dump logical volume: used by system dump, to copy selected areas of kernel data when a unexpected syszem halt occurs
- boot logical volume: contains the initial information required to start the system
- paging logical volume: used by the virtual memory manager to swap out pages of memory
users and appl.-s will use these lvs:
- raw logical volumes: these will be controlled by the appl. (it will nit use jfs/jfs2)
- journaled filesystems:
Striped logical volumes:
Striping is a technique spreading the data in a logical volume across several physical volumes in such a way that the I/O capacity of the physical volumes can be used in parallel to access the data.
LVCB (Logical Volume Control Block)
First 512 byte of each logical volume in normal VGs (In big VGs it moved partially into the VGDA, and for scalable VGs completely.)(traditionally it was the fs boot block) The LVCB stores the attributes of
the LV. Jfs does not access this area.
# getlvcb -AT <lvname> <--shows the LVCB of the lv
minimum: to allocate pp's the minimum pv will be used (not spreading to all pv's tha data if possible)
maximum: to spread the physical partitions of this logical volume over as many physical volumes as possible.
This illustration shows 2 physical volumes. One contains partition 1 and a copy of partition 2. The other contains partition 2 with a copy of partition 1. The formula for allocation is Maximum Inter-Disk
Policy (Range=maximum) with a Single Logical Volume Copy per Disk (Strict=y).
each lp copy on separate pv The strictness value. Current state of allocation, strict, nonstrict, or superstrict. A strict allocation states that no copies for a logical partition are allocated on the same physical
volume. If the allocation does not follow the strict criteria, it is called nonstrict. A nonstrict allocation states that copies of a logical partition can share the same physical volume. A superstrict allocation states
that no partition from one mirror copy may reside the same disk as another mirror copy. (mirror 2 and mirror 3 cannot be on the sam edisk)
(So inter-policy and strictness have effect together how many disks are used: spreading to maximum disks (1st lps) then mirroring them we need another bunch of disks; however spreading to minimum disks
and mirroring, we need less disks.)
intra-policy intra-physical volume allocation policy, it specifies what startegy should be used for choosing pp's on a pv.
it can be: edge (outer edge), middle (outer middle), center, inner middle, inner edge
If you specify a region, but it gets full, further partitions are allocated from near as possible to far away.
The more i/o-s used, the pp's should be allocate to the outer edge.
mirror write consistency If turned on LVM keeps additional information to allow recovery of inconsistent mirrors.
Mirror write consistency recovery should be performed for most mirrored logical volumes
MWC is necessary to mirror lvs with parallel scheduling policies.
sched policy how reads and writes are handled to mirrorred logical volumes
parallel (default): read from least busy disk, write to all copies concurrently (at the same time)
sequential: read from primary copy only (if not available then next copy). write sequential (one after another)
(1 book suggests sequential because it works with MWC)
Write verify If turned on, all writes will be verified with a follow-up read. This will negatively impact performace but useful.
BB policy Bad block relocation policy. (bad blocks are relocatable or not)
Relocatable Indicates whether the partitions can be relocated if a reorganization of partition allocation takes place.
Upper Bound what is the maximum number of physical volumes a logical volume can use for allocation
------------------
# lslv -l pdwhdatlv
PV COPIES IN BAND DISTRIBUTION
hdiskpower5 125:000:000 3% 000:004:000:076:045
Copies shows information of each copies (separated by :) on the disks (125 first copy and no other mirrors are on the disk)
In Band the percentage of pps on the disk which were allocated within the region specified by Intra-physical allocation policy
Distribution how many pps are allocated in: outer edge, outer middle, center, inner middle, and inner edge (125=4+76+45)
------------------
lslv lvname displays information about the logical volume
lslv -m lvname displays the logical partitions (LP) and their corresponding physical partititons (PP)
lslv -l lvname displays on which physical volumes is the lv resides
lslv -p <hdisk> displays the logical volume allocation map for the disk (shows used, free, stale for each physical partition)
lslv -p <hdisk> <lv> displays the same as above, just the given lv's partitions will be showed by numbers
Open Indicates active if LV contains a file system
Closed Indicates inactive if LV contains a file system