AIX 5L SysAdmin I: (Unit 06) – Working with the Logical Volume Manager

Objectives:
—————-
Add/Change/Delete Volume Groups
Add/Change/Delete Logical Volumes
Add/Change/Delete Physical Volumes
Describe mirroring
Describe striping

Volumes Groups:
————————–
VG – Volume Groups are made up of one or more PV – Physical Volumes or a collection of related disks.

Logical Volume Manager:
————————————-
smit lvm
Volume Groups
Logical Volumes
Physical Volumes
Paging Space

SMIT Volume Groups Menu:
——————————————
List All Volume Groups
Add a Volume Group
Set Characteristics of a Volume Group
List Contents of a Volume Group
Remove a Volume Group
Activate a Volume Group
Deactivate a Volume Group
Import a Volume Group
Export a Volume Group
Mirror a Volume Group
Unmirror a Volume Group
Synchronize LVM Mirrors
Backup Up a Volume Group
Remake a Volume Group
List Files in a Volume Group Backup
Restores Files in a Volume Broup Backup

Listing Volume Group Information
#lsvg
rootvg
payrollvg

lsvg -o (only list those Volume Groups that are open or active)
lsvg rootvg
lsvg -p rootvg (list physical volumes in volume group rootvg)
lsvg -l rootvg (list logical volumes in volume group rootvg)

smit mkvg – add a volume group

Removing Volume Groups
smit reducevg2 – have to deactive the volume group and the logical volumes before removing it.

Set Characteristics of a Volume Group:
———————————————————
smit vgsc

Change a Volume Group:
————————————-
smit chvg

Logical Track Group Size (LTG)
———————————————–
Flexible LTG size for better performance
# /usr/sbin/lquerypv -M hdisk0
256
# /usr/sbin/lquerypv -M hdisk1
128
LTG is set to the highest value for all disks in the Logical Volume.
Set the LTG size per volume gropu using mkvg or chvg.

Hot Spare:
—————-
1st copy of data1
2nd copy of data1
Must have a mirrored logical volume in order for hot spare to be useful. Then when a disk goes bad the data can be regenerated from the hot spare.

Activate/Deactivate a Volume Group:
——————————————————
varyonvg -f VolumeGroup
varyoffvg datavg
Note: All Logical Volumes must be deactivated before you can deactivate a Volume Group.

Import/Export A Volume Group:
———————————————-
smit importvg

Upgrading to new hardware, you can use the export the volume groups from the old hardware, take the disks and install them in the new hardware. Configure the disks and use the import command to make the new hardware aware of the volume groups.

Examples:
—————-
lspv
smit vg
Set Characteristics of a Volume Group
Add a PHysical Volume to the Volume Group
rootvg
Physical volume name: F4 – List (hdisk1)
lspv

lspv -l hdisk1 – Check to make sure that no logical volumes are on this disk before removing it from the Volume Group.

Remove a Physical Volume from the Volume Group
reducevg rootvg hdisk1
lspv

Add a Volume Group
smit vg
Add a volume group
newvg

chvg -B newvg (change to a Big volume group)
Note: You can not change back to normal volume group after changing it to a big volume group.

reducevg newvg hdisk1 (removes hdisk1 from the newvg)

Mirroring is when a logical partition maps to more than one physical partition of the same volume group.

Scheduling Policy:
—————————
1. Parallel – PPs written simultaneously (Faster, but if something happens all copies could be in an inconsistant state)

2. Sequential – PPs written insequence (Slower, but more reliable since the bad copies can be made consistant from the good copy)

Mirror Write Consistency:
————————————–
Use with a parallel scheduling policy. The outer edge of the disk is used to write as it is updating.

Striping:
————-
Striping is for performance when on different controllers and is the opposite of mirroring in that you only have one copy of the data written accros multiple disks.

Normal flow of data blocks when a logical volume is spread across physical volumes.
PV1-1,2,3,4,5,6 PV2-13,14,15,16,17,18 PV3-25,26,27,28,29,30
PV1-7,8,9,10,11,12 PV2-19,20,21,22,23,24 PV3-31,32,33,34..

Striping
PV1- 1,4,7,10,13,16 PV2- 2,5,8,11,14,17 PV3- 3,6,9,12,15,18
The layout of stripe units when a logical volumeis set up to stripe.

Consecutive stripe units are created on different physical volumes.

Striping increases read/write sequential throughput by evenly distributing partitions among disks.

Stripe unit size is specified at creation time.

Note: Although faster, striping can be less reliable if there were a disk failure since all data would be lost.

Logical Volume Policies
———————————–
Intra-physical volume allocation policy:

E – Outer Edge (Edge)
M – Outer Middle (Middle)
C – Center
M – Inner Middle
E – Inner Edge

Inter-physical volume allocation policy:
–> Maximum number of PVs to use
–> Range of PVs to use

Note: When you create a Logical Volume you get to request where it is located physically on the disk.

SMIT Logical Volumes Menu
——————————————
smit lv

Showing Logical Volume Characteristics:
————————————————————
lslv -l lv00
lslv -m lv00 (mapping for each individual logical partition)
lsvg -o | lsvg -i -l (List all logical volumes by volume group)
lslv lv02 (Show Characteristics of a Logical Volume)

# smit mklvcopy – Add/Remove a Logical Volume Copy
# smit reorgvg – Reorganize a Volume Group

lspv – List all Physical Volumes in the System
lspv hdisk0 – List Contents of a Physical Volume
lspv -l hdisk0 – List Logical Volumes on a Physical Volume
lspv -p hdisk0 – List Physical Partition Map of a Physical Volume

migratepv -l lv02 hdisk0 hdisk6 – Moves the contents of a Physical Volume
lvmstat -e -v rootvg
lvmstat -v rootvg
lvmstat -l hd3
migratelp hd3/1 hdisk1/109 – Migrating Physical Partitions

Documenting the Disk Storage Setup:
——————————————————-
lspv – List of the disks on the system (PVID and VG)
lsvg – List the VGs
lsvg -l vgname – List what LVs are contained in each VG
lspv -l pvname – List the LVs on each disk

FAQ
Q: Can a logical volume hold more than one file system?
A: No. A logical volume can hold paging area, jfs log, or a journaled filesystem, but, it can hold only one at a time. If a journaled filesystem is placed on an LV, that single file system is the only thing that can reside on that LV.
?????
Q: Do I have to export a volume group from one system before I can import it to another?
A: No. In fact, if your system crashes and you need quick access to the data on that volume group, you might want to attach the volume group to another machine. If you were required to first export it, you would be required to export the volume before the crash. Unless you were planning for a crash, you probably didn’t export the volume group. Exporting the VG remove the ODM objects related to that VG. This machine no longer looks for the VG. If you don’t export the VG and you physically detached it, you will get warning messages on the next reboot, saying that the VG could not be found. An import reads the VGDA information and creates the necessary entries in the ODM database.

Q: On the machine that crashed, that no longer has the VG attached, is there a way to tell the machine that the VG has been removed?
A: Just because the VG is physically gone, you can still export the VG. Again, all the export is doing is removing the related ODM objects. This can be done with or without the VG physically attached.

Q: When SMIT asks how many copies of an LV do I want, what does this mean?
A: It is really asking if you want to mirror the LV. If you want two copies, you get mirroring. If you want three copies, you get double mirroring. If you want only one copy, you are not mirroring.

Q: Do all the PVs in a VG have to had the same PP size?
A: Yes. You set the PV size when you create the VG. All the disks in that VG will have the same size.

Q: I changed my logical volume policies from edge to center. When I checked the location of the LV, it was still sitting on the edge. Do I have to do something to make it move?
A: Yes. You policies are used when a partition is allocated to the LV and when you reorganize an LV. In this case, you changed the policies but never reorganized the LV. Until you reorganize, the partition will stay where they were placed originally. Use “reorgvg” to move the partitions to their new location. Also, if there is no space available on the disk in the new location, LVM still won’t move anything. A reorg will not force any partition out of the way; it only moves partitions that you specify with the command.

Leave a Reply

Your email address will not be published. Required fields are marked *

*