QV0121 SG
QV0121 SG
cover
Student Notebook
ERC 1.6
Trademarks
IBM® and the IBM logo are registered trademarks of International Business Machines
Corporation.
The following are trademarks of International Business Machines Corporation, registered in
many jurisdictions worldwide:
AIX 6™ AIX® DS4000®
HACMP™
UNIX is a registered trademark of The Open Group in the United States and other
countries.
Other product and service names might be trademarks of IBM or other companies.
TOC Contents
Trademarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii
Course description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix
Agenda . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi
TMK Trademarks
The reader should recognize that the following terms, which appear in the content of this
training document, are official trademarks of IBM or other companies:
IBM® and the IBM logo are registered trademarks of International Business Machines
Corporation.
The following are trademarks of International Business Machines Corporation, registered in
many jurisdictions worldwide:
AIX 6™ AIX® DS4000®
HACMP™
UNIX is a registered trademark of The Open Group in the United States and other
countries.
Other product and service names might be trademarks of IBM or other companies.
Purpose
This course teaches problem solving skills related to the Logical
Volume Manager (LVM) on AIX. It includes discussions on how to
identify and fix common LVM issues.
Audience
AIX/Linux technical support individuals, AIX/Linux developers,
AIX/Linux system administrators, system architects and engineers,
and product engineers.
Prerequisites
Students attending this course should have attended the following
course:
• AHQV011 - AIX Problem Determination I: Boot Issues
or have the equivalent experience.
Objectives
After completing this course, you should be able to:
• Identify the components and types of commands for LVM
• Describe the LVM structure and concepts associated with physical
volumes, volume groups, logical volumes, physical partitions,
logical partitions
• Describe the LVM metadata structures and their purpose
• Collect data to help determine the cause of LVM issues
• Identify commands and techniques used to resolve LVM issues
• Describe common LVM problem scenarios and use techniques to
resolve them
pref Agenda
Welcome
Unit 1 - LVM Components
Exercise 1 - LVM Concepts
Unit 2 - Mirroring and Striping
Exercise 2 - Mirroring
Unit 3 - LVM Metadata
Exercise 3 - Working with LVM Metadata
Unit 4 - Disk Replacement and Other LVM Issues
Exercise 4 - Problem Determination
Text highlighting
The following text highlighting conventions are used throughout this book:
Bold Identifies file names, file paths, directories, user names,
principals, menu paths and menu selections. Also identifies
graphical objects such as buttons, labels and icons that the
user selects.
Italics Identifies links to web sites, publication titles, is used where the
word or phrase is meant to stand out from the surrounding text,
and identifies parameters whose actual names or values are to
be supplied by the user.
Monospace Identifies attributes, variables, file listings, SMIT menus, code
examples and command output that you would see displayed
on a terminal, and messages from the system.
Monospace bold Identifies commands, subroutines, daemons, and text the user
would type.
References
AIX Operating System and Device Management
System Management Concepts: Operating System and Devices
Redbook SG24-5432 - AIX Logical Volume Manager:
from A to Z: Introduction and Concepts
Redbook SG24-5433 - AIX Logical Volume Manager:
from A to Z: Troubleshooting and Commands
Unit objectives
After completing this unit, you should be able to:
Identify and create the following components of LVM:
Volume group
Physical volume
Physical partition
Logical volume
Logical partition
Notes:
Uempty
Logical volume
LP1 LP2 LP3
Notes:
The Logical Volume Manager (LVM) is installed with the base operating system and
needs no further configuration. However, it is the responsibility of the system owner to
allocate LVM resources as needed.
Volume groups
A collection of physical disks
To create a volume group
(example): hdisk1 hdisk2 hdisk3
# mkvg -y testvg hdisk1 hdisk2
testvg
Notes:
A volume group (VG) is a structure used to organize physical and logical volumes. After
installation, the system has one volume group (rootvg) consisting of a base set of
logical volumes and physical volumes required to start the system and any other logical
volumes you specify to the installation script.
Uempty
Physical volumes
Disk technology
SCSI, Serial Attached SCSI (SAS), Fibre, SSA
Disk independence
Physical type of disk is transparent to the LVM
## lspv
lspv
hdisk0
hdisk0 00f6bccbf0314e2f
00f6bccbf0314e2f rootvg
rootvg active
active
hdisk1
hdisk1 none
none None
None
hdisk2
hdisk2 none
none None
None
hdisk3
hdisk3 none
none None
None
hdisk4
hdisk4 none
none None
None
## lsdev
lsdev -Cc
-Cc disk
disk Physical Disk
hdisk0
hdisk0 Available
Available Virtual
Virtual SCSI
SCSI Disk
Disk Drive
Drive
hdisk1
hdisk1 Available
Available Virtual
Virtual SCSI
SCSI Disk
Disk Drive
Drive
hdisk2
hdisk2 Available
Available Virtual
Virtual SCSI
SCSI Disk
Disk Drive
Drive
hdisk3
hdisk3 Available
Available Virtual
Virtual SCSI
SCSI Disk
Disk Drive
Drive
hdisk4
hdisk4 Available
Available Virtual
Virtual SCSI
SCSI Disk
Disk Drive
Drive
Notes:
When a disk drive is added to a volume group, it becomes known as a physical volume
(PV). Every physical volume in use belongs to a volume group.
Physical partitions
Smallest unit of contiguous storage space on a physical
volume
...
Physical Partitions
...
UNIX Software Service Enablement © Copyright IBM Corporation 2012
Notes:
Uempty
physical
physical PP20
physical
disks
physical
PP42 PP52
disks
physical
disks
disks
volumes
PHYSICAL VOLUME PHYSICAL VOLUME
Notes:
Logical volumes
Within each volume group, one or more logical volumes are defined. Logical volumes
are groups of information located on physical volumes.
Logical partitions
Each logical volume consists of one or more logical partitions. Logical partitions are the
same size as the physical partitions within a volume group. Each logical partition is
mapped to at least one physical partition.
## lsvg
lsvg -l
-l rootvg
rootvg
rootvg:
rootvg:
LV
LV NAME
NAME TYPE
TYPE LPs
LPs PPs
PPs PVs
PVs LV
LV STATE
STATE MOUNT
MOUNT POINT
POINT
hd5
hd5 boot
boot 11 11 11 closed/syncd
closed/syncd N/A
N/A
hd6
hd6 paging
paging 33 33 11 open/syncd
open/syncd N/A
N/A
hd8
hd8 jfs2log
jfs2log 11 11 11 open/syncd
open/syncd N/A
N/A
hd4
hd4 jfs2
jfs2 22 22 11 open/syncd
open/syncd //
hd2
hd2 jfs2
jfs2 13
13 13
13 11 open/syncd
open/syncd /usr
/usr
hd9var
hd9var jfs2
jfs2 11 11 11 open/syncd
open/syncd /var
/var
hd3
hd3 jfs2
jfs2 11 11 11 open/syncd
open/syncd /tmp
/tmp
hd1
hd1 jfs2
jfs2 11 11 11 open/syncd
open/syncd /home
/home
hd10opt
hd10opt jfs2
jfs2 11 11 11 open/syncd
open/syncd /opt
/opt
hd11admin
hd11admin jfs2
jfs2 11 11 11 open/syncd
open/syncd /admin
/admin
lg_dumplv
lg_dumplv sysdump
sysdump 88 88 11 open/syncd
open/syncd N/A
N/A
livedump
livedump jfs2
jfs2 22 22 11 open/syncd
open/syncd /var/adm/ras/livedump
/var/adm/ras/livedump
Notes:
Logical volumes can serve a number of system purposes, such as paging, file system
storage or raw data storage. However, each logical volume serves a single purpose
only. Many logical volumes contain a single journaled file system (JFS or JFS2).
The example in the visual shows the default logical volumes on rootvg created by the
installation process.
Uempty
hdisk1 hdisk2
testvg
UNIX Software Service Enablement © Copyright IBM Corporation 2012
Notes:
When a logical volume is created, you can specify the location of the physical partitions
in the logical volume.
A logical volume can span physical volumes as long as the physical volumes are in the
same volume group. Logical volumes cannot be spanned from one volume group to
another.
hdisk1 hdisk2
UNIX Software Service Enablement © Copyright IBM Corporation 2012
Notes:
You can create a file and specify the exact physical partitions to allocate for the logical
volume using the mklv -m mapfile command. The mapfile is a file you create and can
be any name.
Uempty
ee mm cc im
im ie
ie
Notes:
The intra-physical volume allocation policy defines what area on the physical volume
the logical volume will try to use.
## mklv
mklv -e
-e xx testvg
testvg 20
20
lv01
lv01
## lspv
lspv -l
-l hdisk1
hdisk1
hdisk1:
hdisk1:
LV
LV NAME
NAME LPs
LPs PPs
PPs DISTRIBUTION
DISTRIBUTION MOUNT
MOUNT POINT
POINT
lv00
lv00 20
20 20
20 00..20..00..00..00
00..20..00..00..00 N/A
N/A
lv01
lv01 10
10 10
10 00..10..00..00..00
00..10..00..00..00 N/A
N/A
## lspv
lspv -l
-l hdisk2
hdisk2
hdisk2:
hdisk2:
LV
LV NAME
NAME LPs
LPs PPs
PPs DISTRIBUTION
DISTRIBUTION MOUNT
MOUNT POINT
POINT
lv01
lv01 10
10 10
10 00..10..00..00..00
00..10..00..00..00 N/A
N/A
Notes:
The inter-physical volume allocation policy indicates how many physical volumes to use
to contain the physical partitions of the logical volume.
Uempty
VG type Max PVs Max LVs Max PPs per VG Max PP size
Normal VG 32 256 32512 (1016 * 32) 1 GB
Big VG 128 512 130048(1016 * 128) 1 GB
Scalable VG 1024 4096 2097152 128 GB
PPs per physical volume for normal and big volume groups
Notes:
Disk space on a physical volume is allocated to logical volumes in chunks called
physical partitions. Each physical partition is the same across all the disks in a volume
group. The physical partition size is set at the time the volume group is created. The
size is set in megabytes on power of two boundaries (e.g.: 4 MB, 8 MB, 16 MB, etc.).
The -t flag of the mkvg command changes the limit of the number of physical partitions
per physical volume. The -t value can be any number from 1 to 16 for normal volume
groups and 1 to 64 for big volume groups.
varyoffvg
Deactivates the volume group and its associated logical volumes
Notes:
For data to be accessible, a volume group must be in an active state. To varyon
(activate) a volume group, the varyonvg command is used. To varyoff (de-activate) a
volume group, the varyoffvg command is used.
Uempty
Notes:
The lspv -M hdisk0 command output shows us the lowest detail level of the mapping
on the disk. It shows the physical partition to logical volume/partition mapping.
Notes:
To display the status and characteristics of physical volume hdisk0 by physical partition
number:
# lspv -p hdisk0
Uempty
USED
USED USED
USED USED
USED USED
USED USED
USED USED
USED USED
USED USED
USED USED
USED USED
USED 49-58
49-58
USED
USED USED
USED USED
USED USED
USED FREE
FREE FREE
FREE FREE
FREE FREE
FREE FREE
FREE FREE
FREE 59-68
59-68
FREE
FREE FREE
FREE FREE
FREE FREE
FREE FREE
FREE FREE
FREE FREE
FREE FREE
FREE FREE
FREE FREE
FREE 69-78
69-78
FREE
FREE FREE
FREE FREE
FREE FREE
FREE FREE
FREE FREE
FREE FREE
FREE FREE
FREE FREE
FREE FREE
FREE 79-88
79-88
FREE
FREE FREE
FREE FREE
FREE FREE
FREE FREE
FREE FREE
FREE FREE
FREE FREE
FREE 89-96
89-96
USED
USED USED
USED USED
USED 0001
0001 0002
0002 0003
0003 0004
0004 0005
0005 0006
0006 0007
0007 97-106
97-106
0008
0008 0009
0009 0010
0010 0011
0011 0012
0012 0013
0013 0014
0014 0015
0015 0016
0016 0017
0017 107-116
107-116
USED
USED USED
USED USED
USED USED
USED USED
USED USED
USED USED
USED USED
USED USED
USED USED
USED 117-126
117-126
USED
USED FREE
FREE FREE
FREE FREE
FREE FREE
FREE FREE
FREE FREE
FREE FREE
FREE FREE
FREE FREE
FREE 127-136
127-136
FREE
FREE FREE
FREE FREE
FREE FREE
FREE FREE
FREE FREE
FREE FREE
FREE 137-143
137-143
...
...
FREE
FREE FREE
FREE FREE
FREE FREE
FREE FREE
FREE FREE
FREE FREE
FREE FREE
FREE FREE
FREE FREE
FREE 192-201
192-201
FREE
FREE FREE
FREE FREE
FREE FREE
FREE FREE
FREE FREE
FREE FREE
FREE FREE
FREE FREE
FREE FREE
FREE 202-211
202-211
FREE
FREE FREE
FREE FREE
FREE FREE
FREE FREE
FREE FREE
FREE FREE
FREE FREE
FREE FREE
FREE FREE
FREE 212-221
212-221
FREE
FREE FREE
FREE FREE
FREE FREE
FREE FREE
FREE FREE
FREE FREE
FREE FREE
FREE FREE
FREE FREE
FREE 222-231
222-231
FREE
FREE FREE
FREE FREE
FREE FREE
FREE FREE
FREE FREE
FREE FREE
FREE FREE
FREE 232-239
232-239
Notes:
The lslv -p PV LV command output shows us information about the allocation of
each physical partition on a given physical volume.
## lslv
lslv -m
-m hd2
hd2
hd2:/usr
hd2:/usr
LP
LP PP1
PP1 PV1
PV1 PP2
PP2 PV2
PV2 PP3
PP3 PV3
PV3
0001
0001 0100 hdisk0
0100 hdisk0
0002
0002 0101
0101 hdisk0
hdisk0
0003
0003 0102
0102 hdisk0
hdisk0
0004
0004 0103
0103 hdisk0
hdisk0
0005
0005 0104
0104 hdisk0
hdisk0
0006
0006 0105
0105 hdisk0
hdisk0
0007
0007 0106
0106 hdisk0
hdisk0
0008
0008 0107
0107 hdisk0
hdisk0
0009
0009 0108
0108 hdisk0
hdisk0
0010
0010 0109
0109 hdisk0
hdisk0
0011
0011 0110
0110 hdisk0
hdisk0
0012
0012 0111
0111 hdisk0
hdisk0
0013
0013 0112
0112 hdisk0
hdisk0
0014
0014 0113
0113 hdisk0
hdisk0
0015
0015 0114
0114 hdisk0
hdisk0
0016
0016 0115
0115 hdisk0
hdisk0
0017
0017 0116
0116 hdisk0
hdisk0
Notes:
The lslv -m hd2 shows mapping information for logical volume hd2. It lists each
logical partition and the physical partitions on the physical volumes that contain the
information. In this case, we only have one copy so nothing is shown under PP2/PV2 or
PP3/PV3.
Uempty
Notes:
Notes:
The lsvg command with the -l VG flag will display logical volume information for the
given volume group.
Uempty
Checkpoint
1.True or False: A physical volume can only belong to one
volume group.
Notes:
LVM concepts
Create volume groups and logical volumes
Notes:
Uempty
Unit summary
A volume group is a structure used to organize physical and logical
volumes
When a disk drive is added to a volume group, it becomes known
asa physical volume
Every physical volume in use belongs to a volume group
All of the physical volumes in a volume group are divided into
physical partitions
All the physical partitions within a volume group are the same size
Within each volume group, one or more logical volumes are defined
Logical volumes are groups of information located on physical
volumes
Logical partitions are the same size as the physical partitions within
a volume group
Each logical partition is mapped to at least one physical partition
Notes:
References
AIX Operating System and Device Management
System Management Concepts: Operating System and Devices
Redbook SG24-5432 - AIX Logical Volume Manager:
from A to Z: Introduction and Concepts
Redbook SG24-5433 - AIX Logical Volume Manager:
from A to Z: Troubleshooting and Commands
Unit objectives
After completing this unit, you should be able to:
Use the commands to mirror and stripe logical volumes
List the mirror scheduling policies
Define the mirrored logical volume strictness
Create mirror pools
Display mirror pool information
Use mirror pools when creating a logical volume, adding a mirrored
copy to an existing logical volume
Change which mirror pools a logical volume is assigned to
Enable an existing logical volume to use mirror pools
Disable a mirror pool
Define mirror pool strictness
Notes:
Uempty
Mirroring
Logical volumes can be mirrored
Each logical volume can have one, two or three copies
## lsvg
lsvg -l
-l testvg
testvg
testvg:
testvg:
LV
LV NAME
NAME TYPETYPE LPs
LPs PPs
PPs PVsPVs LVLV STATE
STATE MOUNT
MOUNT POINT
POINT
lv00
lv00 jfs
jfs 33 33 11 closed/syncd N/A
closed/syncd N/A
lv01
lv01 jfs
jfs 22 22 11 closed/syncd
closed/syncd N/AN/A
## mklvcopy
mklvcopy lv00
lv00 22
## lslv
lslv -m
-m lv00
lv00 lv00
lv00:N/A
lv00:N/A
LP
LP PP1
PP1 PV1PV1 PP2
PP2 PV2
PV2 PP3
PP3 PV3
PV3
0001 LP0 LP1 LP2
0001 0193
0193 hdisk1
hdisk1 0195
0195 hdisk2
hdisk2
0002
0002 0194
0194 hdisk1
hdisk1 0196
0196 hdisk2
hdisk2
0003
0003 0195
0195 hdisk1
hdisk1 0197
0197 hdisk2
hdisk2
## mirrorvg
mirrorvg testvg
testvg
0516-1804
0516-1804 chvg:
chvg: The
The quorum
quorum change
change takes
takes effect
effect immediately.
immediately.
## lslv
lslv -m
-m lv01
lv01 PP20 PP2 PP3
PP73
lv01:N/A
lv01:N/A
LP
LP PP1
PP1 PV1PV1 PP2
PP2 PV2
PV2 PP3
PP3 PV3
PV3 PP32 PP44
0001
0001 0193
0193 hdisk2
hdisk2 0196
0196 hdisk1
hdisk1
0002
0002 0194
0194 hdisk2
hdisk2 0197
0197 hdisk1
hdisk1 hdisk1 hdisk2
## lsvg
lsvg -l
-l testvg
testvg
testvg:
testvg:
LV
LV NAME
NAME TYPETYPE LPs
LPs PPs
PPs PVsPVs LVLV STATE
STATE MOUNT
MOUNT POINT
POINT
lv00
lv00 jfs
jfs 33 66 22 closed/syncd
closed/syncd N/AN/A
lv01
lv01 jfs
jfs 22 44 22 closed/syncd
closed/syncd N/AN/A
Notes:
The basic concept of mirroring is simple – keep multiple copies of the data replicated in
different locations to eliminate the possibility of data loss in case of a disk failure
situation. To provide the best availability, each copy of the mirrored data should be
located on separate physical disks, and accessed using separate I/O adapters. If you
are using SAN disks, you need to know how the SAN disks are divided up. As far as
LVM is concerned, each SAN disk presented is a different disk.
LVM supports one (unmirrored), two, or three copies of a logical volume.
read 3 *
read 2 *
read 1
with sequential read
* If needed
Parallel write
UNIX Software Service Enablement © Copyright IBM Corporation 2012
Notes:
LVM offers several scheduling policies for mirrored volumes to control how data is
written and read from the copies. The following table shows the scheduling policies and
the mklv or chlv arguments to set the policies.
mklv or chlv
Policy Write Operation Read Operation
argument
Sequential Sequential Sequential -d s
Parallel Parallel Parallel -d p
Parallel/sequential Parallel Sequential -d ps
Parallel/round-robin Parallel Round-robin -d pr
Uempty
PP1 PP2 PP3 PP1 PP2 PP3 PP1 PP2 PP3 PP1 PP2 PP3
Notes:
The striping mechanism, also known as RAID 0, is a technology that was developed to
achieve I/O performance gain. The basic concept of striping is that in the write phase,
each logical partition is chopped into small pieces (called stripe units, or chunks) and
these chunks are written to separate physical volumes in parallel. In the read phase,
these chunks are read from those separate physical volumes in parallel, and
re-assembled into the actual data.
lv00
LP1 LP2
lv00 Strict Super strict
1-1 1-2 2-1 2-2
LP1 LP2
hdisk1 hdisk2
PP20
PP2 PP3
PP32
Notes:
Strict allocation requires that the copies of each logical partition cannot share a physical
volume.
Super strict allocation require that copy 1 of LPx cannot be on the same physical
volume as copy 2 of LPy in the same logical volume.
Uempty
Mirroring rootvg
1. Locate disk(s) to add to rootvg. Make sure it is bootable
bootinfo -B hdisk1
2. Add disk(s) to rootvg.
extendvg rootvg hdisk1
3. Mirror rootvg.
mirrorvg -m rootvg hdisk1
4. Update boot record on newly mirrored disk.
bosboot –ad /dev/hdisk1
5. Update bootlist to include new disk.
bootlist -m normal hdisk0 hdisk1
6. Test ability to reboot from new disk.
a) Shutdown
b) Disable hdisk0
c) Reboot
* Note: These steps assume hdisk0 is the current disk in rootvg and hdisk1 is the disk that
is being added to mirror rootvg
Notes:
Mirroring the rootvg volume group is important because by maintaining an active
mirrored copy of rootvg on another disk you can ensure AIX will continue to run in the
event of a disk failure.
By having a mirror copy of rootvg on another disk, you have the ability to boot from
more than one disk in the event that another boot disk has failed.
Mirror pools
Physical volumes in a scalable volume group can be separated into
mirror pools
Simplifies the task of mirroring data
A physical volume can only belong to one mirror pool at a time
Logical volume copies that are assigned to a mirror pool will only
allocate partitions from the physical volumes in that mirror pool
Any changes to mirror pool characteristics will not affect partitions
allocated before the changes were made
The reorgvg command should be used after mirror pool changes
are made to move the allocated partitions to conform to the mirror
pool restrictions
Notes:
A mirror pool is made up of one or more physical volumes. Each physical volume can
only belong to one mirror pool at a time. Mirror pools can only be used with scalable
volume groups.
When a mirrored logical volume is created, each copy can be assigned to a mirror pool.
Once assigned to a mirror pool, the logical volume copies will only allocate partitions
from the physical volumes in their mirror pool.
If something is changed with the characteristics of a mirror pool, new logical partitions
will adhere to those changes but existing logical partitions will not be affected. To bring
all the logical partitions to follow the new characteristics, you must use the reorgvg
command.
Uempty
The lsvg -P command lists the mirror pool that each physical
volume in the volume group belongs to
The lspv P command lists the mirror pool that each physical
volume belongs to
Notes:
Mirror pools are created by just assigning physical volumes to them. This can be done
when first creating a scalable volume group with the mkvg -p flag, or when a physical
volume is added to a volume group with the extendvg -p flag, or when assigning
physical volume to a mirror pool with the chpv -p flag.
To see all the mirror pools in a volume group and the physical volumes that belong to
them, you can use the lsvg -P command.
To see what mirror pool a single physical volume belongs to you can use the lspv -P
command.
Notes:
Uempty
Notes:
When creating a logical volume, you can specify which mirror pool to use for each copy
with the mklv -p flag.
To add a mirrored copy to an existing logical volume with the mklvcopy command, use
the mklvcopy -p flag.
To mirror all the logical volumes in a volume group and assigned the mirror pools to use,
use the mirrorvg command with the -p flag.
## lslv
lslv lv00
lv00
LOGICAL
LOGICAL VOLUME:
VOLUME: lv00
lv00 VOLUME
VOLUME GROUP:
GROUP: vg00
vg00
LV
LV IDENTIFIER:
IDENTIFIER: 00f6bccb00004c0000000137907c488b.1
00f6bccb00004c0000000137907c488b.1 PERMISSION:
PERMISSION: read/write
read/write
VG
VG STATE:
STATE: active/complete
active/complete LV
LV STATE:
STATE: closed/syncd
closed/syncd
TYPE:
TYPE: jfs
jfs WRITE
WRITE VERIFY:
VERIFY: offoff
MAX
MAX LPs:
LPs: 512
512 PP
PP SIZE:
SIZE: 32
32 megabyte(s)
megabyte(s)
COPIES:
COPIES: 22 SCHED
SCHED POLICY:
POLICY: parallel
parallel
LPs:
LPs: 44 PPs:
PPs: 88
STALE
STALE PPs:
PPs: 00 BB
BB POLICY:
POLICY: relocatable
relocatable
INTER-POLICY:
INTER-POLICY: minimum
minimum RELOCATABLE:
RELOCATABLE: yes
yes
INTRA-POLICY:
INTRA-POLICY: middle
middle UPPER
UPPER BOUND:
BOUND: 1024
1024
MOUNT
MOUNT POINT:
POINT: N/A
N/A LABEL:
LABEL: None
None
DEVICE
DEVICE UID:
UID: 00 DEVICE
DEVICE GID:
GID: 00
DEVICE
DEVICE PERMISSIONS:
PERMISSIONS: 432432
MIRROR
MIRROR WRITE
WRITE CONSISTENCY:
CONSISTENCY: on/ACTIVE
on/ACTIVE
EACH
EACH LP
LP COPY
COPY ON
ON AA SEPARATE
SEPARATE PV
PV ?:
?: yes
yes
Serialize
Serialize IO
IO ?:
?: NO
NO
DEVICESUBTYPE
DEVICESUBTYPE :: DS_LVZ
DS_LVZ
COPY
COPY 11 MIRROR
MIRROR POOL:
POOL: MP1
MP1
COPY
COPY 22 MIRROR
MIRROR POOL:
POOL: MP2
MP2
COPY
COPY 33 MIRROR
MIRROR POOL:
POOL: None
None
Notes:
Uempty
Notes:
Notes:
Uempty
Any partitions allocated before the chlv command is run will not
belong to the mirror pool specified in the chlv command
The reorgvg command will need to be run to move the old partitions
to the new mirror pool
Syntax: reorgvg VG [LV]
Notes:
The mirror pool that a copy of a logical volume is assigned to can be changed with the
chlv -m command. The -m flag specifies a mirror pool for each copy of the logical
volume. To specify more than one copy, provide multiple -m flags, one for each copy.
Any physical partitions allocated before the chlv command is run will belong to the
original mirror pool. The reorgvg command will need to be run to move the original
physical partitions to the new mirror pool.
Notes:
Uempty
Notes:
Notes:
Uempty
Notes:
If you no longer want to use a mirror pool on a logical volume, you can use the chlv -M
flag to disable it.
Notes:
To remove a physical volume from a mirror pool, use the chpv -P command.
Uempty
Notes:
When a volume group is deleted, all the mirror pools in that volume group are deleted.
Notes:
Mirror pool strictness can be used to enforce tighter restrictions on mirror pool use.
When strict mirror pools are enabled, any logical volume created in the volume group
must have mirror pools enabled for each copy of the logical volume. However, logical
volumes created before strict mirror pools are enabled don't have to have mirror pools
enabled.
A super strict allocation policy can be set so that the partitions allocated for one mirror
cannot share a physical volume with the partitions from another mirror. Also, there can
be a maximum of three mirror pools per volume group and each mirror pool must
contain at least one copy of each logical volume.
By default, mirror pool strictness if turned off.
Uempty
## lsvg
lsvg -P
-P vg00
vg00
Physical
Physical Volume
Volume Mirror
Mirror Pool
Pool
hdisk1
hdisk1 MP1
MP1
hdisk2
hdisk2 MP2
MP2
hdisk3
hdisk3 None
None
## lslv
lslv -m
-m lv03
lv03
lv03:N/A
lv03:N/A
LP
LP PP1
PP1 PV1
PV1 PP2
PP2 PV2
PV2 PP3
PP3 PV3
PV3
0001
0001 0202
0202 hdisk2
hdisk2 0195
0195 hdisk3
hdisk3
0002
0002 0203
0203 hdisk2
hdisk2 0196
0196 hdisk3
hdisk3
0003
0003 0204
0204 hdisk2
hdisk2 0197
0197 hdisk3
hdisk3
Notes:
When creating a volume group without the mkvg M flag, there are no
restrictions on mirror pools
The chvg -M command changes the mirror pool strictness of a volume
group:
-M y Each logical volume copy created in the volume group must be assigned
to a mirror pool.
-M s Super strict mirror pools are enforced on the volume group.
-M n No restrictions are placed on the user of mirror pool (default)
Logical volumes created before strict mirror pools are enabled do not have
to have mirror pools enabled
Notes:
The mirror pool strictness can be set when the volume group is created with the
mkvg -M flag.
- The mkvg -M y flag turns on the mirror pool strict policy.
- The mkvg -M s flag turns on the mirror pool super strict policy
When a volume group is created, mirror pool strictness is off by default.
The mirror pool strictness for the volume group can be changed with the chvg -M
command.
- The chvg -M y flag changes the volume group's mirror pool strictness to strict
- The chvg -M s flag changes the volume group's mirror pool strictness to super strict
- The chvg -M n flag turns off mirror pool strictness
Uempty
Notes:
Notes:
Uempty
Checkpoint
1.True or False: A logical volume can have up to three copies
2.True or False: Mirror pools can be used with any type of volume
group
3.True or False: A physical volume can only belong to one mirror pool
at a time
5.True or False: Logical volumes created before strict mirror pools are
enabled do not have to have mirror pools enabled
Notes:
Exercise 2: Mirroring
This exercise consists of two parts:
Notes:
Uempty
Unit summary
Mirroring provides additional copies of data to protect against data loss due to
hardware failure
Striped logical volumes have the data spread across disks in such a way that
I/O can occur in parallel
Physical volumes in a scalable volume group can be separated into mirror pools
Mirror pools can be created with the mkvg, extendvg, and chpv commands
Mirror pools can be used when creating a logical volume, adding a mirrored
copy to an existing logical volume, and mirroring all logical volumes in a volume
group
Logical volume copies that are assigned to a mirror pool will only allocate
partitions from the physical volumes in that mirror pool
Any changes to mirror pool characteristics will not affect partitions allocated
before the changes were made
The reorgvg command should be used after mirror pool changes are made to
move the allocated partitions to conform to the mirror pool restrictions
Mirror pool strictness can be used to enforce tighter restrictions on mirror pool
use
UNIX Software Service Enablement © Copyright IBM Corporation 2012
Notes:
References
AIX Operating System and Device Management
Redbook SG24-5432 - AIX Logical Volume Manager:
from A to Z: Introduction and Concepts
Redbook SG24-5433 - AIX Logical Volume Manager:
from A to Z: Troubleshooting and Commands
Unit objectives
After completing this unit, you should be able to:
Notes:
Uempty
High Level
lcreatelv
Intermediate
Library Calls
lvm_createlv
SCSI DD
Notes:
The LVM consists of:
- High level commands
- Intermediate level commands
- Logical volume manager subroutine interface library
- Logical volume device driver
- Disk device driver
- Adapter device driver
The visual shows the path from a high level command (mklv) to an intermediate
command (lcreatelv) to a library function (lvm_createlv) to the logical volume device
driver to the disk device driver to the SCSI device driver and to the physical volume.
Other applications, for example, the journaled file system, talk directly to the LVDD.
LVM metadata
LVM metadata is the configuration and status information
required by the LVM system to operate correctly
Notes:
LVM metadata is the configuration and status information required by the LVM system
to operate correctly. This is in contrast with LVM data, which is the actual contents of the
logical volumes. LVM metadata is stored in a number of places.
Uempty
Stored in:
ODM (as 32 characters)
Address hex 80 (0x80) on the physical disk
Combination of the machines serial number and the date when it was generated
PVID value:
Is initially assigned when the disk is added to a volume group
Can be assigned with the mkdev
Disk
flag -a pv=yes ODM
Can be changed with the chdev Platform serial number
flag -a pv=yes
000db97134130580
Notes:
The PVID is a hex number which is used to uniquely identify the physical volume to the
system. The PVID contains 32 characters, and is stored in the ODM (CuAt object class)
and at address hex 80 (0x80) on the disk drive. It is a combination of the machine’s
serial number and the date when it was generated. At this time, the last 16 digits of the
PVID are set to zero.
## od
od -N
-N 0x10
0x10 -j
-j 0x80
0x80 -x
-x /dev/hdisk0
/dev/hdisk0
0000000
0000000 00f600f6 bccb
bccb f031
f031 4e2f
4e2f 0000
0000 0000
0000 0000
0000 0000
0000
0000010
0000010
Two ways to view the PVID value in the ODM (stored in CuAt)
## lsattr
lsattr -Ea
-Ea pvid
pvid -l
-l hdisk0
hdisk0
pvid
pvid 00f6bccbf0314e2f0000000000000000 Physical
00f6bccbf0314e2f0000000000000000 Physical volume
volume identifier
identifier False
False
## lspv
lspv
hdisk0
hdisk0 00f6bccbf0314e2f
00f6bccbf0314e2f rootvg
rootvg active
active
hdisk1
hdisk1 00f6bccb38abc7f2
00f6bccb38abc7f2 testvg
testvg active
active
hdisk2
hdisk2 00f6bccb38abc861
00f6bccb38abc861 testvg
testvg active
active
hdisk3
hdisk3 none
none None
None
hdisk4
hdisk4 none
none None
None
UNIX Software Service Enablement © Copyright IBM Corporation 2012
Notes:
Uempty
LVCB location:
First 512 bytes of logical volume:
Normal volume group
Big volume group created without the mklv -T O flag
Part of the Volume Group Descriptor Area (VGDA):
Big volume group created with the mklv -T O flag
Scalable volume group
Be careful with raw logical volumes that have the LVCB at the beginning of
the logical volume
Notes:
Notes:
The intermediate level command, getlvcb -AT LVNAME, displays the contents of the
LVCB.
Uempty
Notes:
You can determine where the LVCB is by looking at the output of the lslv command.
If the LVCB is part of the Volume Group Descriptor Area rather than the first 512 bytes
of the logical volume, you will see an additional line at the end of the lslv output.
........
UNIX Software Service Enablement © Copyright IBM Corporation 2012
Notes:
Uempty
Notes:
You can use the command lqueryvg -p hdiskX -At to view some of the VGDA
contents. If you issue this command for all the physical volumes in a volume group, the
output should be the same.
Notes:
Quorum is the check used by the LVM to resolve possible data conflicts and to prevent
data corruption. A quorum ensures data integrity of the VGDA/VGSA areas in the event
of a disk failure.
Each physical disk in a volume group has at least one VGDA/VGSA. In order to form a
quorum, the LVM must be able to access more than 50% of the VGDAs in the volume
group.
A volume group cannot be varied on if there is no quorum. Normally, if quorum is lost
while a volume group is active, an error message is issued and the volume group is
varied off.
There are cases when it is desirable to continue operating the volume group even
though a quorum is lost. In these cases, quorum checking can be turned off for the
volume group with the chvg -Q n command.
Uempty
importvg y VG PV
ODM
ODM
Notes:
exportvg and importvg are used to remove and add volume groups on a system. They
can also be used to fix corrupt LVM information in the ODM.
Use the -w flag in the mklv and chlv commands to set the MWC type to
use:
y or a - Turns on active mirror write consistency
p - Turns on passive mirror write consistency (only big and scalable volume
groups)
n - No mirror write consistency
Notes:
The Mirror Write Consistency (MWC) record identifies which logical partitions may be
inconsistent if the system is not shut down correctly. When the volume group is varied
back on-line, this information is used to make the logical partitions consistent again.
Uempty
Checkpoint
1.True or False: All PVIDs must be unique within a system.
2.True or False: LVM metadata is stored in both the ODM and on physical
volumes.
3.True or False: The LVCB is always located in the first 512 bytes of a
logical volume.
4.True or False: The information in the VGDAs on all disks within a volume
group is the same.
Notes:
ODM tests
Notes:
Uempty
Unit summary
LVM metadata is the configuration and status information required by
the LVM system to operate correctly
LVM data is the actual contents of the logical volumes
LVM metadata includes:
PVID
LVCB
VGDA
VGSA
MWC cache
LVM metadata is stored in multiple places:
ODM
On-disk
Notes:
References
AIX Operating System and Device Management
System Management Concepts: Operating System and Devices
Redbook SG24-5432 - AIX Logical Volume Manager:
from A to Z: Introduction and Concepts
Redbook SG24-5433 - AIX Logical Volume Manager:
from A to Z: Troubleshooting and Commands
© Copyright IBM Corp. 2012 Unit 4. Disk Replacement and Other LVM Issues 4-1
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Notebook
Unit objectives
After completing this course, you should be able to:
Notes:
Uempty
Disk replacement
Many LVM problems result from incorrect procedures when
replacing a disk drive
Notes:
Most of the problems a system administrator encounters are related to physical disks. It
is important to be aware of some of the procedures that can be used for disk
replacement, what can happen if the procedures are not followed, and how to fix the
problem.
© Copyright IBM Corp. 2012 Unit 4. Disk Replacement and Other LVM Issues 4-3
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Notebook
All logical volumes on, or partially on, the physical volume are
removed (with the -d flag)
ODM
ODM
Notes:
The reducevg command is used to remove a disk from a volume group, and is totally
different from exportvg, because it modifies both ODM and the VGDA.
If a disk is removed from a system without first running reducevg, the VGDA still has
the information about the removed disk, but the physical volume name no longer exists.
To remove this reference to the missing disk you can still use the reducevg command,
but with the PVID instead of the name.
You can use lqueryvg to get the PVIDs from the VGDA, then compare that with the
output from lspv to find the missing disk’s PVID.
# lquerypv -p <PVID_of_any_disk_in_VG> -At
Uempty
5. Remove PV from ODM 11. Recreate single copy LVs and file systems
6. Physically swap disks 12. Restore single copy LVs from backup
myvg
Notes:
This first case study is a scenario where a disk is not responding to queries. A probable
cause is that the disk is failing.
You should be familiar with which logical volumes are on the failing disk. To look at the
contents of a failing drive, use one of the other drives. In the example, use hdisk1 to
look at the logical volumes on hdisk2 with the following command:
# lspv -l -n hdisk1 hdisk2
© Copyright IBM Corp. 2012 Unit 4. Disk Replacement and Other LVM Issues 4-5
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Notebook
Notes:
There are two commands that enable you to move data from one physical device to
another: replacepv and migratepv.
The replacepv command replaces one physical volume in a volume group with one
other physical volume. The allocation of the new physical partitions follows the policies
defined for the logical volumes that contain the physical partitions being replaced.
The basic syntax is: replacepv {sourcepvname | sourcepvid } destpvname
The migratepv command moves allocated physical partitions and the data they contain
from one physical volume to one or more other physical volumes. The allocation of the
new physical partitions follows the policies defined for the logical volumes that contain
the physical partitions being moved.
The basic syntax is: migratepv [-l LV] SourcePV [DestPV..]
Uempty
Notes:
Using the replacepv command saves you several steps.
Note: Using the previous procedure, the replacement disk would get the same name as
the failing disk (hdisk2 in our example). Using replacepv, the new disk will get a new
disk name (hdisk4 in our example) and the failing disk name (hdisk2) will be available
if an additional disk is added later.
© Copyright IBM Corp. 2012 Unit 4. Disk Replacement and Other LVM Issues 4-7
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Notebook
Renaming a device
The rendev command can be used to rename devices
Syntax: rendev -l Name -n NewName
Disk drive devices that are members of rootvg, or that will become
members of the rootvg (by means of LVM or install procedures), must
not be renamed
Notes:
The device to be renamed is specified with the -l flag, and the new name is specified
with the -n flag. The new name can't be longer than 15 characters.
To be able to rename a device, the device must be unconfigured. If the device is in the
Available state, the rendev command will unconfigure the device before renaming it.
This is similar to the operation performed by the rmdev -l command. If it can't
unconfigure the device, it won't be able to rename it. After the rendev renames the
device, it will configure and restore it to the Available state. The -u flag may be used to
prevent the device from being configured and will leave it in a Defined state.
If the name is already in use or is currently in the /dev directory, the rendev command
will fail. A variation of this, is if the name formed by appending the new name after the
character r is already used as a device name, or appears in the /dev directory, the
operation fails.
Uempty
Possible causes:
Proper procedures were not followed when removing the device
Solution 1:
First, try the following steps:
1. Remove the phantom logical volumes with the rmlv command
2. Do a reducevg to remove phantom physical volumes from the
volume group
3. Remove the phantom disk with rmdev
Notes:
The most common problem seen at a customer site is when an external disk was
removed without doing the necessary pre-removal operations such as reducevg, rmdev
etc. How best can you clean up the system once the damage has been done? What
operations will purge the ODM of the entries pertaining to the removed disk, its volume
group, its logical volumes and file systems? The lsvg and lspv commands continue to
show you that a volume group that used to exist on the disk is present. However, it is
not really there, because the disk has been removed.
© Copyright IBM Corp. 2012 Unit 4. Disk Replacement and Other LVM Issues 4-9
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Notebook
2. Search for all instances of the volume group, hdisk#, logical volume
names and log logical volume names in each of the customized classes.
For example:
## odmget
odmget CuAt
CuAt || grep
grep newvg
newvg
## odmget
odmget CuDvDr
CuDvDr || grep
grep hdisk1
hdisk1
3. Use the odmdelete command to delete every object you found in step 2
For example:
## odmdelete
odmdelete -o
-o CuAt
CuAt -q
-q name=newvg
name=newvg
## odmdelete
odmdelete -o
-o CuDvDr
CuDvDr -q
-q value3=hdisk3
value3=hdisk3
Notes:
If the commands on the previous visual don't work, the only way to completely clean up
the ODM is by using the ODM commands to work directly with the ODM.
Uempty
LVM/ODM inconsistency (1 of 2)
Symptoms:
Inconsistent or missing data when using high level commands
High level commands fail with error messages
Possible causes:
The root (/) or /tmp file systems are full
ODM corrupted
Hardware failure
Incorrect procedures
Solutions:
Non-rootvg
exportvg and importvg
redefinevg and synclvodm (if exportvg/importvg does not work)
rootvg
Try redefinevg and synclvodm
Boot to maintenance mode
Notes:
High level commands use both the ODM and the LVM on-disk metadata. Symptoms of
inconsistency between the ODM and the on-disk metadata can be the failure of high
level commands, or inconsistent or missing data from high level commands.
© Copyright IBM Corp. 2012 Unit 4. Disk Replacement and Other LVM Issues 4-11
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Notebook
LVM/ODM inconsistency (2 of 2)
After it boots into maintenance mode, follow these steps to recover rootvg:
1. Get the list of logical volumes from the VGDA of the physical volume, then delete
all of the ODM information about logical volumes on rootvg:
## lqueryvg
lqueryvg -p-p hdisk0
hdisk0 -L
-L || awk
awk '{print
'{print $2}'
$2}' \\
|| while
while read
read LVname;
LVname; dodo
>> odmdelete
odmdelete -q-q name=$LVname
name=$LVname -o -o CuAt
CuAt
>> odmdelete
odmdelete -q-q name=$LVname
name=$LVname -o -o CuDv
CuDv
>> odmdelete
odmdelete -q-q value3=$LVname
value3=$LVname -o -o CuDvDr
CuDvDr
>> done
done
2. Delete the volume group information from ODM:
## odmdelete
odmdelete -q
-q name=rootvg
name=rootvg -o
-o CuAt
CuAt
## odmdelete
odmdelete -q
-q parent=rootvg
parent=rootvg -o-o CuDv
CuDv
## odmdelete
odmdelete -q
-q name=rootvg
name=rootvg -o
-o CuDv
CuDv
## odmdelete
odmdelete -q
-q name=rootvg
name=rootvg -o
-o CuDep
CuDep
## odmdelete
odmdelete -q
-q dependency=rootvg
dependency=rootvg -o -o CuDep
CuDep
## odmdelete
odmdelete -q
-q value1=10
value1=10 -o
-o CuDvDr
CuDvDr
## odmdelete
odmdelete -q
-q value3=rootvg
value3=rootvg -o-o CuDvDr
CuDvDr
3. Add the rootvg associated with the physical volume back to the ODM:
## importvg
importvg -y
-y rootvg
rootvg hdisk0
hdisk0
5. Reboot
UNIX Software Service Enablement © Copyright IBM Corporation 2012
Notes:
For rootvg, the problem is more difficult: rootvg cannot be exported. It may be possible
to fix the problem using the redefinevg or synclvodm commands.
If that doesn’t fix the problem, you must go into the RAM Disk Maintenance Mode (Boot
into Maintenance mode from the DVD/CD-ROM).
Use the steps in the visual to recover the rootvg volume group after booting to
maintenance mode and mounting file systems.This assumes that hdisk0 is part of
rootvg.
Uempty
Hot sparing
hdisk5 hdisk6 hdisk7 hdisk8
hdisk10
Notes:
You can designate disks as hot spare disks for a volume group with mirrored logical
volumes. This support complements but does not replace the sparing support available
with serial storage architecture (SSA) disks. You can also add hot-spare disks using
SSA disks when you add one to your volume group.
When a disk is configured as a hot spare, it is unused until a failure. It is available to
replace any failing mirrored disk in the volume group.
When a disk fails, LVM replaces the failing disk with the hot spare disk from the
remaining copy(ies) of the logical volumes that were on the failing disk. The hot spare
disk is no longer available to replace a failing disk.
© Copyright IBM Corp. 2012 Unit 4. Disk Replacement and Other LVM Issues 4-13
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Notebook
Problem determination
Most LVM problems are related to disk failure
Failure itself
Incorrect procedures after a disk failure
First step: Backup data! (if possible)
Depending on the exact nature of the problem you are experiencing, a recovery
attempt that fails may leave the system in worse condition than before
Keep a log of the actions you take
Problem determination methodology:
1. Define the problem
Gather information from users
Gather information from the system
Try easy, no-risk solutions immediately
2. Make hypothesis
3. Check your assumptions This is often an
4. Trial solution iterative process
UNIX Software Service Enablement © Copyright IBM Corporation 2012
Notes:
Uempty
Checkpoint (1 of 2)
1. Which command redefines the set of physical volumes in the ODM,
based on the VGDA of a volume group?
a. synclvodm
b. reducevg
c. redefinevg
d. reducepv
Notes:
© Copyright IBM Corp. 2012 Unit 4. Disk Replacement and Other LVM Issues 4-15
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Notebook
Checkpoint (2 of 2)
3. True or False: The probable cause of phantom entries in the
ODM is not following proper procedures removing the device.
Notes:
Uempty
Corrupted PVID
Notes:
© Copyright IBM Corp. 2012 Unit 4. Disk Replacement and Other LVM Issues 4-17
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Notebook
Unit summary
Many LVM problems result from incorrect procedures when
replacing a disk drive
Notes:
Checkpoint solutions
1. True or False: A physical volume can only belong to one volume group.
The answer is True.
2. True or False: All physical partitions within a volume group are the same
size.
The answer is True.
4. True or False: Logical partitions are the same size as physical partitions
within a volume group.
The answer is True.
Checkpoint solutions
1. True or False: A logical volume can have up to three copies
The answer is True.
2. True or False: Mirror pools can be used with any type of volume
group
The answer is False. Only with scalable volume groups.
3. True or False : A physical volume can only belong to one mirror
pool at a time
The answer is True.
4. True or False : Any partitions allocated before the chlv command is
run will belong to the mirror pool specified in the chlv command
The answer is False.
5. True or False : Logical volumes created before strict mirror pools
are enabled do not have to have mirror pools enabled
The answer is True.
UNIX Software Service Enablement © Copyright IBM Corporation 2012
Checkpoint solutions
1. True or False: All PVIDs must be unique within a system.
The answer is True.
2. True or False: LVM metadata is stored in both the ODM and on physical
volumes.
The answer is True.
3. True or False: The LVCB is always located in the first 512 bytes of a logical
volume.
The answer is False.
4. True or False: The information in the VGDAs on all disks within a volume group
is the same.
The answer is True.
5. A quorum is:
a. Half the number of available disks
b. More than half the number of available disks
c. Half the number of active VGDAs
d. More than half the number of active VGDAs
The answer is d.
UNIX Software Service Enablement © Copyright IBM Corporation 2012
Checkpoint solutions (1 of 2)
1. Which command redefines the set of physical volumes in the ODM,
based on the VGDA of a volume group?
a. synclvodm
b. reducevg
c. redefinevg
d. reducepv
The answer is c.
Checkpoint solutions (2 of 2)
3. True or False: The probable cause of phantom entries in the
ODM is not following proper procedures removing the device.
The answer is True.
backpg
Back page