Making more space by replacing small LVM mirrored disks with larger LVM mirrored disks

From Notes

Jump to: navigation, search

Contents

How to expand an LV by replacing small disks with big disks

Pre-requisites

1. Verify that your VG will support bigger disks by checking the Max PE to PV value using vgdisplay <vg>. Note that your PE size x PE to PV value is the maximum disk size that your VG will support. If your PE to PV value is too low, you have no choice but to create a new VG.

2. All logical volumes in your volume group are mirrored with logical volumes using strict mirroring.

3. Backup your data before attempting this procedure.

Procedure

The following example was performed on HP-UX 11.0 using the following components:

 VG:
   vg01
 PVs:
   /dev/dsk/c0t10d0
   /dev/dsk/c1t10d0
 LV:
   /dev/vg01/lvol1

1. Begin by removing one of the mirrored PVs using the following steps -- be sure that both disks are good and that the appropriate PV is being removed. Make a careful note of the PV that is being removed. Also note that an lvreduce must be run for each LV mirrored on the PVs in question.

 a. lvreduce -m 0 /dev/vg01/lvol1 /dev/dsk/c1t10d0

2. Remove the PV from the volume group:

 b. vgreduce vg01 /dev/dsk/c1t10d0
 

3. Replace PV with larger disk, be very careful.

4. Add new disk as a PV to the VG:

  pvcreate -f /dev/rdsk/c1t10d0
  vgextend vg01 /dev/dsk/c1t10d0
  

5. Mirror the remaining old disk with the new larger disk:

 lvextend -m 1 /dev/vg01/lvol1 /dev/dsk/c1t10d0
 

6. After the mirror is complete, verify data integrity and mirror syncronization.

7. Remove smaller disk from mirror:

 lvreduce -m 0 /dev/vg01/lvol1 /dev/dsk/c0t10d0
 vgreduce vg01 /dev/dsk/c0t10d0
 

8. Swap out smaller disk with one equal to the previously replaced disk.

9. Initialize new PV and extend VG onto the new PV:

 pvcreate -f /dev/rdsk/c0t10d0
 vgextend vg01 /dev/dsk/c0t10d0
 

10. Mirror the new PV to the first one replaced:

 lvextend -m 1 /dev/vg01/lvol1 /dev/dsk/c0t10d0

That should conclude the mirror extension.

Notes

1. # Too few PE per PV when going from 9.1 to 36 GB

[:root@hp08:] vgextend vg01 /dev/dsk/c1t10d0
vgextend: Warning: Max_PE_per_PV for the volume group (2170) too small for this PV (8683).
         Using only 2170 PEs from this physical volume.
Volume group "vg01" has been successfully extended.
Volume Group configuration for /dev/vg01 has been saved in /etc/lvmconf/vg01.conf

 # Get rid of poorly configured LVs
[:root@hp08:] lvremove /dev/vg01/lvol1
lvremove: Couldn't delete logical volume "/dev/vg01/lvol1":
The supplied lv number refers to a non-existent logical volume.
Volume Group configuration for /dev/vg01 has been saved in /etc/lvmconf/vg01.conf

rmsf /dev/vg01/lvol1
rmsf /dev/vg01/rlvol1
rmsf /dev/vg01/lvol2
rmsf /dev/vg01/rlvol2
rmsf /dev/vg01/lvoltest
rmsf /dev/vg01/rlvoltest
Personal tools