Chapter 13 LVM HP-UX Handbook Revision 13.
Chapter 13 LVM October 29, 2013 TERMS OF USE AND LEGAL RESTRICTIONS FOR THE HP-UX RECOVERY HANDBOOK ATTENTION: PLEASE READ THESE TERMS CAREFULLY BEFORE USING THE HP-UX HANDBOOK. USING THESE MATERIALS INDICATES THAT YOU ACCEPT THESE TERMS. IF YOU DO NOT ACCEPT THESE TERMS, DO NOT USE THE HP-UX HANDBOOK. THE HP-UX HANDBOOK HAS BEEN COMPILED FROM THE NOTES OF HP ENGINEERS AND CONTAINS HP CONFIDENTIAL INFORMATION.
Chapter 13 LVM October 29, 2013 TABLE OF CONTENTS LVM Versions ________________________________________________________________ 6 Device Files __________________________________________________________________ 6 LVM Structural Information _____________________________________________________ 6 PVRA, BDRA and VGRA _____________________________________________________________ 7 LIF Header and LIF Volume __________________________________________________________ 8 PV-ID and VG-ID ___________________________
Chapter 13 LVM October 29, 2013 Removing a PV / VG / LV ___________________________________________________________ 30 Remove an LV __________________________________________________________________________30 Remove a PV from a VG __________________________________________________________________30 Remove a VG ___________________________________________________________________________30 Moving physical extents ___________________________________________________________ 31 Importing and exporting VGs ___
Chapter 13 LVM October 29, 2013 What is the new in 11.
Chapter 13 LVM October 29, 2013 LVM Versions As of the March 2010 release of HP-UX 11i Version 3, LVM supports four versions of volume groups. Version 1.0, 2.0, 2.1, and 2.2 enable the configuration of larger volume groups, logical volumes, physical volumes, and other parameters. Version # Supported --------------Version 1.0 Version 2.0 Version 2.1 Version 2.2 Supported Bootable Volume Group --------------------------------------------------------------------------HP-UX 11i yes HP-UX 11i V3 March 2008.
Chapter 13 LVM October 29, 2013 other LVM disks—and they differ in their data structures. Non-bootable disks have two reserved areas: the physical volume reserved area (PVRA) and the volume group reserved area (VGRA). Bootable disks have a PVRA and VGRA, and additional sectors reserved for the boot data reserved area (BDRA) and boot LIF.
Chapter 13 LVM October 29, 2013 Information about PVs in root VG Information about Boot/Swap/Root LVs (major/minor numbers, etc.) 3. The VGRA is identical for any PV of the VG. It contains: The VGDA describing the VG, with e.g.: o VG-ID, configured max_lv, max_pv, max_pe. o per LV information: LV flags, size, schedule strategy, number of mirrors, stripes, stripe size, etc. o per PV information: PV-ID, PV size, PV flags, Extent mapping, etc.
Chapter 13 LVM October 29, 2013 # lvmmeta -d /dev/rdisk/disk3_p2 … … 0x00002008 uint32_t id1; 0x413b03fc CPU ID = 1094386684 0x0000200c uint32_t id2; 0x4c0d30d2 Time = Mon Jun 7 11:48:02 2010 i.e. pvcreate(1m) was run on CPU with ID 1094386684 at Mon Jun 7 11:48:02 2010 … 0x00002010 uint32_t id1; 0x413b03fc CPU ID = 1094386684 0x00002014 uint32_t id2; 0x4c0d30d3 Time = Mon Jun 7 11:48:03 2010 i.e.
Chapter 13 LVM October 29, 2013 vgcfgbackup(1M) A copy of the LVM header is held within the file system in the LVM backup file (/etc/lvmconf/*.conf). Any modification of the LVM structure, e.g. through LVM commands like lvcreate, lvchange, vgextend, etc. will be automatically saved in the VGs config file through vgcfgbackup(1M). You can run vgcfgbackup(1M) manually at any time: # vgcfgbackup vgXY Volume Group configuration for /dev/vgXY has been saved in /etc/lvmconf/vgXY.
Chapter 13 LVM October 29, 2013 # strings /etc/lvmtab /dev/vg00 /dev/dsk/c2t0d0 /dev/vgsap /dev/dsk/c4t0d0 /dev/dsk/c5t0d0 /dev/dsk/c4t1d0 /dev/dsk/c5t1d0 /dev/vg01 /dev/dsk/c6t0d0 NOTE: this is only the “visible” part of the lvmtab.
Chapter 13 LVM October 29, 2013 AUTO_VG_ACTIVATE=0 If you do not trust the information in the lvmtab anymore because it may have become corrupt somehow you can easily recreate it from PVRA and VGRA on the disks through the vgscan(1M) command. But be sure to save a copy before: # cp /etc/lvmtab /etc/lvmtab.old # vgscan -v Warnings can usually be ignored. NOTE: If you leave the original file in place then vgscan uses its contents for creating a new one. This may fail depending on the file’s contents.
Chapter 13 HP-UX Handbook – Rev 13.
Chapter 13 LVM October 29, 2013 How the size of the VGRA is calculated The VGRA size of any non-bootable disk must fit into the size of a single PE. For a bootable disk the VGRA needs to start at offset 2144K while user data always starts at offset 2912K. Due to these constraints the maximum VGRA size of bootable disks is even more restricted as for regular disks. However, it is good to know how the size of the VGRA depends on the VG’s configuration at creation time.
Chapter 13 LVM October 29, 2013 situation, if the user needs to add a bootable PV to a VG, they must recreate the VG by giving lesser values for these arguments. By far the biggest factor in the size of the metadata is the values for MAXPVs and MAXPXs. Alternatively, they can convert the bootable PV to a normal PV by rerunning pvcreate(1M) on that PV without ‘-B’ option and then add it to the VG.
Chapter 13 LVM 64 1788 1.7G 80 1532 1.5G 3836 7676 15612 7.5G 30.0G 122.0 G 3068 6140 12540 6.0G 24.0G 98.0G 96 1276 1.2G 2556 5116 10492 5.0G 20.0G 82.0G 1020 1.0G 2044 4348 8956 4.0G 17.0G 70.0G 764 0.7G 1788 3836 7676 3.5G 15.0G 60.0G 764 0.7G 1532 3324 6908 3.0G 13.0G 54.0G 764 0.7G 1532 3068 6140 3.0G 12.0G 48.0G 508 0.5G 1276 2812 5628 2.5G 11.0G 44.0G 508 0.5G 1276 2556 5116 2.5G 10.0G 40.0G 508 0.5G 1020 2.0G 2300 4860 9.0G 38.0G 508 0.5G 1020 2.0G 2044 4348 8.0G 34.
Chapter 13 LVM October 29, 2013 Maximum max_pe values for boot disks The following table lists the maximum allowed max_pe (-e) values depending on max_pv (-p) and pe_size (-s) along with their resulting PV sizes in GB. Since the lv_max parameter has a lower impact on the results, the table is caculated for lv_max=255, which is default and also a the worst-case. The fields for the default settings –s 4 –p 16 are shaded. PE size (vgcreate –s pe_size) in MB 1 16 32 64 128 256 65535 65535 65535 128.
Chapter 13 96 11 2 12 8 14 4 16 0 17 6 19 2 20 8 22 4 24 0 25 5 764 0.7G 764 0.7G 508 0.5G 508 0.5G 508 0.5G 252 0.2G 252 0.2G 252 0.2G 252 0.2G 252 0.2G 252 0.2G LVM 764 1.5G 764 1.5G 508 1.0G 508 1.0G 508 1.0G 252 0.5G 252 0.5G 252 0.5G 252 0.5G 252 0.5G 252 0.5G 764 3.0G 764 3.0G 508 2.0G 508 2.0G 508 2.0G 252 1.0G 252 1.0G 252 1.0G 252 1.0G 252 1.0G 252 1.0G HP-UX Handbook – Rev 13.00 764 6.0G 764 6.0G 508 4.0G 508 4.0G 508 4.0G 252 2.0G 252 2.0G 252 2.0G 252 2.0G 252 2.0G 252 2.0G 764 11.
Chapter 13 LVM October 29, 2013 Calculating an optimal extent size for a version 2.x volume group. Like Version 1.0 Volume Groups, there is a relationship between extent size and maximum volume group size. There is also a limitation on the number of extents an individual volume group can contain. To determine the proper size, the vgcreate command has a new –E option.
Chapter 13 LVM October 29, 2013 Display Commands To display information about VGs, LVs or PVs there is a set of commands available. Each of the commands provides an option -v to display detailed (verbos) output. Information on 1.
Chapter 13 LVM October 29, 2013 --- Physical volumes --PV Name /dev/dsk/c10t6d0 PV Status available Total PE 508 Free PE 0 Autoswitch On Information on 2.x VGs # vgdisplay -v /dev/vg_lvm2 --- Volume groups --VG Name /dev/vg_lvm2 VG Write Access read/write VG Status available Max LV 511 Cur LV 0 Open LV 0 Max PV 511 Cur PV 1 Act PV 1 Max PE per PV 2097152 VGDA 2 PE Size (Mbytes) 4 Total PE 10229 Alloc PE 0 Free PE 10229 Total PVG 0 Total Spare PVs 0 Total Spare PVs in use 0 VG Version 2.
Chapter 13 LVM October 29, 2013 --- Physical volumes --PV Name /dev/disk/disk111 PV Status available Total PE 10229 Free PE 10229 Autoswitch On Proactive Polling On vgdisplay is useful to check wether the LVM configuration in memory is clean or not. First of all there should be no error messages. The status should be available or available/exclusive for Serviceguard VGs. Cur PV should equal Act PV and Cur LV should be equal to Open LV. Information on 1.
Chapter 13 LVM October 29, 2013 0000 current /dev/vg00/lvol1 0000 0001 current /dev/vg00/lvol1 0001 0002 current /dev/vg00/lvol1 0002 . . 1021 free 0000 1022 free 0000 Stale PE should be 0. Information on 2.
Chapter 13 00000000 current 00000001 free 00000002 free LVM /dev/vg_lvm2/lvol1 October 29, 2013 00000000 00000000 00000000 Information on 1.0 LVs The lvdisplay command prints logical volume information, including mapping and status of logical extents.
Chapter 13 LVM October 29, 2013 Information on 2.
Chapter 13 LVM October 29, 2013 NOTE: For bootable disks you have to use the -B option additionally. This preserves the fixed 2912KB space for the LVM header (see section LVM structural information). You can find the procedure how to make a disk bootable in the section Mirroring the root disk later in this chapter.
Chapter 13 LVM October 29, 2013 The c following the device file name specifies that group is a character device file. major is the major number for the group device file. For a Version 1.0 volume group, it is 64. For a Version 2.x volume group, it is 128. minor is the minor number for the group file in hexadecimal. For a Version 1.0 volume group, minor has the form 0xnn0000, where nn is a unique number across all Version 1.0 volume groups. For a Version 2.
Chapter 13 LVM October 29, 2013 # lvcreate -n lvdata vg01 Now extend the LV onto a certain disk: # lvextend -L 500 /dev/vg01/lvdata /dev/dsk/c4t2d0 Now you can use newfs to put a FS onto the LV: # newfs -F /dev/vg01/rlvdata where fstype is either hfs or vxfs. NOTE: Nowadays it is recommended to use a VxFS (=JFS) file system. Modifying a PV / VG / LV Modifying a PV There are certain PV parameters that can be changed (see pvchange man page).
Chapter 13 NOTE: LVM October 29, 2013 You may get the following error: lvextend: Not enough free physical extents available. Logical volume "/dev/vg01/lvdata" could not be extended. Failure possibly caused by contiguous allocation policy. Failure possibly caused by strict allocation policy The reason for that is exactly one of the above.
Chapter 13 LVM October 29, 2013 Modifying a VG The vgchange command can be used to (de)activate a VG. Certain parameters like max_pe (see above) cannot be changed without recreating the VG. In order to rename a VG you have to export and re-import it: # umount /dev/vg01/lvol1 # umount /dev/vg01/lvol2 ... # vgchange -a n vg01 # vgexport -m /tmp/mapfile vg01 # ll /dev/*/group (choose a unique minor no.
Chapter 13 LVM October 29, 2013 # umount /dev/vg01/lvol1 # umount /dev/vg01/lvol2 ... # vgchange -a n vg01 # vgexport vg01 NOTE: vgremove is not recommended because you need to remove all LVs and PVs from the VG before you could use vgremove. This is not necessary with vgexport. Additionally vgexport leaves the LVM structures on the disks untouched which could be an advantage if you like to re-import the VG later. Moving physical extents It is only possible to move PEs within a VG.
Chapter 13 LVM October 29, 2013 Importing and exporting VGs The functionality of exporting VGs allows you to remove all data concerning a dedicated VG from the system without touching the data on the disks. The disks of an exported VG can be physically moved to another system and the VG can be imported there. Exporting a VG means the following: remove the VG and corresponding PV entries from /etc/lvmtab and remove the VG directory with their device files in /dev.
Chapter 13 LVM October 29, 2013 # vgexport -v -s -m /tmp/vgXX.map vgXX If you specify -s in conjunction with the -m option vgexport simply adds the VG-ID to the mapfile: # cat /tmp/vgXX.map VGID bfb13ce63a7c07c4 1 lvol1 2 lvol2 3 lvsap 4 lvdata When using the -s option with the vgimport command on system B all disks that are connected to the system are scanned one after another.
Chapter 13 # lvdisplay -v /dev/vg01/lvol1 | more ... ... --- Logical extents --LE PV1 PE1 Status 1 LE 0000 /dev/dsk/c0t6d0 0000 current 0001 /dev/dsk/c0t6d0 0001 current ...
Chapter 13 LVM October 29, 2013 Here’s an example configuration: vg01 c0 host pvg_a c0t1d0 c0t2d0 pvg_b c1 c1t4d0 c1t5d0 If you want to be sure that the mirrors of LVs on e.g. c0t1d0 are not placed on c0t2d0 you need a lvmpvg file like the following: # cat /etc/lvmpvg VG /dev/vg01 PVG pvg_a /dev/dsk/c0t1d0 /dev/dsk/c0t2d0 PVG pvg_b /dev/dsk/c1t4d0 /dev/dsk/c1t5d0 As soon as this file is saved the configuration is active and vgdisplay will look like this: # vgdisplay -v vg01 ... ...
Chapter 13 LVM October 29, 2013 Root Mirror (PA-RISC Systems) To set up a mirrored root config you need to add an additional disk (e.g. c1t6d0) to the root VG mirror all the LVs and make it bootable. 1. Initialize the disk and add it to vg00: # pvcreate [-f] -B /dev/rdsk/c1t6d0 # vgextend vg00 /dev/dsk/c1t6d0 2. Mirror the LVs using lvextend: # lvextend –m 1 /dev/vg00/lvolX /dev/dsk/c1t6d0 If you want to use a shell loop to extend automatically, use e.g.: # for lvol in lvol1 lvol2 ...
Chapter 13 LVM October 29, 2013 # lvreduce -m 0 /dev/vg00/lvolX /dev/dsk/c1t6d0 Of course, this can also be done automatically using a shell loop, e.g.: # > > > for lvol in lvol8 lvol7 ... lvol1(specify all LVs you need do lvreduce -m 0 /dev/vg00/$lvol /dev/dsk/c1t6d0 done to reduce) Root Mirror (Itanium based Systems) The following procedure shows how to mirror the root disk. Let c3t2d0 be the existing primary disk and c2t1d0 the new mirror boot disk: 1. Setup the disk partitions A.
Chapter 13 LVM October 29, 2013 total space 103215616 bytes, free space 100076032 bytes # lifls -l /dev/rdsk/c2t1d0s2 (to check LIF) 4. Write the contents of the AUTO file to the EFI partition: # mkboot -a "boot vmunix" /dev/dsk/c2t1d0 # efi_cp -d /dev/rdsk/c2t1d0s1 -u /EFI/HPUX/AUTO /tmp/x; # cat /tmp/x (to check it) NOTE: Specify -a "boot vmunix -lq" if you want the system to boot up without interruption in case of a disk failure. 5.
Chapter 13 LVM Boot: lvol1 on: Root: lvol3 on: Swap: lvol2 on: Dump: lvol2 on: October 29, 2013 /dev/dsk/c3t2d0s2 /dev/dsk/c2t1d0s2 /dev/dsk/c3t2d0s2 /dev/dsk/c2t1d0s2 /dev/dsk/c3t2d0s2 /dev/dsk/c2t1d0s2 /dev/dsk/c3t2d0s2, 0 6. Specify the mirrored disk as an alternate bootpath # setboot -a # setboot (to check it) 7. Create an EFI boot option.
Chapter 13 LVM October 29, 2013 | EFI Boot Maintenance Manager ver 1.10 [14.61] | | Add a Boot Option.
Chapter 13 LVM October 29, 2013 | 05/28/03 09:38a
512 .. | >>> 05/28/03 11:52a 419,545 HPUX.EFI | 05/28/03 11:52a 24,576 NBP.EFI | Exit | | | Filename: \EFI\HPUX\HPUX.EFI | | DevicePath:[Acpi(HWP0002,100)/Pci(1|0)/Scsi(Pun1,Lun0)/ | HD(Part1,SigB45A0000)/\EFI\HPUX\HPUX.EFI] | IA-64 EFI Application 05/28/03 11:52a 419,545 bytes | | BootFFFF: Acpi(HWP0002,100)/Pci(1|0)/Scsi(Pun1,Lun0)/ | HD(Part1,SigB45A0000)/\EFI\HPUX\HPUX.Chapter 13 LVM October 29, 2013 NOTE: It is the order in /etc/lvmtab that defines the default order in which the links are used. Configuring PV Links The following example shows how to create a VG with a disk having an alternate link. First check the available disk devices using ioscan: # ioscan -fnkCdisk | more Class I H/W Path Driver S/W State H/W Type Description ================================================================ ======= disk 0 0/0/2/0.6.
Chapter 13 LVM October 29, 2013 # vgdisplay -v vg01 ... ...
Chapter 13 LVM October 29, 2013 Autoswitch: With autoswitch flag on (default) LVM always switches back to the primary link if it becomes available again. Otherwise the same link is used until the next failure.
Chapter 13 LVM October 29, 2013 ***** LVM-VG: 0557706517-0986205681 1 grcdg319:c4t1d0 0630309352-0968061502 0/12/0/0.1.0 HP/C5447A (0x02/vgsap) grcdg319:c5t1d0 0630309352-0968061502 0/12/0/1.1.0 HP/C5447A (0x02/vgsap) hprtdd32:c4t1d0 0630309352-0968061502 0/6/0/0.1.0 HP/C5447A (0x02/vgsap) hprtdd32:c5t1d0 0630309352-0968061502 0/6/0/1.1.0 HP/C5447A (0x02/vgsap) 2 grcdg319:c4t0d0 0630309352-0968061503 0/12/0/0.0.0 HP/C5447A (0x02/vgsap) grcdg319:c5t0d0 0630309352-0968061503 0/12/0/1.0.
Chapter 13 LVM October 29, 2013 more appropriate when working with disk arrays with large cache sizes, such as the HP Storageworks XP and EMC models. This is because there is a large difference between the typical "stripe depth" used with Block striping (often 64Kb or less - though the size can be as large as 32 MB if desired) and Extent-based striping (from 1 MB to 256 MB); where intensive sequential I/O takes place, the cache-management algorithms are likely to work better with the larger stripe depth.
Chapter 13 LVM October 29, 2013 # mknod /dev/vgDist/group c 64 0x030000 NOTE: Ensure that the 0x0#0000 minor number is unique for each VG on your system. # vgcreate -s 1 /dev/vgDist /dev/dsk/c0t0d0 /dev/dsk/c0t1d0 \ /dev/dsk/c1t2d0 /dev/dsk/c1t3d0 NOTE: The -s 1 in the above command specifies a PE size of 1 Mbyte. This is the smallest stripe or extent size available. The default would be 4MB. This is only an example, and the default or larger is appropriate in most cases.
Chapter 13 -D y -s g -m 1 -L 1000 -n lvdist1 LVM October 29, 2013 specifies distributed allocation policy specifies PVG-strict allocation policy specifies 1 mirror copy specifies size in MBytes = 1000 names logical volume dist1 # lvdisplay -v /dev/vgDist/lvdist1 --- Logical volumes --LV Name /dev/vgDist/lvdist1 VG Name /dev/vgDist LV Permission read/write LV Status available/syncd Mirror copies 1 Consistency Recovery MWC Schedule parallel LV Size (Mbytes) 1000 Current LE 1000 Allocated PE 2000 Stripes 0
Chapter 13 0998 /dev/dsk/c0t0d0 0999 /dev/dsk/c0t1d0 LVM 0499 current /dev/dsk/c1t2d0 0499 current /dev/dsk/c1t3d0 October 29, 2013 0499 current 0499 current Notice how PV1 alternates physical extents between the disk devices in PVG1 and PV2 alternates between the disk devices in PVG2. This is extent based striping. Comments on Physical Volume Groups (PVGs) Before the "-D" option of the lvcreate command was introduced, PVGs were generally only set up for VGs with which Mirrordisk/UX was being used.
Chapter 13 LVM October 29, 2013 secondary one, to the same single underlying PV - this means that a PV is effectively included twice within the same VG, even though there is only one copy of the data visible to LVM (the disk array "hides" any additional copy or data protection). However, when LVs are set up using the "-D" option of lvcreate, it is compulsory for them to be configured as "Group strict", in case Mirrordisk will be used as well.
Chapter 13 - LVM October 29, 2013 Check the /etc/lvmpvg file carefully whenever any PVs are added to, or removed from, VGs. Amend manually if necessary. Two other areas are worthy of discussion. These are the export/import of VGs, and the question of JFS "hot spots". When a VG is exported and imported, it is best to avoid the "-s" option if alternate links are being used.
Chapter 13 LVM October 29, 2013 OnlineDiag.EMS-KRMonitor A.11.11.05 EMS Kernel Resource Monitor OnlineDiag.EMS-Core A.04.00.02 EMS Core Product OnlineDiag.EMS-Config A.04.00.02 EMS Config OnlineDiag.Contrib-Tools B.11.11.15.13 Contributed Tools OnlineDiag.LIF-LOAD B.11.11.15.13 HP LIF LOAD Tools The ODE LIF files can be found in the regular files below /usr/sbin/diag/lif/ directory, e.g.
Chapter 13 LVM October 29, 2013 NOTE: “lifload –f updatediaglif” performs “mkboot -b updatediaglif -p ISL -p HPUX /dev/rdsk/cXtXdX”, where cXtXdX are all the disks listed in /stand/bootconf. The –p option of mkboot preserves the specified file so that it is not overwritten in LIF. If you are setting up a mirrored root config you need have the mirror disk listed in /stand/bootconf or use mkboot directly to install the ODE files there.
Chapter 13 LVM October 29, 2013 2. Generate a map file: # vgexport -p -s -m /tmp/vgXX.map vgXX 3. Use ftp or rcp to distribute the mapfile (/tmp/vgXX.map) to the other nodes. On all other nodes where the VG is not activated: 1. Remember the VG minor number: # ll /dev/vgXX/group 2. If the VG does already exist, export it first and then import it: # vgexport vgXX # mknod /dev/vgXX/group c 64 0xXX0000 # vgimport -s -m /tmp/vgXX.
Chapter 13 LVM October 29, 2013 NOTE: The replacement disk must be the same product ID as the replaced one. HP often uses different manufacturers for disks having the same product number. The hotswap procedures will not update the disk driver's internal information to that of the replaced disk. The replacement disk will have the same capacity and blocksize as the defective disk because they have the same product number. The only field that could be incorrect is the string specifying the vendor's name.
Chapter 13 LVM October 29, 2013 Last, but not least, you must be sure about what disk is the defective one! Starting any replacement procedure based on wrong assumptions can cause loss and corruption of data. Disk Replacement Flow Chart The following flow chart is supposed to provide an overview about possible LVM disk replacement scenarios. HP-UX Handbook – Rev 13.
Chapter 13 LVM October 29, 2013 Gather all required information e.g.
Chapter 13 LVM October 29, 2013 Attached vs. Unattached A physical volume is considered to be attached, if the pvdisplay command is able to report a valid status (unavailable/available) for it. Otherwise it’s called unattached. It is not allowed to replace an attached disk without having the mirrors reduced before. The reason is that there are potentially serious problems with replacing an attached device.
Chapter 13 LVM October 29, 2013 Hot-Swap Procedure Follow these steps to replace a mirrored hot-swap disk module 1. Unattached the PV If the PV is still attached and the OLR feature explained above is available then use pvchange to unattach it: # pvchange –a N /dev/dsk/c#t#d# Detach all paths to the PV 2. (Optional) Only if PV cannot be unattached reduce the mirrors Reduce any LVs that have mirror copies on the faulty disk so that they no longer mirror onto that disk.
Chapter 13 LVM October 29, 2013 4. (Optional) For fibre channel disks perform the replace_dsk steps as described in the section “How to Replace Disks at Hosts with TachLite HBAs” in the Fibre Channel chapter. 5. Restore the LVM configuration onto the new disk # vgcfgrestore -n vg## /dev/rdsk/c#t#d# NOTE: Since we did lvreduce -A n in step 2 the lvmconf file we are about to restore is outdated. Fortunately, LVM is smart enough to detect this using timestamps. The restored config is "older"...
Chapter 13 LVM October 29, 2013 9. (Optional) Recreate the mirrors If you reduced the mirrors in step 2 then recreate them. # lvextend -m 1 /dev/vg##/lvol# /dev/dsk/c#t#d# & # lvextend -m 2 /dev/vg##/lvol# /dev/dsk/c#t#d# & for 1 way mirroring, or for 2 way mirroring A shell loop like this could be used to extend a bunch of lvols automatically: # for i in lvol1 lvol2 lvol3 ...
Chapter 13 LVM October 29, 2013 If you cannot use vgcfgrestore to write the original LVM header back to the new disk because a valid LVM configuration backup file (/etc/lvmconf/vgXX.conf[.old]) is missing or corrupted you have to remove that PV from the VG (vgreduce) to get a clean configuration. NOTE: In such situations the vgcfgrestore command may fail to restore the LVM header, complaining about a ‘Mismatch between the backup file and the running kernel’.
Chapter 13 LVM October 29, 2013 Running vgreduce with the -f option would remove all PVs that are “free”, i.e there is no LV having extents on that PV. Otherwise - if the PV is not free - vgreduce -f reports an extent map to identify the associated LVs: # vgreduce -f vg01 skip alternate link /dev/dsk/c1t2d2 vgreduce: Couldn't query physical volume "/dev/dsk/c0t11d0": The specified path does not correspond to physical volume attached to this volume group Not all extents are free. i.e.
Chapter 13 LVM October 29, 2013 Stripes 0 Stripe Size (Kbytes) 0 Bad block on Allocation strict IO Timeout (Seconds) default --- Distribution of logical volume --PV Name LE on PV PE on PV /dev/dsk/c0t0d2 8 8 --- Logical extents --LE PV1 PE1 Status 1 00000 ??? 00000 stale 00001 ??? 00001 stale 00002 ??? 00002 stale 00003 ??? 00003 stale 00004 ??? 00004 stale 00005 ??? 00005 stale 00006 ??? 00006 stale 00007 ??? 00007 stale PV2 PE2 Status 2 /dev/dsk/c0t0d2 00000 current /dev/dsk/c0t0d2 00001 current /dev/
Chapter 13 LVM October 29, 2013 1. Obtain the PV key using the -k option of lvdisplay: # lvdisplay –v –k /dev/vg01/lvol1 ... ...
Chapter 13 LVM October 29, 2013 4. Perform the above steps indicated above in order to remove the PV from the lvmtab: # mv /etc/lvmtab /etc/lvmtab.org # vgscan –v ... ... Scan of Physical Volumes Complete. *** LVMTAB has been created successfully. *** If PV links are configured in the system. *** Do the following to resync information on disk. *** #1. vgchange -a y *** #2. lvlnboot -R 5. Check the results: # strings /etc/lvmtab /dev/vg01 /dev/dsk/c0t0d2 /dev/dsk/c1t2d2 6.
Chapter 13 LVM October 29, 2013 Increasing the Root LV's size Usually you cannot easily add space to the root LVs (/ or /stand) because they need to be contiguous. The following procedures work around this. Using Ignite/UX The recommended and only supported procedure to add space to the root LVs is to use Ignite/UX, e.g. a make_tape_recovery Medium (refer to the Ignite-UX chapter for details).
Chapter 13 LVM October 29, 2013 Main Menu: Enter command or menu > 3. If you know the path to your tape device, enter the following: boot 0/0/1/0.1 4. If you don’t know the path to your tape device, you have to search for all bootable paths (with the SEA command). Searching for potential boot devices. To discontinue search, press any key (termination may not be immediate). Path# Device Path (dec) Device Path (mnem) Device Type ----- ----------------- ------------------ ----------P0 0/0/0/0 lan.15.140.10.
Chapter 13 LVM October 29, 2013 Use the or to pop-up a choices list. If the menus are not clear, select the "Help" item for more information. Hardware Summary: System Model: 9000/800/L1000-36 +---------------------+----------------+-------------------+ [ Scan Again ] | Disks: 17 (271.
Chapter 13 LVM October 29, 2013 || | [ Root Swap (MB)... ] 512 Physical Memory (RAM) = 256 MB | || | [ Languages... ] English [ Keyboards... ] [ Additional... ]| || \---------------------------------------------------------------------------/ [ Show Summary... ] [ Reset Configuration ] -----------------------------------------------------------------------------[ Go! ] [ Cancel ] [ Help ] 10.
Chapter 13 LVM October 29, 2013 2. Create LVs for boot, swap and root (in that order). Use at least the same size as in your original root VG: # lvcreate -C y -r n vgroot # lvextend -L 100 /dev/vgroot/lvol1 (e.g. 100 MB for /stand) # lvcreate -C y -r n vgroot # lvextend -L 512 /dev/vgroot/lvol2 (e.g. 512 MB pri. swap) # lvcreate -C y -r n vgroot # lvextend -L 200 /dev/vgroot/lvol3 (e.g. 200 MB for /) 3. Configure LIF and BDRA on c1t1d0 (see the LIF/BDRA Configuration Procedure). 4.
Chapter 13 LVM October 29, 2013 8. Modify the fstab in /new_root/etc. Replace occurences of vg00 with vgroot: # vi /new_root/etc/fstab /dev/vgroot/lvol1 /stand hfs defaults 0 0 /dev/vgroot/lvol3 / vxfs delaylog 0 0 /dev/vgroot/lvol4 /usr vxfs delaylog 0 0 (new boot LV) (new root LV) (new /usr LV) 9. Change the device files for the root disk in /new_stand/bootconf to c1t1d0: # vi /new_stand/bootconf l /dev/dsk/c1t1d0 10.
Chapter 13 LVM October 29, 2013 3. Activate vg00 and mount the files ystems: # vgchange -a y vg00 # mount /dev/vg00/lvol3 / # mount /dev/vg00/lvol1 /stand # mount /dev/vg00/lvol4 /usr ... 4. Modify the fstab. Replace vgroot with vg00 again: # vi /etc/fstab 5. Reboot: # shutdown -r 0 LIF/BDRA Configuration Procedure This subprocedure installs/updates information on disk that is mandatory for boot support. Therefore it is referenced from several other parts of this chapter. 1.
Chapter 13 LVM October 29, 2013 NOTE: “lifload –f updatediaglif” performs “mkboot -b updatediaglif -p ISL -p HPUX /dev/rdsk/cXtXdX”, where cXtXdX are all the disks listed in /stand/bootconf. The –p option of mkboot preserves the specified file so that it is not overwritten in LIF. Refer to section Offline Diagnostics (ODE) if you have problems with this. 4. Write content of LABEL file, i.e set root, boot, swap and dump device: NOTE:This step can be omitted if you replace a failed mirror disk.
Chapter 13 LVM October 29, 2013 /dev/disk/disk4 /dev/vg02 /dev/dsk/c3t2d0s1 Note: If You have mixed mode activated (if legacy naming model is not deactivated), then you are able to create volume gropus, or physical volumes, or logical volumes using both naming models. For operating with physical volumes, both types of DSFs can be used.
Chapter 13 LVM October 29, 2013 vgscan –B – Recover /etc/lvmtab file using both persistent and legacy DSFs. This option can be used to migrate a volume group configured with legacy DSFs to use corresponding persistent DSFs. Example: #strings /etc/lvmtab /dev/vg00 /dev/disk/disk6_p2 /dev/disk/disk5 /dev/disk/disk4 /dev/dsk/c2t0d0 /dev/dsk/c2t1d0 /dev/dsk/c3t2d0s2 # strings /etc/lvmtab.old /dev/vg00 /dev/disk/disk6_p2 /dev/disk/disk5 /dev/disk/disk4 Note: The example above shows lvmtab and lvmtab.
Chapter 13 LVM October 29, 2013 Path switch options of the pvchange (-s and –S options) command do not switch links or stop I/O operations as they did in earlier releases. In order to disable I/O operations on a given path, use the scsimgr command (scsimgr [-f] disable Lunpath). While LVM alternate link functionality supports up to 8 paths to a physical volume, mass storage stack’s native multipathing feature can support up to 32 lunpaths.
Chapter 13 LVM October 29, 2013 The scsimgr get_attr command should show the current setting of leg_mpath_enable attribute value set to false, for all assosiated persistent DSFs in the volume group.: scsimgr get_attr -D /dev/rdisk/disk5 -a leg_mpath_enable SCSI ATTRIBUTES FOR LUN : /dev/rdisk/disk5 name = leg_mpath_enable current = false default = false saved = LVM Migration It is recommended that in HP-UX 11i v3 persistent DSFs are used over legacy DSFs.
Chapter 13 LVM October 29, 2013 /etc/lvmtab file unless the –f option is used. The –f option restricts the operation to the specified volume group (overwrite existing volume group entries in /etc/lvmtab). If the /etc/lvmtab is moved to a new location before running the vgscan –B comand, full effect of the command is taken on all configured volume groups and /etc/lvmtab file gets recreated. Following the invocation of vgscan –B command, use vgchange to reactivate the corresponding volume group.
Chapter 13 LVM October 29, 2013 For reference, make a note of the volume group configuration. Save the outputs from LVM commands: vgdisplay, lvdisplay, pvdisplay in verbose mode. Ensure all physical volumes configured in the volume group are online using ioscan –P health. Run /usr/contrib.bin.vgdsf –c to migrate each volume group. Ensure that no failures are reported. Verify the resaulting volume group configuration using LVM display commands. Use ioscan –m dsf to validate DSF mappings.
Chapter 13 LVM October 29, 2013 vgdisplay Among the most common error messages is the following: vgdisplay "Could not query physical volume" Causes for this error message could be different. Here are some of them, as well as suggested workarounds: 1. PROBLEM - vgdisplay error: can't query physical volume RESOLUTION vgdisplay error: can't query physical volume The error message will include the device in question. Use the information with the output of the ioscan command.
Chapter 13 LVM October 29, 2013 By default the volume group will need to be de-activated. (see man page vgcfgrestore 1(m) for additional options) vgchange /dev/vg## -a n vgcfgrestore -n /dev/vg00 /dev/rdsk/c#t#d# strings /etc/lvmtab If /etc/lvmtab does not reflect the change, use the vgscan command. This allows the re-creation of the /etc/lvmtab and possibly the associated volume group device files. -p Preview the actions that would be taken but do not update file /etc/lvmtab.
Chapter 13 LVM October 29, 2013 that is loaded into memory when the volume group gets activated. Follow these steps: 1.1. Restore the LVM config/headers onto the replaced disk with vgfgrestore. 1.2. Reactivate the volume group. 1.3. Notify the volume group about the the replaced drive by running vgchange: vgchange -a y /dev/vg00 Note: This step will cause LVM to become aware that the disk is available again, and will do a resync. 1.4.
Chapter 13 LVM October 29, 2013 4. PROBLEM – Hardware issue Please also bear in mind, that this error, could be due to a hardware problem as well. It is recommended, that hardware on the system is also checked, to exclude hardware failures, before further troubleshooting is performed. Hardware problems on a disk, can be checked with the dd command (for exact options, check the dd manpage). Please note, that the dd command, alhough completed with success, is not a guarantee for no hardware issues.
Chapter 13 LVM October 29, 2013 vgcfgrestore(1m) can be used to restore the VGRA. Example: vgcfgrestore -n /dev/vg01 /dev/rdsk/c1t5d2 3. The disk device's alternate path was added to another volume group. The method used to verify alternate paths will be unique to the type of disk device being used. The operating system will usually not allow an alternate path to be added to a different volume group than the primary path unless pvcreate -f is first run.
Chapter 13 LVM October 29, 2013 will have to removed. In order for vgreduce -f to succeed all logical volumes with extents on the physical volume to be reduced must first be removed. Once the volume group is in the correct state, Cur PV = Act PV, the logical volumes can be recreated and any lost data restored. Use: lvremove /dev/vg_name/lvol_name 4. Forcibly reduce out the physical volume. Use: vgreduce -f /dev/vg_name NOTE: The above command does not require a physical volume argument.
Chapter 13 LVM October 29, 2013 that couldn't be queried. ** Steps to boot into maintenance mode and active. : 1. shutdown -hy now 2. interrupt boot sequence 3. boot from primary boot path and interact with ISL NOTE: Procedure used for steps 2 and 3 may very slightly depending on machine model. 4. enter the following at the IPL> prompt: IPL> hpux -lm (;0)/stand/vmunix or IPL> hpux -lm 6. Retry the vgreduce -f command specified in step 4.
Chapter 13 LVM October 29, 2013 # vgscan -v Creating "/etc/lvmtab". vgscan: Couldn't access the list of physical volumes for volume group "/dev/vg00". vgscan: Couldn't access the list of physical volumes for volume group "/dev/vg01". vgscan: Couldn't access the list of physical volumes for volume group "/dev/vg02".
Chapter 13 LVM October 29, 2013 # ll /dev/dsk/c15* /dev/dsk/c15* not found RESOLUTION The reason for that is that the instance numbers have changed. They have changed because the system was booted from the boot disk of another system which was supposed to be identical in HW (this is a common "HA" solution bypassing the need of professional cluster software like MC/ServiceGuard, usually used with boot disk on fibre channel devices). As a result the devicefiles for the disks changed.
Chapter 13 LVM October 29, 2013 The vgimport of a volume group fails. vgscan -p -v -a gives the following error: The following Physical Volumes belong to one Volume Group. Unable to match these Physical Volumes to a Volume Group. Use the vgimport command to complete the process. RESOLUTION 1.
Chapter 13 LVM October 29, 2013 next field: "915654113" is the pvid, not important at this time. next field: "418374281" is the cpu id again Now the last field is the one we want to pay attention to: "909512229" This is the vgid field and represents the unique volume group identifier. This will need to be done for each disk that is not matched to a volume group. Once you have matched the vgid's of the disks then use the vgimport command to import the disks into a volume group. for example..
Chapter 13 LVM October 29, 2013 vg) Once the volume group has been imported, the next step is to determine the previous name of the volume group by mounting the filesystems, and viewing their contents. Once the actual name of the volume group has been determined, it can be renamed back to it's original name. To rename the volume group do the following: # cd /dev # mv vgtest # mv /etc/lvmtab /etc/lvmtab.
Chapter 13 LVM October 29, 2013 # vgcfgbackup /dev/vgxx vgremove 1.PROBLEM – VGREMOVE: COULDN’T REMOVE VOLUME GROUP /dev/vgXX When vgremove is used on a volume group that conatins an alternate link without first doing a vgreduce, the volume group is left in an unusable state. The vgremove gives an error: vgremove: Couldn't remove the entry "/dev/vg*" from "/etc/lvmtab".
Chapter 13 LVM October 29, 2013 Recreate the lvmtab with the vgscan command. The vgscan command allows the re-creation of the /etc/lvmtab file and possibly the associated volume group device files. mv /etc/lvmtab /etc/lvmtab.old /usr/sbin/vgscan -p -v -p Preview the actions that would be taken but do not update file /etc/lvmtab.
Chapter 13 LVM October 29, 2013 NIKE/LVM limitation issue. It's important to quiesce the logical volume's I/O before re-constructing the /etc/lvmtab. If for some reason, there is a need to re-construct /etc/lvmtab when the system is running production application, vgscan will create a partial /etc/lvmtab. In this case, most of the primary paths should be included in the /etc/lvmtab. Use vgextend to include any missing alternate paths in the VG.
Chapter 13 LVM October 29, 2013 If that fails, one can try to reimport using map file from any other node where activation works. On one of those nodes, one can get a good copy of such map file for that VG using: # vgexport -pvs -m mapfile /dev/vgname Then one must rcp or ftp that mapfile to the node that is having the problem. There one can try to re-import that VG to see if problem is resolved: # cp /etc/lvmtab.
Chapter 13 LVM October 29, 2013 When trying to extend a logical volume through SAM, a lvextend error is reported: lvextend: Error detected when reading from file "/etc/lvmpvg". The system does not have an /etc/lvmpvg file. Is it necessary to have this file? RESOLUTION Not every system needs to have an /etc/lvmpvg file. It is only necessary if you want to have PVG's, or physical volume groups. They basically define subgroups of physical volumes within a volume group.
Chapter 13 LVM October 29, 2013 round-robin order on the list of available physical volumes. The distributed allocation policy REQUIRES the PVG-strict allocation policy (-s g) to ensure that mirrors of distributed extents do not overlap (for maximum availability). lvcreate(1M) will obtain the list of available physical volumes from /etc/lvmpvg. When a logical volume with distributed extents is mirrored, the resulting layout is commonly referred to as EXTENT-BASED MIRRORED STRIPES.
Chapter 13 LVM October 29, 2013 c0t4d0, the /etc/lvmpvg file would need to be edited so it looked like this: # more /etc/lvmpvg VG /dev/vg01 PVG PVG0 /dev/dsk/c1t5d0 /dev/dsk/c1t6d0 /dev/dsk/c1t3d0 /dev/dsk/c1t4d0 PVG PVG1 /dev/dsk/c0t3d0 /dev/dsk/c0t6d0 /dev/dsk/c0t5d0 /dev/dsk/c0t4d0 Now to increase the lvol, you may use the lvextend command as normal. Note that you may substitute the names of the two PVGs for the name(s) of the physical volumes when directing the added physical extents.
Chapter 13 LVM October 29, 2013 Mirror copies 0 Consistency Recovery MWC Schedule parallel LV Size (Mbytes) 1600 Current LE 400 3. PROBLEM lvextend: "LogicalExtentsNumber" is bigger than the maximum value allowed While trying to make a file system larger using the command: lvextend -L 300000 /dev/vgxx/lvol1 it fails with the error: lvextend: "LogicalExtentsNumber" is bigger than the maximum value allowed.
Chapter 13 LVM October 29, 2013 Example: # vgcreate -s 8 /dev/vgxx /dev/dsk/c1t0d0 Note: The file system data will be lost when recreating the volume group. Backup and restore any data you already have on the volume group's file systems. 4.
Chapter 13 LVM October 29, 2013 Consistency Recovery MWC Schedule parallel LV Size (Mbytes) 40 Current LE 10 Allocated PE 20 Stripes 0 Stripe Size (Kbytes) 0 Bad block on Allocation non-strict IO Timeout (Seconds) default --- Distribution of logical volume --PV Name LE on PV PE on PV /dev/dsk/c0t9d0 10 10 /dev/dsk/c0t11d0 10 10 --- Logical extents --LE PV1 PE1 00000 /dev/dsk/c0t9d0 00001 /dev/dsk/c0t9d0 00002 /dev/dsk/c0t9d0 00003 /dev/dsk/c0t9d0 00004 /dev/dsk/c0t9d0 00005 /dev/dsk/c0t9d0 00006 /dev/dsk
Chapter 13 LVM October 29, 2013 Stripe Size (Kbytes) 0 Bad block on Allocation non-strict IO Timeout (Seconds) default --- Distribution of logical volume --PV Name LE on PV PE on PV /dev/dsk/c0t9d0 15 20 /dev/dsk/c0t11d0 10 10 --- Logical extents --LE PV1 PE1 00000 /dev/dsk/c0t9d0 00001 /dev/dsk/c0t9d0 00002 /dev/dsk/c0t9d0 00003 /dev/dsk/c0t9d0 00004 /dev/dsk/c0t9d0 00005 /dev/dsk/c0t9d0 00006 /dev/dsk/c0t9d0 00007 /dev/dsk/c0t9d0 00008 /dev/dsk/c0t9d0 00009 /dev/dsk/c0t9d0 00010 /dev/dsk/c0t9d0 00011 /
Chapter 13 LVM October 29, 2013 Booting: When LVM Data Structures Are Lost When critical LVM data structures have been lost, you will need to use the recovery portion of the Support Media included in the HP-UX product kit to restore the corrupted disk image from your backup tape. For more information, see the Support Media User's Manual. After you have made the LVM disk minimally bootable, the system can be booted in maintenance mode using the -lm option of the hpux command at the ISL> prompt.
Chapter 13 LVM October 29, 2013 Quorum Problems Quorum Problems with a Non-Root Volume Group If you attempt to activate a non-root volume group when not enough disks are present to establish a quorum, you will see error messages similar to those in this example: # vgchange –a y /dev/vg01 vgchange: Warning: Couldn't attach to the volume group physical volume "/dev/dsk/c1t0d2": The path of the physical volume refers to a device that does not exist, or is not configured into the kernel.
Chapter 13 LVM October 29, 2013 EXAMPLE: # vgchange –a y /dev/vg01 Quorum Problems with Your Root Volume Group Your root volume group might also have a quorum problem. This might occur if you have physically removed a disk from your system because you no longer intended to use it with the system, but did not remove the physical volume from the volume group using vgreduce.
Chapter 13 LVM October 29, 2013 If you have a good prior backup, restore its contents. Since the new file system in the smaller logical volume will be smaller than the original file system, you may not have enough space to restore all your original files. Use the new file system for creating and storing a new set of files (not for trying to restore the original files). If you do not have a good prior backup, attempt to restore as many files as possible from any backup.
Chapter 13 LVM October 29, 2013 vgchgid vgsync change the VG-ID of a VG (needed for XPs) synchronize all mirrored LVs in the VG lvcreate lvdisplay lvchange lvextend lvreduce lvremove lvspit lvmerge lvsync lvlnboot lvrmboot create a new LV display information about LV change characteristics of a LV increase the size of LV / add a mirror copy to LV decrease the size of LV / remove a mirror copy from LV remove the LV split a mirror copy of a LV (results in a separate LV) merge a splitted mirror copy of a
Chapter 13 LVM October 29, 2013 NOTE: 11.31 LVM commands in /usr/sbin # ls -alil -iF vg* lv* pv* nomwc* 4865 lrwxrwxrwx 1 root sys ./lvm_wrapper 4866 lrwxrwxrwx 1 root sys ./lvm_wrapper 4867 lrwxrwxrwx 1 root sys > ./lvm_wrapper 4868 lrwxrwxrwx 1 root sys ./lvm_wrapper 4869 lrwxrwxrwx 1 root sys ./lvm_wrapper 4870 -r-sr-xr-x 1 root sys 4871 lrwxrwxrwx 1 root sys ./lvm_wrapper 4872 -r-xr-xr-x 1 bin bin 4873 -r-sr-xr-x 1 root sys 4874 lrwxrwxrwx 1 root sys ./lvm_wrapper 4875 lrwxrwxrwx 1 root sys .
Chapter 13 4892 lrwxrwxrwx ./lvm_wrapper 4893 lrwxrwxrwx ./lvm_wrapper 4894 lrwxrwxrwx ./lvm_wrapper 4895 lrwxrwxrwx > ./lvm_wrapper 4896 lrwxrwxrwx ./lvm_wrapper 4897 lrwxrwxrwx ./lvm_wrapper 4898 lrwxrwxrwx ./lvm_wrapper 4899 lrwxrwxrwx ./lvm_wrapper 4900 lrwxrwxrwx ./lvm_wrapper 4901 lrwxrwxrwx ./lvm_wrapper 4902 lrwxrwxrwx ./lvm_wrapper 4903 lrwxrwxrwx ./lvm_wrapper 4904 lrwxrwxrwx ./lvm_wrapper 4905 lrwxrwxrwx > .