Tips & Tricks For Using LVM Effectively / Intro To VXVM: Renay Gaye Hewlett-Packard
Tips & Tricks For Using LVM Effectively / Intro To VXVM: Renay Gaye Hewlett-Packard
Tips & Tricks For Using LVM Effectively / Intro To VXVM: Renay Gaye Hewlett-Packard
LVM Concepts
pvid
pvcreate /dev/rdsk/cntndn
pvid
vgid
pvid
vgid
mknod /dev/vgname/group c 64
0xnn0000
vgcreate vgname /dev/dsk/cntndn ...
vgid
pvid
vgid
pvid
map
map
pv 0
pv 1
pv 2
~
~
pv 15
pe pe
2 3
~
~
pe pe
0 1
pe
1016
dsk
rdsk
vg01
c0t5d0
c0t5d0
c0t6d0
c0t6d0
group
lvol1
V G device
file
Block LV
device files
lvol2
Block PV
device files
Raw PV
device files
rlvol1
rlvol2
Raw LV
device files
/etc/lvmtab
Non-ascii file
Records volume
group/physical volume
associations
Used by many LVM
commands for sanity
checking
example:
/dev/vg00 (vgid)
/dev/dsk/c0t6d0 (vgid,pvid)
/dev/vg01 (vgid)
/dev/dsk/c1t2d1 (vgid,pvid)
/dev/dsk/c1t2d2 (vgid,pvid)
vgid
vgra
pvid
vgid
vgra
vgchange -a y vgname
vgchange -a r vgname
Memory
LVM Concepts-Quorum
More than 1/2 disks in a vg
required to activate the
volume group
Can override:
vg01
vgchange -a y -q n vg01
pvid
vgid
pvid
vgid
vgid
pvid
map
vgid
pvid
map
pv 0 01
pv 1
pv 2
lvcreate -L n vgname
lvcreate -L n -C y vgname
lvcreate -l n vgname
~
~
pv 15
01
pe pe pe
2 3 4
01
01
01
~
~
pe pe
0 1
pe
1016
vgid
pvid
map
pv 0 01
01
01
01
01
pv 1 02
02
02
02
02
pv 2
~
~
pv 15
~
~
map
vgid
pvid
pe pe pe
2 3 4
~
~
pe pe
0 1
02
pe
1016
Multi-pathing solutions
Auto path
active/active, load balancing
supported for XP and VA arrays
additional cost product
Powerpath
active/active, load balancing
supported for EMC arrays
additional cost product
PV links
pvcreate /dev/rdsk/c5t5d0
pvcreate /dev/rdsk/c5t5d1
pvid
vgid
pvid
vgid
mkdir /dev/vg01
mknod /dev/vg01/group c 64
0x010000
vgcreate vg01
/dev/dsk/c5t5d0 /dev/dsk/c7t5d0
/dev/dsk/c7t5d1 /dev/dsk/c5t5d1
c5t5d0 (p)
c7t5d0 (a)
c7t5d1 (p)
c5t5d1 (a)
pvid
vgid
pvid
vgid
Permanent Change
vgreduce vg01 /dev/dsk/c5t5d0
vgextend vg01 /dev/dsk/c5t5d0
c7t5d1 (p)
c5t5d1 (a)
Server
Auto Path
HBA HBA HBA HBA HBA HBA HBA HBA
FC FC FC FC FC FC FC FC
Port Port Port Port Port Port Port Port
C HIP Board 1
C HIP Board 2
Array
LDEV
A pseudo driver
The Auto Path driver is
layered between the LVM
(Logical Volume
Manager) and the SCSI
device driver
The driver provides the
Command Line Interface
File System
Logical Volum e Manager
Auto Path
Drivers
(SCSI device and FC interface)
FC HBA
FC HBA
Disk Array
Moving Data
Moving Disks
Three Step Process
1. Remove definition of volume group
2. Move disk(s)
3. Add definition ofvolume group
Two com mands
vgexport(1m)
vgimport(1m)
/dev/vg01
/dev/vg01
group
/dev/dsk/c0t5d0
64 0x010000
lvol1 64 0x010001
rlvol1 64 0x010001
databaselv 64 0x010002
rdatabaselv 64 0x010002
V GR A + PVRA
-PV ID
- VG ID
PE to LE map
/dev/vg01
Example:
mkdir /dev/vg01
mknod /dev/vg01/group c 64 0x010000
vgimport -v -m /etc/lvmconf/vg01.map /dev/vg01 /dev/dsk/c0t1d0
vgchange -a y /dev/vg01
vgcfgbackup vg01
pvmove
free
free
c0t5d0
c0t4d0
Syntax:
pvmove [-n lv] from_PV [to_PV]
Example:
pvmove -n /dev/vg01/lvol1 /dev/dsk/c0t5d0 /dev/dsk/c0t4d0
LVM Mirroring
Mirrored Volumes
In a mirrored logical volume ...
Each logical volume consists of one or more Logical Extents(LEs).
Each LE maps to two orthree Physical Extents(PEs) on disk.
The logical volume remains accessible even when one ofthe disksis unavailable.
disk1
disk2
PE0
lvol1
LE0
PE0
PE1
LE1
PE1
PE2
LE2
PE2
PE3
PE3
PE4
lvol2
LE0
PE4
PE5
LE1
PE5
Sequential(-d s)
Read in PV order
Read
Write
Schedule writes
simultaneously to all PVs
Schedule writes in
PV order
MWC/MCR
Writes are recorded in MWC in memory
MCR record written to disk when a write is done to
a logical track group not already recorded
Write IO
M WC
LTG Status
0
1
2
LTG5
PVRA
V GR A
Disadvantage
Runtime overhead to
write MCR record
M W C/ M CR
-M y
Fastrecovery on
a system crash
NO M W C
-M n -c y
No extra
overhead at
Slow recovery on
a system crash
runtime
3
N O NE
-M n -c n
Application can
do necessary
recovery
No system managed
recovery
ISL,HPUX,AUTO,LABEL
LIF
V GR A
PE
Change the auto file on both the primary and alternate boot disk
mkboot -a "hpux -lq" /dev/rdsk/cntndn
Valuable Data?
The variouslvm data structures are crucialtothe continued availability of
logicalvolumes
/etc/lvmtab
Sanity check
vgdisplay -v
Kernel memory
Active
00
V Gs
01 02 03
/dev/vg01
/dev/dsk/c0t5d0
Cross
reference
PVRA/
V GR A
LV M
Structures
File
System
File
System
vgcfgbackup
vg01.conf
vg00.conf
LV M
Structures
vgcfgrestore
vg01.conf
vg00.conf
/etc/lvmtab
vg00
/dev/dsk/c0t6d0
/dev/dsk/c0t5d0
/dev/dsk/c0t4d0
vg01
/dev/dsk.....
............
Can be rebuiltiflost
PV ID
PV ID
PV ID
VG ID
VG ID
VG ID
Recover or Repair
/etc/lvmtab
Syntax:
vgscan [-v][-p]
Semi-intelligentlook at every disk to classify it
importsthose that are known to be on this system
recommends the import of "new" disks
rebuilds /etc/lvmtab
Ways to confuse vgscan
redundant group files
"old" LV M structures
System
PVG2
1 2 3
4 5 6
100%
Util
60%
Util
52 %
Util
60%
Util
System
System
2 4 6
8 10 12
5%
Util
50%
Util
Without Striping
52 %
Util
50%
Util
With Striping
LE1
LE5
LE9
LE2
LE6
LE10
LE3
LE7
LE11
PV1
PV2
PV3
PV4
PVG1
lvcreate -l 12 -s g -D y /dev/vg01
LE0
LE4
LE8
PV1
PVG2
LE0
LE4
LE8
PV1
LE1
LE5
LE9
PV2
LE1
LE5
LE9
PV2
LE2
LE6
LE10
PV3
LE2
LE6
LE10
PV3
lvcreate -l 12 -m 1 -s g -D y /dev/vg01
LE3
LE7
LE11
PV4
LE3
LE7
LE11
PV4
LVM in an MC/ServiceGuard
Environment
MC/ServiceGuard
Configuration
System
A
Primary
Mirror
Volume Group
System
B
System A
Volume Group
System B
System A
Volume Group
M ap File
VGID xxxxxxx
1 lvol_name1
2 lvol_name2
3 lvol_name3
System B
System A
vgexport -p -s -m /tmp/map vg01
Vol Grp
Node 2
/dev/vg01
/dev/vg01
group 64 0x010000
group 64 0x010000
lvol1 64 0x010001
rlvol1 64 0x010001
lvol1 64 0x010001
rlvol1 64 0x010001
databaselv 64 0x010002
rdatabaselv 64 0x010002
databaselv 64 0x010002
rdatabaselv 64 0x010002
/etc/lvmtab
/dev/vg01
/dev/dsk/c5t5d0
/dev/dsk/c7t5d0
/dev/dsk/c7t5d1
/dev/dsk/c5t5d1
pvid
vgid
pvid
vgid
/etc/lvmtab
/dev/vg01
/dev/dsk/c5t5d0
/dev/dsk/c7t5d0
/dev/dsk/c7t5d1
/dev/dsk/c5t5d1
Node1
Node2
cluster id
cluster id
A. No I
do not
Node1
cmlvmd
Node2
cmlvmd
cluster id
cluster id
vgchange -c y VGName
vgchange -c n VGName
vgchange -a y VGName
vgchange -a e VGName
Problem-Duplicate vgid
vgid-12345
c1t3d1
vgid-12345
c1t3d2
vgprim(pvols)
vgid-12345
c2t6d1
vgid-12345
c2t6d2
vgsec(svols)
Disk Array
Solution-vgchgid
vgid-12345
c1t3d1
vgid-12345
c1t3d2
vgprim(pvols)
vgchgid /dev/rdsk/c2t6d1
/dev/rdsk/c2t6d2
mkdir /dev/vgsec
mknod /dev/vgsec/group c 64
0x020000
vgexport -pm mapfile vgprim
vgid-56789
c2t6d1
vgid-56789
c2t6d2
vgsec(svols)
Disk Array
vgid-56789
c1t3d2
vgprim(pvols)
vgid-56789
c2t6d1
vgid-56789
c2t6d2
vgsec(svols)
Disk Array
/dev/vgpriv (vgid:12345)
/dev/dsk/c1t3d1
/dev/dsk/c1t3d2
Solution
export volume group
vgid-56789
c1t3d1
vgid-56789
c1t3d2
vgprim(pvols)
/etc/lvmtab
vgid-56789
c2t6d1
vgid-56789
c2t6d2
vgsec(svols)
Disk Array
/dev/vgpriv (vgid:56789)
/dev/dsk/c1t3d1
/dev/dsk/c1t3d2
VxVM Concepts
VxVM Intro
Another Volume Manager Supported on HPUX platform
Can co-exist with LVM
Allows flexible disk space management
includes vmsa gui as well as cli
Available from HP beginning with HP-UX 11i.
Available from Veritas for other releases
No rootability until 11i Release 1.5 (11.20)
Lite & Full versions
private region
dgname
dgname
dgname
dgname01
dgname02
dgname03
VMdisks
dgname
dgname
dgname
dgname01
dgname02
dgname03
host1
host1
mydg01
mydg02
mydg03
host1
VxVM Concepts-Configuration
Database
Describes all objects contained in the disk group
Replicated on multiple disks in the disk group (4 by default)
Config Database
Config Database
Config Database
Config Database
VxVM rootdg
Required for VxVM to run
Does not necessarily contain the root file
system
11i: will not include the root file system
11i 1.5: will include the root file system
future releases will have choice
rootdg cannot be moved between systems
discourage including customer data
VxVM Concepts-Volume
Similar to an LVM logical volume
Analogous to a "partition"
Can contain a file system, a swap area or raw data
Represented by device files:
/dev/dsk/dgname/volname /dev/rdsk/dgname/volname
VxVM Concepts-plex
Data Plex: A copy of the data
Non-mirrored volumes will have one data plex, mirrored volumes
will have multiple data plexes
a plex can span disks
log plex: mirrored and raid5 volumes can have a log plex
vol01
vol01-01
(plex)
vol02
vol02-01
(plex part1)
vol02-01
(plex part2)
vol03
vol03-01
(plex)
vol03-02
(plex)
vol03-03
(log plex)
VxVM Concepts-subdisk
Contiguous space on a single vmdisk
entire subdisk belongs to a single plex
usually created when volume is created
volume
vol01
plex(es)
vol01-01
subdisk(s)
mydg01-01
vol02
vol02-01
vol02-02
mydg02-01
mydg03-01
vol03-01
mydg02-02
mydg03-02
vol03
mydg01
mydg02
mydg03
mydg02-01
mydg03-01
mydg03-02
mydg01-01
mydg02-02
vol01-02 (plex)
dgname02-01 sub-disk
sub-disk
dgname01 (vmdisk)
dgname02
dgname03
cntndn
cntndn
dgname03-01
Simple volume
Spanned Volume
Mirrored Volume
One plex
One plex
Two plexes
One subdisk
Two subdisks
Two subdisks
d1 d4 d7 d10
d2 d5 d8 d11
d3 d6 d9 d12
d1 d4 d7 p4
d2 d5 p3 d10
d3 p2 d8 d11
p1 d6 d9 d12
Mixed volumes
You can combine plex layouts in a single volume
By default the striped plex will be preferred over the concatenated
pplex
You can not mirror raid5 plex layout
mixed volume
d1 d4 d7 d10
d2 d5 d8 d11
d3 d6 d9 d12
plex1
plex1
plex1
plex2
Layered Volumes-Stripe-Mirror
1
Raid 1+0
Mirror-Stripe
1
1
Mirrored subvolume 1
2
Mirrored subvolume 2
Striped-Volume
Mirrored subvolume 3
Layered Volumes-Concat-pro
1.6G
8.9 G
1.6G
sub-volume
(layout=mirror)
plex
Creating Volumes
vxassist (cli) or vmsa (gui)
you create volume
plex, sub-disks automatically created
bottom up
manually create sub-disk(s)
specify sub-disk(s) to form plex
specify plex(es) to form volume
Dynamic Multi-Pathing
/dev/vx/dsk/userdg/myvol
/dev/vx/rdsk/userdg/myvol
/dev/vx/dmp/c2t3d0
/dev/dsk/c2t3d0 /dev/rdsk/c2t3d0
/dev/vx/rdmp//c2t3d0
dev/dsk/c7t3d0
Controller(SBA) c2xxxx
/dev/rdsk/c7t3d0
Controller(SBA) c7xxxx
Multiple paths
VxVM-LVM Comparisons
LVM
Physical Volume
Physical Volume in a VG
Volume Group
Logical Volume
group of contig. extents
single mirror copy
MWC/MCR
pvra/vgra
extents
VxVM
Physical Disk
VMdisk
Disk Group
Volume
subdisk
plex
dirty region log
private region
public region
Information Sources