From Wiki-UX.info

Wiki-UX / Logical Volume Manager / How to extend root file system using LVM mirrors
Jump to: navigation, search

How to extend root file system using LVM mirrors

Abstract

This article explains how to extend the root (/) file system using LVM Mirror/UX. OnlineJFS is required to extend the file system without going in LVM maintenance mode. This method allows to extend root (/) file system without re-igniting the server.

It uses a special "reserve" logical volume as stepping stone to free the required PEs between current lvol3 and lvol4 to comply with lvol3 contiguous policy. This method can be used on HP-UX 11.11 / 11.23 with Legacy Addressing (/dev/dsk/c#t#d#) or with the new HP-UX 11.31 Agile Addressing (/dev/disk/disk#) device special files. In this example we use the new HP-UX 11.31 Agile Addressing.

Procedure

1. Create full backup of /dev/vg00 volume group using Ignite, if available.

# make_tape_recovery -v -I -x inc_entire=vg00 -a /dev/rmt/#mn

2. Check the current status of your volume groups and logical volumes.

# vgdisplay -v /dev/vg00
--- Volume groups ---
VG Name                     /dev/vg00
VG Write Access             read/write
VG Status                   available
Max LV                      255
Cur LV                      10
Open LV                     10
Max PV                      16
Cur PV                      2
Act PV                      2
Max PE per PV               4350
VGDA                        4
PE Size (Mbytes)            8
Total PE                    8682
Alloc PE                    6810
Free PE                     1872
Total PVG                   0
Total Spare PVs             0
Total Spare PVs in use      0
VG Version                  1.0.0

   --- Logical volumes ---
   LV Name                     /dev/vg00/lvol1
   LV Status                   available/syncd
   LV Size (Mbytes)            1536
   Current LE                  192
   Allocated PE                384
   Used PV                     2

   LV Name                     /dev/vg00/lvol2
   LV Status                   available/syncd
   LV Size (Mbytes)            4096
   Current LE                  512
   Allocated PE                1024
   Used PV                     2

   LV Name                     /dev/vg00/lvol3
   LV Status                   available/syncd
   LV Size (Mbytes)            1536
   Current LE                  192
   Allocated PE                384
   Used PV                     2

   LV Name                     /dev/vg00/lvol4
   LV Status                   available/syncd
   LV Size (Mbytes)            6144
   Current LE                  768
   Allocated PE                1536
   Used PV                     2

   LV Name                     /dev/vg00/lvol5
   LV Status                   available/syncd
   LV Size (Mbytes)            512
   Current LE                  64
   Allocated PE                128
   Used PV                     2

   LV Name                     /dev/vg00/lvol6
   LV Status                   available/syncd
   LV Size (Mbytes)            3072
   Current LE                  384
   Allocated PE                768
   Used PV                     2

   LV Name                     /dev/vg00/lvol7
   LV Status                   available/syncd
   LV Size (Mbytes)            6144
   Current LE                  768
   Allocated PE                1536
   Used PV                     2

   LV Name                     /dev/vg00/lvol8
   LV Status                   available/syncd
   LV Size (Mbytes)            104
   Current LE                  13
   Allocated PE                26
   Used PV                     2


   --- Physical volumes ---
   PV Name                     /dev/disk/disk12
   PV Status                   available
   Total PE                    4341
   Free PE                     929
   Autoswitch                  On
   Proactive Polling           On

   PV Name                     /dev/disk/disk7
   PV Status                   available
   Total PE                    4341
   Free PE                     936
   Autoswitch                  On
   Proactive Polling           On

The primary disk is disk12 and the alternate disk is disk7. In this example the current size of lvol3 is 192 PE or 1536 MB.

   CURRENT DISK CONFIGURATION
PRIMARY DISK       ALTERNATE DISK
+-----------+      +-----------+
|   LVOL1   |      |   LVOL1   |
+-----------+      +-----------+
|   LVOL2   |      |   LVOL2   |
+-----------+      +-----------+
|   LVOL3   |      |   LVOL3   |
+-----------+      +-----------+
|   LVOL4   |      |   LVOL4   |
+-----------+      +-----------+
|   LVOL5   |      |   LVOL5   |
+-----------+      +-----------+
|   LVOL6   |      |   LVOL6   |
+-----------+      +-----------+
|   LVOL7   |      |   LVOL7   |
+-----------+      +-----------+
|   LVOL8   |      |   LVOL8   |
+-----------+      +-----------+


3. Remove all mirrors from alternate disk down to lvol4.

# lvreduce -m 0 /dev/vg00/lvol9 /dev/disk/disk7
# lvreduce -m 0 /dev/vg00/lvol8 /dev/disk/disk7
# lvreduce -m 0 /dev/vg00/lvol7 /dev/disk/disk7
# lvreduce -m 0 /dev/vg00/lvol6 /dev/disk/disk7
# lvreduce -m 0 /dev/vg00/lvol5 /dev/disk/disk7
# lvreduce -m 0 /dev/vg00/lvol4 /dev/disk/disk7
   CURRENT DISK CONFIGURATION
PRIMARY DISK       ALTERNATE DISK
+-----------+      +-----------+
|   LVOL1   |      |   LVOL1   |
+-----------+      +-----------+
|   LVOL2   |      |   LVOL2   |
+-----------+      +-----------+
|   LVOL3   |      |   LVOL3   |
+-----------+      +-----------+
|   LVOL4   |
+-----------+
|   LVOL5   |
+-----------+
|   LVOL6   |
+-----------+
|   LVOL7   |
+-----------+
|   LVOL8   |
+-----------+


4. At this point, the alternate disk is only mirroring lvol1, lvol2 and lvol3. You can confirm using pvdisplay -v /dev/disk/disk7. Create a "step stone" logical volume in the alternate disk of the size you need to add to lvol3.

# lvcreate -n reserve /dev/vg00
# lvextend -l <PE_size> /dev/vg00/reserve /dev/disk/disk7
   CURRENT DISK CONFIGURATION
PRIMARY DISK       ALTERNATE DISK
+-----------+      +-----------+
|   LVOL1   |      |   LVOL1   |
+-----------+      +-----------+
|   LVOL2   |      |   LVOL2   |
+-----------+      +-----------+
|   LVOL3   |      |   LVOL3   |
+-----------+      +-----------+
|   LVOL4   |      |  RESERVE  |
+-----------+      |           |
|   LVOL5   |      +-----------+
+-----------+
|   LVOL6   |
+-----------+
|   LVOL7   |
+-----------+
|   LVOL8   |
+-----------+


5. Remirror the lvols to the alternate disk

# lvextend -m 1 /dev/vg00/lvol4 /dev/disk/disk7
# lvextend -m 1 /dev/vg00/lvol5 /dev/disk/disk7
# lvextend -m 1 /dev/vg00/lvol6 /dev/disk/disk7
# lvextend -m 1 /dev/vg00/lvol7 /dev/disk/disk7
# lvextend -m 1 /dev/vg00/lvol8 /dev/disk/disk7
# lvextend -m 1 /dev/vg00/lvol9 /dev/disk/disk7
   CURRENT DISK CONFIGURATION
PRIMARY DISK       ALTERNATE DISK
+-----------+      +-----------+
|   LVOL1   |      |   LVOL1   |
+-----------+      +-----------+
|   LVOL2   |      |   LVOL2   |
+-----------+      +-----------+
|   LVOL3   |      |   LVOL3   |
+-----------+      +-----------+
|   LVOL4   |      |  RESERVE  |
+-----------+      |           |
|   LVOL5   |      +-----------+
+-----------+      |   LVOL4   |
|   LVOL6   |      +-----------+
+-----------+      |   LVOL5   |
|   LVOL7   |      +-----------+
+-----------+      |   LVOL6   |
|   LVOL8   |      +-----------+
+-----------+      |   LVOL7   |
                   +-----------+
                   |   LVOL8   |
                   +-----------+

6. Reduce the mirrors from the primary disk down to lvol4 included.

# lvreduce -m 0 /dev/vg00/lvol9 /dev/disk/disk12
# lvreduce -m 0 /dev/vg00/lvol8 /dev/disk/disk12
# lvreduce -m 0 /dev/vg00/lvol7 /dev/disk/disk12
# lvreduce -m 0 /dev/vg00/lvol6 /dev/disk/disk12
# lvreduce -m 0 /dev/vg00/lvol5 /dev/disk/disk12
# lvreduce -m 0 /dev/vg00/lvol4 /dev/disk/disk12
   CURRENT DISK CONFIGURATION
PRIMARY DISK       ALTERNATE DISK
+-----------+      +-----------+
|   LVOL1   |      |   LVOL1   |
+-----------+      +-----------+
|   LVOL2   |      |   LVOL2   |
+-----------+      +-----------+
|   LVOL3   |      |   LVOL3   |
+-----------+      +-----------+
                   |  RESERVE  |
                   |           |
                   +-----------+
                   |   LVOL4   |
                   +-----------+
                   |   LVOL5   |
                   +-----------+
                   |   LVOL6   |
                   +-----------+
                   |   LVOL7   |
                   +-----------+
                   |   LVOL8   |
                   +-----------+

7. Remove the "step stone" lvol in the alternate disk to free its space.

# lvremove /dev/vg00/reserve
   CURRENT DISK CONFIGURATION
PRIMARY DISK       ALTERNATE DISK
+-----------+      +-----------+
|   LVOL1   |      |   LVOL1   |
+-----------+      +-----------+
|   LVOL2   |      |   LVOL2   |
+-----------+      +-----------+
|   LVOL3   |      |   LVOL3   |
+-----------+      +-----------+
                   |  free...  |
                   |           |
                   +-----------+
                   |   LVOL4   |
                   +-----------+
                   |   LVOL5   |
                   +-----------+
                   |   LVOL6   |
                   +-----------+
                   |   LVOL7   |
                   +-----------+
                   |   LVOL8   |
                   +-----------+

8. Now enough contigous space is available in both drives to extend the /dev/vg00/lvol3 logical volume.

Extend the logical volume. This will increase lvol3 in both disks since the mirror hasn't been broken.

# lvextend -l <PE_size> /dev/vg00/lvol3
  CURRENT DISK CONFIGURATION
PRIMARY DISK       ALTERNATE DISK
+-----------+      +-----------+
|   LVOL1   |      |   LVOL1   |
+-----------+      +-----------+
|   LVOL2   |      |   LVOL2   |
+-----------+      +-----------+
|           |      |           |
|   LVOL3   |      |   LVOL3   |
|           |      |           |
|           |      |           |
+-----------+      +-----------+
                   |   LVOL4   |
                   +-----------+
                   |   LVOL5   |
                   +-----------+
                   |   LVOL6   |
                   +-----------+
                   |   LVOL7   |
                   +-----------+
                   |   LVOL8   |
                   +-----------+


9. Remirror the lvols from the alternate disk to the primary disk.

# lvextend -m 1 /dev/vg00/lvol4 /dev/disk/disk12
# lvextend -m 1 /dev/vg00/lvol5 /dev/disk/disk12
# lvextend -m 1 /dev/vg00/lvol6 /dev/disk/disk12
# lvextend -m 1 /dev/vg00/lvol7 /dev/disk/disk12
# lvextend -m 1 /dev/vg00/lvol8 /dev/disk/disk12
# lvextend -m 1 /dev/vg00/lvol9 /dev/disk/disk12
   CURRENT DISK CONFIGURATION
PRIMARY DISK       ALTERNATE DISK
+-----------+      +-----------+
|   LVOL1   |      |   LVOL1   |
+-----------+      +-----------+
|   LVOL2   |      |   LVOL2   |
+-----------+      +-----------+
|           |      |           |
|   LVOL3   |      |   LVOL3   |
|           |      |           |
|           |      |           |
+-----------+      +-----------+
|   LVOL4   |      |   LVOL4   |
+-----------+      +-----------+
|   LVOL5   |      |   LVOL5   |
+-----------+      +-----------+
|   LVOL6   |      |   LVOL6   |
+-----------+      +-----------+
|   LVOL7   |      |   LVOL7   |
+-----------+      +-----------+
|   LVOL8   |      |   LVOL8   |
+-----------+      +-----------+


10. Extend the filesystem of lvol3 using OnlineJFS fsadm command.

# fsadm -F vxfs -b <Current PEs * PE_size>M /

Authors

This page was last modified on 3 August 2011, at 19:01. This page has been accessed 2,853 times.