Upload
florence-melton
View
213
Download
0
Embed Size (px)
Citation preview
1
hp education serviceseducation.hp.com
LVM Problems
Version C.00H4264S Module 6 Slides
2 © 2001 Hewlett-Packard Company
H4264S C.00
LVM — Logical Volume Manager
LVM provides:• Disk grouping• Logical partitioning• Ability to span disk drives• Bad block replacement• Disk mirroring (optional product)
Logical Volumes
Physical Volume
B B S
Physical Extent
SS
S RU
R
VVVOO O
TT
T
H H
H
Volume Group
B = boot V = varS = swap O = optR = root T = tmpU = usr H = home
3 © 2001 Hewlett-Packard Company
H4264S C.00
LVM Disk Layout
User Data Area
Bad Block Relocation Pool
Volume Group Reserved Area
LIF Volume
Boot Data Reserved Area
Physical Volume Reserved Area
LIF Header (8 blocks)Physical Volume Reserved Area
Volume Group Reserved
User Data Area
Bad Block Relocation Pool
Bootable Disk Non-bootable Disk
Area
4 © 2001 Hewlett-Packard Company
H4264S C.00
Physical Volume Reserved Area (PVRA)The PVRA stores information about the LVM diskconfiguration (starting addresses and sizes):
• LVM identification field, signifying the LVM record is present and valid
• Unique physical volume ID, checked by LVM when it generates new physical volumes
• Physical volume number
• Last physical sector number
• Size of each physical extent on the LVM disk
• The locations of the other LVM data structures on the disk
• The start of the user data
Physical Volume Reserved Area
VGRA
User Data Area
Bad Block Relocation Pool
5 © 2001 Hewlett-Packard Company
H4264S C.00
Volume Group Reserved Area (VGRA)The volume group reserved area (VGRA)
holdsdata describing the volume group that
containsthe disk:
• Volume Group Descriptor Area (VGDA)– How many LVs are in the VG?– How many PVs are in the VG?– PE to LE mapping
• Volume Group Status Area (VGSA)– Tracks validity and availability of PVs– Tracks current state of each PE
PVRA
Volume GroupReserved Area
User Data Area
Bad Block Relocation Pool
6 © 2001 Hewlett-Packard Company
H4264S C.00
LVM Repair Tools — Overview
Primary Commands:• vgcfgrestore• vgscan• vgexport• vgimport
Other Commands:
• lvlnboot• ISL> hpux -lm• ISL> hpux -lq
7 © 2001 Hewlett-Packard Company
H4264S C.00
Backing Up and Restoring LVM Configuration Information
/sbin/vgcfgbackup
/sbin/vgcfgrestore
/usr/bin/fbackup
/usr/bin/frecover
Physical VolumeReserved Area
Volume GroupReserved Area
User Data Area
Bad Block Relocation Pool
8 © 2001 Hewlett-Packard Company
H4264S C.00
LVM Recovery after Disk Replacement
lvol1
lvol2
lvol2
lvol3
lvol4
lvol4
lvol5
c2t5d0 c2t3d0c2t4d0
lvol1
lvol2
NewDisk
lvol4
lvol5
c2t5d0 c2t3d0c2t4d0
# vgchange -a n /dev/vg02
# vgcfgrestore -n /dev/vg02 /dev/rdsk/c2t4d0
# vgchange -a y /dev/vg02
9 © 2001 Hewlett-Packard Company
H4264S C.00
Corrupted PVRA/VGRA Structures on the Boot Disk
• LVM maintenance mode puts the system into single-user mode.
• LVM maintenance mode is used to repair damaged LVM data structures.
ISL> hpux -lm
ISL> hpux -lm (56/52.6.0;0)/vmunix
If the PVRA or VGRA structures are corrupted, the volume group cannot be activated.
A special way to boot the system (LVM maintenance mode) can be used to bypass the normal LVM structures.
10 © 2001 Hewlett-Packard Company
H4264S C.00
LVM Maintenance Mode
LVM Maintenance Mode
• The /dev/vg00 volume group is not activated.
• The root and boot logical volumes are mounted, even though the vg00 volume group is not active.
• This mode allows the LVM header information to be restored to the boot disk:
# vgcfgrestore -n /dev/vg00 /dev/rdsk/c0t6d0
# reboot -n
CAUTION: While in LVM maintenance mode, do not bring the system into multiuser mode.
11 © 2001 Hewlett-Packard Company
H4264S C.00
The LABEL File
LABEL File
• Contains pointers to the starting points and sizes of boot relevant logical volumes.
• Resides in the LIF volume.
• Information stored within LABEL is used by the secondary loader to load the operating system.
# lifls -l /dev/rdsk/c0t6d0 User Data Area
Bad Block Relocation Pool
VGRA
LIF Volume
BDRA
PVRA
LIF Header (8 blocks)
Bootable Disk
12 © 2001 Hewlett-Packard Company
H4264S C.00
Boot Data Reserved Area (BDRA)
The BDRA contains the following recordsabout the system's root logical volumes:
• Root volume group ID• Number of disks in root volume group• A list of hardware addresses of the LVM disks in the root volume group• Information needed to select the correct logical volumes for boot, primary swap, and dump
The operating system uses the information in the BDRA to activate the root volume group and mount the root file system.
User Data Area
Bad Block Relocation Pool
VGRA
LIF Volume
BDRA
PVRA
LIF Header (8 blocks)
13 © 2001 Hewlett-Packard Company
H4264S C.00
Corrupt or Missing LABEL File or BDRA
• The system will not boot.
• To recover, the system must be booted into LVM Maintenance mode or to the recovery shell.
• A command called lvlnboot is needed to fix the problem.
If the LABEL file or BDRA is corrupt or missing:
User Data Area
Bad Block Relocation Pool
VGRA
LIF Volume
BDRA
PVRA
LIF Header (8 blocks)
14 © 2001 Hewlett-Packard Company
H4264S C.00
The lvlnboot Command
lvlnboot:
• Used to update a corrupted LABEL file or BDRA with valid data.
• The syntax of the command is:
• Examples of the command:# lvlnboot -b /dev/vg00/lvol1
# lvlnboot -r /dev/vg00/lvol3
# lvlnboot -s /dev/vg00/lvol2
# lvlnboot -d /dev/vg00/lvol2
lvlnboot [-b|-r|-s|-d] lvol_name
15 © 2001 Hewlett-Packard Company
H4264S C.00
Using the Recovery Shell to Repair Damage The recovery shell can also be used to repair a corrupted LABEL file or BDRA. The procedure is:
1. Boot from the support media.2. From the Recovery menu, select Exit to shell (recovery shell).3. From the Recovery shell, execute the following commands:
“Recovery shell to the rescue”
# chroot_lvmdisk# cd /ROOT# chroot /ROOT /sbin/sh# vgchange -a y /dev/vg00# lvlnboot -b /dev/vg00/lvol1. . .# reboot
16 © 2001 Hewlett-Packard Company
H4264S C.00
Booting without Quorum
Booting without quorum allows your system to come up when:• The root volume group does not meet quorum requirement.• The disk containing the root file system is functional.
ISL> hpux -is -lq
Boot Area
lvol1
mirrorcopies
lvol2
lvol3
lvol4
/dev/vg00 Crash!
Boot Area
17 © 2001 Hewlett-Packard Company
H4264S C.00
Recovering an lvmtab File
The /etc/lvmtab file:• Lists all volume groups and the physical volumes that
are associated with each volume group• Can be viewed using the strings command• Contents used by LVM commands• Can be recreated using the vgscan command
For example:
# mv /etc/lvmtab /etc/lvmtab.back
# vgscan -pv
# vgscan -v
# strings /etc/lvmtab
18 © 2001 Hewlett-Packard Company
H4264S C.00
Last Resort
# vgchange -a n /dev/vg02# vgexport -m /tmp/mapfile /dev/vg02
# mkdir /dev/vg02# mknod /dev/vg02/group c 64 0x020000# vgimport -v -m /tmp/mapfile /dev/vg02 \ /dev/dsk/c3t4d0 /dev/dsk/c4t5d0# vgchange -a y /dev/vg02
# strings /etc/lvmtab
# vgcfgbackup vg02
If the volume group still cannot be repaired, as a last resort, try exporting and importing the volume group: