GuestbookSign our guestbook ContactGet in touch with the authors ArchiveAll unixwerk articles since 2003
March 25, 2013

Mini Tip: Extend a Mirrored Filesystem


  1. Introduction
  2. Extend the Filesystem


1. Introduction

Extending an existing filesystem in a running cluster is a bit tricky once you have to include new LUNs. We have to be careful that each LP copy lands in the right datacenter.


2. Extend the Filesystem

We start on the first node, run the configuration manager and set the reserve policy to no_reserve for all new disks:

node1# cfgmgr
node1# chdev -l hdisk196 -a reserve_policy=no_reserve
node1# chdev -l hdisk197 -a reserve_policy=no_reserve
node1# chdev -l hdisk198 -a reserve_policy=no_reserve
node1# chdev -l hdisk199 -a reserve_policy=no_reserve
node1# chdev -l hdisk200 -a reserve_policy=no_reserve
node1# chdev -l hdisk201 -a reserve_policy=no_reserve
node1# chdev -l hdisk202 -a reserve_policy=no_reserve
node1# chdev -l hdisk203 -a reserve_policy=no_reserve

Then we set a PVID to the disks:

node1# chdev -l hdisk196 -a pv=yes
node1# chdev -l hdisk197 -a pv=yes
node1# chdev -l hdisk198 -a pv=yes
node1# chdev -l hdisk199 -a pv=yes
node1# chdev -l hdisk200 -a pv=yes
node1# chdev -l hdisk201 -a pv=yes
node1# chdev -l hdisk202 -a pv=yes
node1# chdev -l hdisk203 -a pv=yes

On the other node(s) we can now run cfgmgr to see the new LUNs (with the PVIDs we set on the first node). We have to check/set the reserve policy here as well:

node2# cfgmgr
node2# chdev -l hdisk196¹ -a reserve_policy=no_reserve
¹The hdisk numbering may differ across the nodes

On node1 we need to identify the location of our LUNs. For our example we find the below relationships:

To make sure that C-SPOC finds the new LUNs we let HACMP discover information

node1# smitty hacmp
-> Extended Configuration
   -> Discover HACMP-related Information from Configured Nodes

Now we are ready to extend our cluster volume group clvg:

node1# /usr/es/sbin/cluster/sbin/cl_extendvg -cspoc -n'node1,node2' -R'node1' clvg hdisk196 hdisk197 hdisk198 hdisk199 hdisk200 hdisk201 hdisk202 hdisk203

Now the tricky part starts. We need to create a map file to make sure that every LP will be written to a LUN of the right datacenter - i.e all PPs beloning to the first LV copy have to go to DC1, and PPs belonging to the second LV copy have to go to DC2. We assume a PP size of 128MB and want to extend our LV by 8GB:

node1# PPSIZ=128                     # PP size of Volume Group
node1# ADDLPS=$((8*1024/PPSIZ))      # Additional Logical Partitions required for extension: +8GB <=> 64PPs
node1# PPPERLUN=$((ADDLPS/NUMDISKS)) # PPs per disk: 64/4=16

With these variables we create the map for the first mirror copy:

node1# NUM=1 ; while ((NUM<=PPPERLUN)) ; do \
                  for hd in hdisk196 hdisk197 hdisk198 hdisk199 ; do echo "${hd}:$NUM" ; done ; \
                  NUM=$((NUM+1)) ; \
               done | tee mapfile

and append the map of the second copy to the same map file:

node1# NUM=1 ; while ((NUM<=PPPERLUN)) ; do \
                  for hd in hdisk200 hdisk201 hdisk202 hdisk203 ; do echo "${hd}:$NUM" ; done ; \
                  NUM=$((NUM+1)) ; \
               done | tee -a mapfile

We use the resulting map file (called mapfile here) to actually extend the LV cllv:

node1# /usr/es/sbin/cluster/sbin/cl_extendlv -u'8'² -m mapfile  cllv  64
²The upper bound should be equal to the new total number of LUNs used by 1 LV copy.

On top of the extended LV we extend the filesystem:

node1# chfs -a size=+8G /mountpoint


Also on unixwerk