Disk Storage Management
*Storage Management Concepts
+VGDA-There is at least one VGDA per physical volume. Information from VGDA's of all disks that are part of the same volume group must be identical.
VGDA location on the disk depends on the type of VG(original, big,scalable)
+VGSA -Volume group status area is used to describe the state of all physical partitions from all physical volumes within a volume group.
The VGSA indicates if physical partition contains accurate or stale information.
VGSA is used for monitoring and maintaining data copies synchronization.
+LVCB - A logical volume control block.
Contains important information about the logical volume,such as the number of the logical partitions or disk allocation policy. It's location on the disk depends on the type of volume group it belongs to.
For standard volume groups, the LVCB resides on the first block of user data within the LV. For Big VG there is additional LVCB info in VGDA on the disk.
For scalable VG, all relevant lv control information is kept in the VGDA as part of the LVCB information area and the LV entry area.
VGDA- info about VG, No. of PV, status, Properties of all lv & pv
VGSA- All about pps, total pp in VG in every pv
LVCB-info about lv,lp
VG TYPE Max.PV Max. LV Max.PP Per VG Max. PP size
Normal 32 256 32512(1016X32) 1GB
Big VG 128 512 130048(1016X128) 1GB
Scalable 1024 4096 2097152 128GB
*Physical Volumes
+For each disk, two device drivers will be created under /dev directory
-Block device driver
-Character device driver
+Disk driver has 32-bit PVID
-->lspv
Displays all physical volumes
+PVID
The following command changes an available disk device to a physical volume by assigning a PVID
-->chdev -l hdisk7 -a pv=yes
This command has no effect if the disk is already a physcial volume.
>The following commands clears the PVID from the physical volume
-->chdev(modify an existing device parameter) -l(Logical name of the device who's properties are going to change) hdisk7 -a(specifies the attribute=value parameter) pv=clear(Property attribute=values)
*Listing info about physical volumes
-->lspv hdisk2
MAX REQUEST -256 kb-LTG size of PV
VG DESCRIPTORS -2 The number of VGDA'S located on this pv, Total PP used,
-->lspv -l hdisk0
Display all lv on hdisk0
-->lspv -p hdisk0
Display the allocation of PP's to logical volumes. Allocation of PP on disk(center/outer/inner/middle)
-->lspv -M hdisk0 | more
Detailed map of the disk layout and display the relationship between each pp to lp
-->lsvg -M hdisk0
-->lslv -m lv1
Display the numbers of logical partitions & their corresponding physical partitions.
*Changing the allocation permission for a physical volume
1)We can disable the partition allocation for a physical volume , so no lv can be created on it.
-->chpv -an hdisk2
(no allocation)
-->lspv hdisk2
ALLOCATABLE : no
-->mklv -y test -t jfs2 testvg 10 hdisk2 error: PV hdisk2 is not allocatable
-->chpv -ay hdisk2
Turn on the allocation permission
*Changing the availability of a PV
-->lsvg testvg
vg active
pv -2 active
vgda 3
-->lsvg -p testvg
hdisk2 active
hdisk3 active
-->lspv hdisk3
active, vgda 2
-->lspv hdisk2
active, vgda1
-->chpv -vr hdisk3
Makes hdisk3 unavailable
-->lspv hdis3
Confirms that hdisk3 is removed and does not have any VGDA on it. NOVGDA
-->lspv hdisk2
hdisk2-Active
vgda-2(Because any vg must contain at least one vgda)
-->lsvg -p testvg
hdisk3 has been removed
-->lsvg testvg
Shows vg is still active , one pv of two is active,and the total number of vgda has been changed to 2.
-->chpv -va hdisk3
Makes hdisk3 available again.
-->lspv hdisk3
shows that hdisk3 is active & contains only one vgda.
-->lsvg -p testvg
conforms that both disks are now active
*Before changing the availability of any physical volume, you have to close any logical volume residing on that disk and ensure that the vg meets quorum requirements after the disk is removed[close filesystem, check quorum]
*To clear the boot record located on physical volume hdisk1
-->chpv -c hdisk1
*Declaring a physical volume hot spare
HOT SPARE disk must be present and sholud be equal to the size of already presented disk,
To define hdisk3 as a hot spare
-->chpv -y hdisk3
To remove hdisk3 from the hot spare pool of it vg,
-->chpv -hn hdisk3
*Migraing data from physical volumes.
PP located on a pv can be moved to one or more physical volumes contained in the same vg
-->lsvg -p rootvg
-->lspv -M hdisk1
-->lspv -M hdisk5
-->migratepv hdisk1 hdisk5
-->lspv -M hdisk1
-->chpv -c hdisk1
if hdisk1 had a bootimage,which is how transfered to hdisk5, so deleted from hdisk1
-->lspv -M hdisk5
-->chpv -c hdisk1
If you migrate data from a physical volume that contains a boot image, you should also update the boot list.
It is possible to migrate only data from partitions that belong to a specific logical volume. To migrate only physical partitions that belong to logical volume testlv from hdisk1 to hdisk5
-->migratepv -l testlv hdisk1 hdisk5
*Migrating partitions
Migrating a partition to another partition on a different physical volme
-->lspv -M hdisk1
-->lspv -M hdisk5
-->migratelp testlv1/2 hdisk5/123
Migrate data from the second copy of the logical parition number 1 of lv to hdisk5 of pp123
-->lspv -M hdisk1
Map of all pp located on hdisk1
*Finding the LTG size
minimum LTG is effective LTG of your system
Logical Track Group is the maximum allowed transfer size for an i/o disk operation
-->lquerypv -M hdiskn
Find LTG size
LTG value will be equal to the minimum of the transfer size of disks that are part of the vg.
Changing LTG
-->chvg -L 128 testvg
*Volume Groups
All pv are divided in pp's having the same size
a)Creating a volume group
For each vg, 2 device driver files are created under directory /dev. Both files will have the major device number equal to the major number of the vg
i)Creating an original volume group
-->mkvg -y vg1 -s64(pp size in mb) -V99(major number) hdisk4
mkvg command will automatically vary on the newly created volume group by calling the varyonvg command.
ii)List all vg known to a system
-->lsvg
iii)List all active vg
-->lsvg -o
iv)Details of particular vg
-->lsvg testvg
v)Display lv contained in vg
-->lsvg -l rootvg
vi)When you investigate LVM metadata corruption, to obtain information about a volume group read from a VGDA located on a specific disk.
-->lsvg -n vgname
*Changing VG characteristics
1)Auto varyon flag set to yes
-->chvg -ay vgname
2)Auto varyon no
-->chvg -an vgname
3)Quorum
This attribute determines if the vg will be varies off or not after losing the simple majority of its physical volumes.
a)Turn off the quorm
-->chvg -Qn testvg
b)Turn on Quorum
-->chvg -Qy testvg
4)Maximum number of Physical partitions per physical volume
You can change the maximum number of physical partitions per pv
-->lsvg testvg
MAX PPs per vg 32512
max pp per pv 5080
-->chvg -t 16 testvg
Vg testvg changed . With given characteristics testvg can include upto 2 pv with 16256 pp
-->lsvg testvg
max pp per vg 32512
max pv
max pp per pv 16256
T factor table
No. of disks Max number of pp/disk
1 32515
2 16256
4 8128
8 4096
16 2032
32 1016
5)Changing a vg format
Once a vg has been converted to a scalable format, it cannot be changed into a different format. Before changing the format of a vg you must varyoff the vg
-->lsvg tablet
max pp per vg 32512
max pv 32
max pp per pv 1016
-->varyoffvg tablet
-->chvg -G tablet
-->varyonvg tablet
-->lsvg tablet
max pp per vg 32768 max pv 1024
The maximum number of physical partitions is no longer defined on a per disk basis, but rather applies to the entire vg. As a consequence the lsvg command will no longer display the max number of physical partition per pv for scalable vgs.
6)Changing the hot spare policy
a)Displays physical volumes that are part of testvg
-->lsvg -p testvg
b)Designate hdisk4 as a hot spare
-->chpv -hy hdisk4
c)Change the migrate policy of the vg to migrate data from a failing disk to one spare disk
-->chvg -hy testvg
d)Change the migrate policy of the vg to migrate data from a failing disk to the entire pool of spare disks
-->chvg -hY testvg
7)Changing the synchronization policy
Automatic Synchronization of stale partitions within the vg. This option has significance only for partitions that correspond to mirrored logical volumes
-->chvg -sy testvg
AUTO SYNC: yes
-->lsvg testvg
8)Changing the max. number of pp in vg
-->lsvg testvg
max pp per vg 32768
-->chvg -P testvg
max pp per vg 2097152
9)Changing the maximum number of logical volumes
-->lsvg testvg
max lv 256
-->chvg -v 4096 testvg
maxlv 4096
10)VG can be located after an abnormal termination of an LVM
-->chvg -u vgname
REmove the lock
11)Extending a Vg
Extend vg by adding pv , before adding new disk , you have make the disk in an available state
-->extendvg testvg hdisk7
Assign PVID to hdisk7 and adds it to vg
-->extendvg testvg hdisk4
It seems that hdisk4 appears to belong to volume that is not varied on and asks the user use the force flag.
-->extendvg -f testvg hdisk4
Forcibly adds hdisk4 to vg.
Also you cannot add pv of another vg which is belong to varied on vg.
12)Reducing a VG
The vg must be varied on, when you remove the last physical volume from the vg, otherwise if vg is not varyon still we can remove pv forcefully,as seen above. All lv residing on the disk to be reduced have to be closed before . If lv spans multiple PV, then it corrupts.
If there are lv on disk then without unmounting them we cannot remove the disk
13)Resynchronizing the device configuration database
synclvodm used to sysnchronize , rebuild information from odm , device files & lvm metadata structures -vgda, lvcb
To synchronize odm to contain the latest LVM information for vg testvg
-->synclvodm testvg (beware before using it)
14)Exporting a volume group
exportvg command only removes vg definition from the odm and does not delete any data from the physical disks. It clears the stanzas from /etc/filesystems that corresponds to the logical volumes contained in the exported volume group, but it will not delete the mounting point. You cannot export a vg that contains an active paging space.
-->exportvg testvg
There are situations when all data from a vg needs to be moved from one system to another system. You will need to delete any reference to that data from the originating system.
15)Importing a vg
Importing a vg means recreating the reference to the vg data and making that data available
ex.
-->importvg -y testvg hdisk7
shows the import vg testvg using hdisk7
The importvg command reads the VGDA of one of the pv that is part of vg.
It uses redefinevg to find all other disk that belong to the vg. It will add corresponding entries into the ODM database and update /etc/filesystem with the new values (if possible) for the new lvs and their mountpoints.
if same named vg is present already then command will fail, so change the name.
imported lvs name is conflicted with other lv then importvg command will automatically assign system default names to those that have been imported & send an error message
-->lsvg -l test2vg
now suppose we try to import another vg of name test2vg then the command will fail, so change the name.
-->importvg -y test1vg hdisk5
Then use fsck on fs
16)Varying on a VG
An already defined vg can be activated using the varyonvg
Steps in varyonvg includes
-varyonvg command will open corresponding file from /etc/vg to obtain a lock for the vg.
-all info of vgda gets cross-checked and the vgda with the latest time stamp is referred as vgda reference point.
-If majority of pv are not accessible, varyon fails. You will need to forcibly varyon
-LVM info on all pv are updated with latest info about all pv status
-All pv are updated to contain latest consistent copy of vgda.
-lvm device driver is updated with lates info about vg.
-->syncvg command is called to synchronize stale partition , if any.
-->varyonvg -f
forcibly varyon ,but no gurantee about data integrity ,& use only in emergency.
-->varyonvg -n
varyon without synchronizing stale partitions automatically ,useful when we need to do disk sync control in the case of disk problem,
ex.
1)-->lsvg testvg
pv 3 active
quorum active
2)Physically remove hdisk7
3)-->varyoffvg testvg
4)-->varyonvg testvg
with the use of above 2 commands the system will know that the hdisk7 is missing
5)-->chvg -Qn testvg
Disable the quorum for testvg(otherwise vg will not restart again)
6)varyoff testvg
7)varyonvg testvg
fails to activate the vg because one of the pv hdisk7 is missing.
8)-->varyonvg -f testvg
forcibly activates vg and declares hdisk7 is missing.
9)-->chvg -Qy testvg
Activate the quorum
10)We physically remove hdisk6 from the system and varyoff vg testvg
11)-->varyonvg testvg
fails, because there are not enough active physical volumes to meet the quorum.
12)-->varyonvg -f testvg
Forcibly activates the vg and puts hdisk6 & hdisk7 in the removed status.
*varyonvg -1)latest vgda selected as reference point
2)all pv updated with latest vgda
3)lvm updated
4)syncvg tookplace
5)majority pv should be available
13)Varying off a vg
Deactivate vg & lv in it . All lv must be closed, which requires that all file systems associated with logical volumes be unmounted
-lv close
-fs unmount
-->varyoffvg testvg
-->lsvg -l testvg
-->lsvg -o
14)Reorganizing a vg
Reorganize pp within a vg. The pp will be rearreneged on the disks according to the intra-physical & inter-physical policy allocation for each lv.
Requirement- The vg must have at least one free partition and a relocatable flag of each of the lv that you would like to organize must be set
-vg have one free partition
-lv flags set.
-->lslv -l lv1
-->reorgvg test1vg
-->lslv -l lv1
>To reorganize only logical volumes lv1& lv2
from vg testvg
-->reorgvg testvg lv1 lv2
>To reorganize only partitions located on physical volumes hdisk6 hdisk7 that belong to logicla volumes lv1 & lv2 from vg testvg
-->echo "hdisk 6 hdisk7 " | reorgvg -i testvg lv1 lv2
15)Synchronizing a VG
To synchronize stale partitions, time consuming depending on h/w characteristics & the total amount of data.
-f forced sync; & an uncorrupted physical copy is chosen & propagated to all other copies of lp, whether or not they are stale.
>To sync. copies located on pv hdisk4 & hdisk5
-->syncvg -p hdisk4 hdisk5
>To sync all pp from vg testvg
-->syncvg -v testvg
16)Mirroring a vg
Mirror all logical volumes within a vg
a)Extend rootvg to contain a second pv
-->extendvg rootvg hdisk1
b)Create a copy for each lv within rootvg
-->mirrorvg rootvg
Quorum is disabled because all lv are mirrored .
New BLV is created on the newly added disk,
-->bosboot -ad /dev/hdisk1
-->bootlist -m normal hdisk0 hdisk1
Disk included in bootlist
-->shutdown -Fr
reboot
17)Splitting of a VG
To split a copy of a mirrored vg into a snapshot vg.
To split
-All lv in vg must have a mirror copy
-Mirror must be located on a disk or a set of disks that contain only this set of mirrors.
spliting not be used on a vg with paging spaces.
(original disk)p----|----p(new disk)
-->splitvg -y newvg -c 1 test1vg
Splits test1vg and creates a snapshots vg named newvg
The original vg will stop using the disks that are part of the newvg.
New lv & new mounting points will be created in new (snapshot) vg.
Both vg will monitor changes of any physical partition so that when the new snapshot vg is rejoined with the original vg, the data will remain consistent.
To rejoin the two copies of the vg test1vg
-->joinvg test1vg
*Managing logical volumes
Each lp has at least one & maximum 3 corresponding pp's that can be located on different physical volumes
each lv --/dev/char file
--/dev/block file
1)Creating a logical volume
-->mklv -y lv3 -t jfs2 -a im testvg 10 hdisk5
2)Delete lv
-->rmlv -p hdisk7 lv1
close the lv/unmount
3)Listing info about lv
-->lslv lv1
-->lslv -l lv1
-->lslv -m lv1 -no. of lp & corresponding pp
-->lslv -n hdisk6 testlv
info about lv, from vgda loated on hdisk6
-->getlvcb -AT lv1
LVCB of lv
lv time creation
lv time modification
4)Increasing the size of a lv
-->extendlv lv1 3 hdisk5 hdisk6
increase lv1 with 3 lp located on hdisk5, hdisk6
5)Copying a lv
-->cplv -v dumpvg -y lv8 lv1 (source)
To copy logical volume lv1 to the dumpvg vg under the name of lv8
6)Creating copies of lv
Create & synchronize one extra copy of each of the lp of lv lv1. Newly created copies will be located on hdisk7
-->mklvcopy -k lv1 3 hdisk7 &
before it was 2 copies per lp now it becames 3 copies
-->mklvcopy -k lv1 2 hdisk5 &
before it was 1 copy now it becomes 2
*Changing characteristics of lv
To change for logical volume lv1, the maximum number of logical partitions to 1000 & scheduling policy for i/o operations to parallel/round robin.
-->chlv -x 1000 -d pr lv1
-->chlv -x 25 lv1
*Splitting a logical volume
Use splitlvcopy command to split a lv that has at least two copies of each lp into two different lv. The newly creted lv will have the same characteristics as the original.
It is recommended closing the lv to be split. If the original lv contains a filesystem, the data from the newly created lv will have to be accessed as a different filesystem
-->splitlvcopy -y copylv(new) testlv(original) 2
[-->crfs -v jfs2 -d /dev/copylv -m /copy
creates a filesystem structure for copylv , This command will destroy any filesystem data]
instead
-->mkdir /copy
-->mount /dev/copylv /copy
-->vi /etc/filesystems
Manually add an entry for /copy mount point.
*Removing a copy of logical volumes
-->rmlvcopy testlv 2 hdisk6
Removes copies located on hdisk6 & leaves two mirror copies . (before there was 3 copies)
1)-->lslv -m testlv
3lp hdisk5,6,7
2)-->lslv -m testlv
2lp hdisk5,7
3)-->rmlvcopy testlv 1 hdisk6
delete the one copy of testlv
from hdisk6
-->smit rmlvcopy
4)-->splitlvcopy -y newlv testlv 2
-->smit splitlvcopy
5)-->chlv -x 1000 -d pr lv1
Max no. of lp to 1000 & scheduled policy fo i/o to parallel /round robin
-->smit chlv
6)-->mklvcopy -k lv1 3 hdisk7 &
make 3 copies of lv1 , if previously there was 2 copies then make 3rd .
7)-->cplv -v dumpvg(destination vg) -y lv8(copy) lv1(original lv)
8)-->extendlv -a ie -ex lv1 3 hdisk5 hdisk6
Extend lv1 with 3 lp located on inner edges of both hdisk5 & hdisk6
9)-->getlvcb -AT lv1
Display LVCB
10)-->lslv -n hdisk6 testlv
info about lv testlv read from vgda located on hdisk6
11)-->rmlv -p hdisk7 lv1
Tries to delete partitions of lv1 located on hdisk7
12)-->rmlv lv7
deletes lv7
13)-->mklv -y lv4 -t sysdump -a c -e x -c3 -L demo-label -x5 test1vg 2 hdisk5 hdisk6 hdisk7
Create within a VG test1vg , a lv named lv4, type sysdump, 2lp each having 3 copies, located on center of 3 disks labeled demo-label , having maximum 5 lp.
14)-->mklv -y lv3 -t jfs2 -a im test1vg 10 hdisk5
Create lv3 in testvg, type jfs, 10 lp of hdisk5
*Storage Management Concepts
+VGDA-There is at least one VGDA per physical volume. Information from VGDA's of all disks that are part of the same volume group must be identical.
VGDA location on the disk depends on the type of VG(original, big,scalable)
+VGSA -Volume group status area is used to describe the state of all physical partitions from all physical volumes within a volume group.
The VGSA indicates if physical partition contains accurate or stale information.
VGSA is used for monitoring and maintaining data copies synchronization.
+LVCB - A logical volume control block.
Contains important information about the logical volume,such as the number of the logical partitions or disk allocation policy. It's location on the disk depends on the type of volume group it belongs to.
For standard volume groups, the LVCB resides on the first block of user data within the LV. For Big VG there is additional LVCB info in VGDA on the disk.
For scalable VG, all relevant lv control information is kept in the VGDA as part of the LVCB information area and the LV entry area.
VGDA- info about VG, No. of PV, status, Properties of all lv & pv
VGSA- All about pps, total pp in VG in every pv
LVCB-info about lv,lp
VG TYPE Max.PV Max. LV Max.PP Per VG Max. PP size
Normal 32 256 32512(1016X32) 1GB
Big VG 128 512 130048(1016X128) 1GB
Scalable 1024 4096 2097152 128GB
*Physical Volumes
+For each disk, two device drivers will be created under /dev directory
-Block device driver
-Character device driver
+Disk driver has 32-bit PVID
-->lspv
Displays all physical volumes
+PVID
The following command changes an available disk device to a physical volume by assigning a PVID
-->chdev -l hdisk7 -a pv=yes
This command has no effect if the disk is already a physcial volume.
>The following commands clears the PVID from the physical volume
-->chdev(modify an existing device parameter) -l(Logical name of the device who's properties are going to change) hdisk7 -a(specifies the attribute=value parameter) pv=clear(Property attribute=values)
*Listing info about physical volumes
-->lspv hdisk2
MAX REQUEST -256 kb-LTG size of PV
VG DESCRIPTORS -2 The number of VGDA'S located on this pv, Total PP used,
-->lspv -l hdisk0
Display all lv on hdisk0
-->lspv -p hdisk0
Display the allocation of PP's to logical volumes. Allocation of PP on disk(center/outer/inner/middle)
-->lspv -M hdisk0 | more
Detailed map of the disk layout and display the relationship between each pp to lp
-->lsvg -M hdisk0
-->lslv -m lv1
Display the numbers of logical partitions & their corresponding physical partitions.
*Changing the allocation permission for a physical volume
1)We can disable the partition allocation for a physical volume , so no lv can be created on it.
-->chpv -an hdisk2
(no allocation)
-->lspv hdisk2
ALLOCATABLE : no
-->mklv -y test -t jfs2 testvg 10 hdisk2 error: PV hdisk2 is not allocatable
-->chpv -ay hdisk2
Turn on the allocation permission
*Changing the availability of a PV
-->lsvg testvg
vg active
pv -2 active
vgda 3
-->lsvg -p testvg
hdisk2 active
hdisk3 active
-->lspv hdisk3
active, vgda 2
-->lspv hdisk2
active, vgda1
-->chpv -vr hdisk3
Makes hdisk3 unavailable
-->lspv hdis3
Confirms that hdisk3 is removed and does not have any VGDA on it. NOVGDA
-->lspv hdisk2
hdisk2-Active
vgda-2(Because any vg must contain at least one vgda)
-->lsvg -p testvg
hdisk3 has been removed
-->lsvg testvg
Shows vg is still active , one pv of two is active,and the total number of vgda has been changed to 2.
-->chpv -va hdisk3
Makes hdisk3 available again.
-->lspv hdisk3
shows that hdisk3 is active & contains only one vgda.
-->lsvg -p testvg
conforms that both disks are now active
*Before changing the availability of any physical volume, you have to close any logical volume residing on that disk and ensure that the vg meets quorum requirements after the disk is removed[close filesystem, check quorum]
*To clear the boot record located on physical volume hdisk1
-->chpv -c hdisk1
*Declaring a physical volume hot spare
HOT SPARE disk must be present and sholud be equal to the size of already presented disk,
To define hdisk3 as a hot spare
-->chpv -y hdisk3
To remove hdisk3 from the hot spare pool of it vg,
-->chpv -hn hdisk3
*Migraing data from physical volumes.
PP located on a pv can be moved to one or more physical volumes contained in the same vg
-->lsvg -p rootvg
-->lspv -M hdisk1
-->lspv -M hdisk5
-->migratepv hdisk1 hdisk5
-->lspv -M hdisk1
-->chpv -c hdisk1
if hdisk1 had a bootimage,which is how transfered to hdisk5, so deleted from hdisk1
-->lspv -M hdisk5
-->chpv -c hdisk1
If you migrate data from a physical volume that contains a boot image, you should also update the boot list.
It is possible to migrate only data from partitions that belong to a specific logical volume. To migrate only physical partitions that belong to logical volume testlv from hdisk1 to hdisk5
-->migratepv -l testlv hdisk1 hdisk5
*Migrating partitions
Migrating a partition to another partition on a different physical volme
-->lspv -M hdisk1
-->lspv -M hdisk5
-->migratelp testlv1/2 hdisk5/123
Migrate data from the second copy of the logical parition number 1 of lv to hdisk5 of pp123
-->lspv -M hdisk1
Map of all pp located on hdisk1
*Finding the LTG size
minimum LTG is effective LTG of your system
Logical Track Group is the maximum allowed transfer size for an i/o disk operation
-->lquerypv -M hdiskn
Find LTG size
LTG value will be equal to the minimum of the transfer size of disks that are part of the vg.
Changing LTG
-->chvg -L 128 testvg
*Volume Groups
All pv are divided in pp's having the same size
a)Creating a volume group
For each vg, 2 device driver files are created under directory /dev. Both files will have the major device number equal to the major number of the vg
i)Creating an original volume group
-->mkvg -y vg1 -s64(pp size in mb) -V99(major number) hdisk4
mkvg command will automatically vary on the newly created volume group by calling the varyonvg command.
ii)List all vg known to a system
-->lsvg
iii)List all active vg
-->lsvg -o
iv)Details of particular vg
-->lsvg testvg
v)Display lv contained in vg
-->lsvg -l rootvg
vi)When you investigate LVM metadata corruption, to obtain information about a volume group read from a VGDA located on a specific disk.
-->lsvg -n vgname
*Changing VG characteristics
1)Auto varyon flag set to yes
-->chvg -ay vgname
2)Auto varyon no
-->chvg -an vgname
3)Quorum
This attribute determines if the vg will be varies off or not after losing the simple majority of its physical volumes.
a)Turn off the quorm
-->chvg -Qn testvg
b)Turn on Quorum
-->chvg -Qy testvg
4)Maximum number of Physical partitions per physical volume
You can change the maximum number of physical partitions per pv
-->lsvg testvg
MAX PPs per vg 32512
max pp per pv 5080
-->chvg -t 16 testvg
Vg testvg changed . With given characteristics testvg can include upto 2 pv with 16256 pp
-->lsvg testvg
max pp per vg 32512
max pv
max pp per pv 16256
T factor table
No. of disks Max number of pp/disk
1 32515
2 16256
4 8128
8 4096
16 2032
32 1016
5)Changing a vg format
Once a vg has been converted to a scalable format, it cannot be changed into a different format. Before changing the format of a vg you must varyoff the vg
-->lsvg tablet
max pp per vg 32512
max pv 32
max pp per pv 1016
-->varyoffvg tablet
-->chvg -G tablet
-->varyonvg tablet
-->lsvg tablet
max pp per vg 32768 max pv 1024
The maximum number of physical partitions is no longer defined on a per disk basis, but rather applies to the entire vg. As a consequence the lsvg command will no longer display the max number of physical partition per pv for scalable vgs.
6)Changing the hot spare policy
a)Displays physical volumes that are part of testvg
-->lsvg -p testvg
b)Designate hdisk4 as a hot spare
-->chpv -hy hdisk4
c)Change the migrate policy of the vg to migrate data from a failing disk to one spare disk
-->chvg -hy testvg
d)Change the migrate policy of the vg to migrate data from a failing disk to the entire pool of spare disks
-->chvg -hY testvg
7)Changing the synchronization policy
Automatic Synchronization of stale partitions within the vg. This option has significance only for partitions that correspond to mirrored logical volumes
-->chvg -sy testvg
AUTO SYNC: yes
-->lsvg testvg
8)Changing the max. number of pp in vg
-->lsvg testvg
max pp per vg 32768
-->chvg -P testvg
max pp per vg 2097152
9)Changing the maximum number of logical volumes
-->lsvg testvg
max lv 256
-->chvg -v 4096 testvg
maxlv 4096
10)VG can be located after an abnormal termination of an LVM
-->chvg -u vgname
REmove the lock
11)Extending a Vg
Extend vg by adding pv , before adding new disk , you have make the disk in an available state
-->extendvg testvg hdisk7
Assign PVID to hdisk7 and adds it to vg
-->extendvg testvg hdisk4
It seems that hdisk4 appears to belong to volume that is not varied on and asks the user use the force flag.
-->extendvg -f testvg hdisk4
Forcibly adds hdisk4 to vg.
Also you cannot add pv of another vg which is belong to varied on vg.
12)Reducing a VG
The vg must be varied on, when you remove the last physical volume from the vg, otherwise if vg is not varyon still we can remove pv forcefully,as seen above. All lv residing on the disk to be reduced have to be closed before . If lv spans multiple PV, then it corrupts.
If there are lv on disk then without unmounting them we cannot remove the disk
13)Resynchronizing the device configuration database
synclvodm used to sysnchronize , rebuild information from odm , device files & lvm metadata structures -vgda, lvcb
To synchronize odm to contain the latest LVM information for vg testvg
-->synclvodm testvg (beware before using it)
14)Exporting a volume group
exportvg command only removes vg definition from the odm and does not delete any data from the physical disks. It clears the stanzas from /etc/filesystems that corresponds to the logical volumes contained in the exported volume group, but it will not delete the mounting point. You cannot export a vg that contains an active paging space.
-->exportvg testvg
There are situations when all data from a vg needs to be moved from one system to another system. You will need to delete any reference to that data from the originating system.
15)Importing a vg
Importing a vg means recreating the reference to the vg data and making that data available
ex.
-->importvg -y testvg hdisk7
shows the import vg testvg using hdisk7
The importvg command reads the VGDA of one of the pv that is part of vg.
It uses redefinevg to find all other disk that belong to the vg. It will add corresponding entries into the ODM database and update /etc/filesystem with the new values (if possible) for the new lvs and their mountpoints.
if same named vg is present already then command will fail, so change the name.
imported lvs name is conflicted with other lv then importvg command will automatically assign system default names to those that have been imported & send an error message
-->lsvg -l test2vg
now suppose we try to import another vg of name test2vg then the command will fail, so change the name.
-->importvg -y test1vg hdisk5
Then use fsck on fs
16)Varying on a VG
An already defined vg can be activated using the varyonvg
Steps in varyonvg includes
-varyonvg command will open corresponding file from /etc/vg to obtain a lock for the vg.
-all info of vgda gets cross-checked and the vgda with the latest time stamp is referred as vgda reference point.
-If majority of pv are not accessible, varyon fails. You will need to forcibly varyon
-LVM info on all pv are updated with latest info about all pv status
-All pv are updated to contain latest consistent copy of vgda.
-lvm device driver is updated with lates info about vg.
-->syncvg command is called to synchronize stale partition , if any.
-->varyonvg -f
forcibly varyon ,but no gurantee about data integrity ,& use only in emergency.
-->varyonvg -n
varyon without synchronizing stale partitions automatically ,useful when we need to do disk sync control in the case of disk problem,
ex.
1)-->lsvg testvg
pv 3 active
quorum active
2)Physically remove hdisk7
3)-->varyoffvg testvg
4)-->varyonvg testvg
with the use of above 2 commands the system will know that the hdisk7 is missing
5)-->chvg -Qn testvg
Disable the quorum for testvg(otherwise vg will not restart again)
6)varyoff testvg
7)varyonvg testvg
fails to activate the vg because one of the pv hdisk7 is missing.
8)-->varyonvg -f testvg
forcibly activates vg and declares hdisk7 is missing.
9)-->chvg -Qy testvg
Activate the quorum
10)We physically remove hdisk6 from the system and varyoff vg testvg
11)-->varyonvg testvg
fails, because there are not enough active physical volumes to meet the quorum.
12)-->varyonvg -f testvg
Forcibly activates the vg and puts hdisk6 & hdisk7 in the removed status.
*varyonvg -1)latest vgda selected as reference point
2)all pv updated with latest vgda
3)lvm updated
4)syncvg tookplace
5)majority pv should be available
13)Varying off a vg
Deactivate vg & lv in it . All lv must be closed, which requires that all file systems associated with logical volumes be unmounted
-lv close
-fs unmount
-->varyoffvg testvg
-->lsvg -l testvg
-->lsvg -o
14)Reorganizing a vg
Reorganize pp within a vg. The pp will be rearreneged on the disks according to the intra-physical & inter-physical policy allocation for each lv.
Requirement- The vg must have at least one free partition and a relocatable flag of each of the lv that you would like to organize must be set
-vg have one free partition
-lv flags set.
-->lslv -l lv1
-->reorgvg test1vg
-->lslv -l lv1
>To reorganize only logical volumes lv1& lv2
from vg testvg
-->reorgvg testvg lv1 lv2
>To reorganize only partitions located on physical volumes hdisk6 hdisk7 that belong to logicla volumes lv1 & lv2 from vg testvg
-->echo "hdisk 6 hdisk7 " | reorgvg -i testvg lv1 lv2
15)Synchronizing a VG
To synchronize stale partitions, time consuming depending on h/w characteristics & the total amount of data.
-f forced sync; & an uncorrupted physical copy is chosen & propagated to all other copies of lp, whether or not they are stale.
>To sync. copies located on pv hdisk4 & hdisk5
-->syncvg -p hdisk4 hdisk5
>To sync all pp from vg testvg
-->syncvg -v testvg
16)Mirroring a vg
Mirror all logical volumes within a vg
a)Extend rootvg to contain a second pv
-->extendvg rootvg hdisk1
b)Create a copy for each lv within rootvg
-->mirrorvg rootvg
Quorum is disabled because all lv are mirrored .
New BLV is created on the newly added disk,
-->bosboot -ad /dev/hdisk1
-->bootlist -m normal hdisk0 hdisk1
Disk included in bootlist
-->shutdown -Fr
reboot
17)Splitting of a VG
To split a copy of a mirrored vg into a snapshot vg.
To split
-All lv in vg must have a mirror copy
-Mirror must be located on a disk or a set of disks that contain only this set of mirrors.
spliting not be used on a vg with paging spaces.
(original disk)p----|----p(new disk)
-->splitvg -y newvg -c 1 test1vg
Splits test1vg and creates a snapshots vg named newvg
The original vg will stop using the disks that are part of the newvg.
New lv & new mounting points will be created in new (snapshot) vg.
Both vg will monitor changes of any physical partition so that when the new snapshot vg is rejoined with the original vg, the data will remain consistent.
To rejoin the two copies of the vg test1vg
-->joinvg test1vg
*Managing logical volumes
Each lp has at least one & maximum 3 corresponding pp's that can be located on different physical volumes
each lv --/dev/char file
--/dev/block file
1)Creating a logical volume
-->mklv -y lv3 -t jfs2 -a im testvg 10 hdisk5
2)Delete lv
-->rmlv -p hdisk7 lv1
close the lv/unmount
3)Listing info about lv
-->lslv lv1
-->lslv -l lv1
-->lslv -m lv1 -no. of lp & corresponding pp
-->lslv -n hdisk6 testlv
info about lv, from vgda loated on hdisk6
-->getlvcb -AT lv1
LVCB of lv
lv time creation
lv time modification
4)Increasing the size of a lv
-->extendlv lv1 3 hdisk5 hdisk6
increase lv1 with 3 lp located on hdisk5, hdisk6
5)Copying a lv
-->cplv -v dumpvg -y lv8 lv1 (source)
To copy logical volume lv1 to the dumpvg vg under the name of lv8
6)Creating copies of lv
Create & synchronize one extra copy of each of the lp of lv lv1. Newly created copies will be located on hdisk7
-->mklvcopy -k lv1 3 hdisk7 &
before it was 2 copies per lp now it becames 3 copies
-->mklvcopy -k lv1 2 hdisk5 &
before it was 1 copy now it becomes 2
*Changing characteristics of lv
To change for logical volume lv1, the maximum number of logical partitions to 1000 & scheduling policy for i/o operations to parallel/round robin.
-->chlv -x 1000 -d pr lv1
-->chlv -x 25 lv1
*Splitting a logical volume
Use splitlvcopy command to split a lv that has at least two copies of each lp into two different lv. The newly creted lv will have the same characteristics as the original.
It is recommended closing the lv to be split. If the original lv contains a filesystem, the data from the newly created lv will have to be accessed as a different filesystem
-->splitlvcopy -y copylv(new) testlv(original) 2
[-->crfs -v jfs2 -d /dev/copylv -m /copy
creates a filesystem structure for copylv , This command will destroy any filesystem data]
instead
-->mkdir /copy
-->mount /dev/copylv /copy
-->vi /etc/filesystems
Manually add an entry for /copy mount point.
*Removing a copy of logical volumes
-->rmlvcopy testlv 2 hdisk6
Removes copies located on hdisk6 & leaves two mirror copies . (before there was 3 copies)
1)-->lslv -m testlv
3lp hdisk5,6,7
2)-->lslv -m testlv
2lp hdisk5,7
3)-->rmlvcopy testlv 1 hdisk6
delete the one copy of testlv
from hdisk6
-->smit rmlvcopy
4)-->splitlvcopy -y newlv testlv 2
-->smit splitlvcopy
5)-->chlv -x 1000 -d pr lv1
Max no. of lp to 1000 & scheduled policy fo i/o to parallel /round robin
-->smit chlv
6)-->mklvcopy -k lv1 3 hdisk7 &
make 3 copies of lv1 , if previously there was 2 copies then make 3rd .
7)-->cplv -v dumpvg(destination vg) -y lv8(copy) lv1(original lv)
8)-->extendlv -a ie -ex lv1 3 hdisk5 hdisk6
Extend lv1 with 3 lp located on inner edges of both hdisk5 & hdisk6
9)-->getlvcb -AT lv1
Display LVCB
10)-->lslv -n hdisk6 testlv
info about lv testlv read from vgda located on hdisk6
11)-->rmlv -p hdisk7 lv1
Tries to delete partitions of lv1 located on hdisk7
12)-->rmlv lv7
deletes lv7
13)-->mklv -y lv4 -t sysdump -a c -e x -c3 -L demo-label -x5 test1vg 2 hdisk5 hdisk6 hdisk7
Create within a VG test1vg , a lv named lv4, type sysdump, 2lp each having 3 copies, located on center of 3 disks labeled demo-label , having maximum 5 lp.
14)-->mklv -y lv3 -t jfs2 -a im test1vg 10 hdisk5
Create lv3 in testvg, type jfs, 10 lp of hdisk5
No comments:
Post a Comment