200 likes | 361 Views
LVM Problems. Version C.00 H4264S Module 6 Slides. Volume Group. Physical Extent. H. T. B. T. H. S. B. S. R. H. S. S. R. U. V. V. V. T. O. O. O. Physical Volume. B = boot V = var S = swap O = opt R = root T = tmp U = usr H = home. Logical Volumes.
E N D
LVM Problems Version C.00 H4264S Module 6 Slides
Volume Group Physical Extent H T B T H S B S R H S S R U V V V T O O O Physical Volume B = boot V = var S = swap O = opt R = root T = tmp U = usr H = home Logical Volumes LVM — Logical Volume Manager LVM provides: • Disk grouping • Logical partitioning • Ability to span disk drives • Bad block replacement • Disk mirroring (optional product)
LVM Disk Layout LIF Header (8 blocks) Physical Volume Reserved Area Physical Volume Reserved Area Boot Data Reserved Area Volume Group Reserved Area LIF Volume Volume Group Reserved Area User Data Area User Data Area Bad Block Relocation Pool Bad Block Relocation Pool Non-bootable Disk Bootable Disk
Physical Volume Reserved Area VGRA User Data Area Bad Block Relocation Pool Physical Volume Reserved Area (PVRA) The PVRA stores information about the LVM disk configuration (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
PVRA Volume Group Reserved Area User Data Area Bad Block Relocation Pool Volume Group Reserved Area (VGRA) The volume group reserved area (VGRA) holds data describing the volume group that contains the 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
LVM Repair Tools — Overview Primary Commands: • vgcfgrestore • vgscan • vgexport • vgimport Other Commands: • lvlnboot • ISL> hpux -lm • ISL> hpux -lq
Backing Up and Restoring LVM Configuration Information Physical Volume Reserved Area /sbin/vgcfgbackup /sbin/vgcfgrestore Volume Group Reserved Area /usr/bin/fbackup User Data Area /usr/bin/frecover Bad Block Relocation Pool
lvol2 lvol4 lvol1 lvol3 lvol5 lvol2 lvol4 lvol4 New Disk lvol1 lvol5 lvol2 LVM Recovery after Disk Replacement c2t5d0 c2t4d0 c2t3d0 c2t5d0 c2t4d0 c2t3d0 # vgchange -a n /dev/vg02 # vgcfgrestore -n /dev/vg02 /dev/rdsk/c2t4d0 # vgchange -a y /dev/vg02
Corrupted PVRA/VGRA Structures on the Boot Disk 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. • 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
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.
LIF Header (8 blocks) PVRA BDRA LIF Volume VGRA User Data Area Bad Block Relocation Pool Bootable Disk 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
Boot Data Reserved Area (BDRA) LIF Header (8 blocks) The BDRA contains the following records about 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. PVRA BDRA LIF Volume VGRA User Data Area Bad Block Relocation Pool
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. LIF Header (8 blocks) PVRA BDRA LIF Volume VGRA User Data Area Bad Block Relocation Pool Corrupt or Missing LABEL File or BDRA If the LABEL file or BDRA is corrupt or missing:
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|-r|-s|-d] lvol_name • # lvlnboot -b /dev/vg00/lvol1 • # lvlnboot -r /dev/vg00/lvol3 • # lvlnboot -s /dev/vg00/lvol2 • # lvlnboot -d /dev/vg00/lvol2
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: • # chroot_lvmdisk • # cd /ROOT • # chroot /ROOT /sbin/sh • # vgchange -a y /dev/vg00 • # lvlnboot -b /dev/vg00/lvol1 • . . . • # reboot “Recovery shell to the rescue”
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 Crash! /dev/vg00 Boot Area Boot Area lvol1 lvol2 lvol3 lvol4 mirror copies
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
Last Resort If the volume group still cannot be repaired, as a last resort, try exporting and importing the volume group: # 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