Pages

Thursday, October 23, 2014

Migrate/Move PPs in AIX LVM

Today I needed to replace a disk which is used by AIX LVM and which wasn't mirrored. Of course all data should remain.
The first thing I did was to list all volumes on the specific disk (in my case hdisk2):
 
# lspv -l hdisk2
hdisk2:
LV NAME   LPs     PPs     DISTRIBUTION          MOUNT POINT

u01       6       6       00..04..02..00..00    /u01
u02       22      22      20..00..02..00..00    /u02
u03       91      91      20..40..31..00..00    /u03
log       10      10      10..00..00..00..00    /log
u04       2       2       02..00..00..00..00    /u04
u05       20      20      00..12..08..00..00    /u05
u06       22      22      00..00..00..01..21    /u06
loglv00   1       1       01..00..00..00..00    N/A
u07       10      10      00..00..10..00..00    /u07


Next I needed to how many PPs were used and free:

# lspv hdisk2
PHYSICAL VOLUME:    hdisk2                   VOLUME GROUP:     dbvg
PV IDENTIFIER:      a1b2c3d4                 VG IDENTIFIER     b2c3d4e5
PV STATE:           active
STALE PARTITIONS:   0                        ALLOCATABLE:      yes
PP SIZE:            1024 megabyte(s)         LOGICAL VOLUMES:  9
TOTAL PPs:          279 (285696 megabytes)   VG DESCRIPTORS:   1
FREE PPs:           95 (97280 megabytes)     HOT SPARE:        no
USED PPs:           184 (188416 megabytes)   MAX REQUEST:      256 kilobytes
FREE DISTRIBUTION:  03..00..02..55..35
USED DISTRIBUTION:  53..56..53..01..21


The above output shows that 184 PPs were used and 95 PPs were free on hdisk2.
Now I needed all free PPs inside the VG:

# lsvg dbvg
VOLUME GROUP:       dbvg             VG IDENTIFIER   b2c3d4e5
VG STATE:           active           PP SIZE:        1024 megabyte(s)
VG PERMISSION:      read/write       TOTAL PPs:      1674 (1714176 mb)
MAX LVs:            256              FREE PPs:       422 (432128 mb)
LVs:                11               USED PPs:       1252 (1282048 mb)
OPEN LVs:           11               QUORUM:         1 (Disabled)
TOTAL PVs:          6                VG DESCRIPTORS: 6
STALE PVs:          0                STALE PPs:      0
ACTIVE PVs:         6                AUTO ON:        yes
MAX PPs per VG:     32512
MAX PPs per PV:     1016             MAX PVs:        32
LTG size (Dynamic): 256 kilobyte(s)  AUTO SYNC:      no
HOT SPARE:          no               BB POLICY:      relocatable


There were 422 free PPs inside the VG but I must substract 95 free PPs to get all free PPs without hdisk2 (because I needed to remove it):

# echo 422-95 | bc -l
327


That makes an overall of 327 free PPs which is enough to move the 184 used PPs from hdisk2.
Next I checked on which PV the free PPs were:

# lsvg -p dbvg
dbvg:
PV_NAME       PV STATE      TOTAL PPs   FREE PPs    FREE DISTRIBUTION
hdisk2        active        279         95          03..00..02..55..35
hdisk3        active        279         0           00..00..00..00..00
hdisk1        active        279         0           00..00..00..00..00
hdisk5        active        279         0           00..00..00..00..00
hdisk6        active        279         199         56..00..31..56..56
hdisk7        active        279         128         56..00..40..25..07


Where hdisk6 and hdisk7 looked like suitable candidates to move the PPs on. I started with the log volume:

# migratepv -l log hdisk2 hdisk6

The above command takes some time, be patient. After the migration has finished I rechecked the PV's inside the VG:

# lsvg -p dbvg
dbvg:
PV_NAME       PV STATE      TOTAL PPs   FREE PPs    FREE DISTRIBUTION
hdisk2        active        279         105         13..00..02..55..35
hdisk3        active        279         0           00..00..00..00..00
hdisk1        active        279         0           00..00..00..00..00
hdisk5        active        279         0           00..00..00..00..00
hdisk6        active        279         189         46..00..31..56..56
hdisk7        active        279         128         56..00..40..25..07


Since the log volume uses 10PPs, the free PP's on hdisk2 has increased from 95 to 105 while the free PPs on hdisk6 have been decreased from 199 to 189. That indicates the the volume log was moved from hdisk2 to hdisk6.
Finally I could move all remaining volumes from hdisk2 to hdisk6:

# migratepv -l u01 hdisk2 hdisk6
# migratepv -l u02 hdisk2 hdisk6
# migratepv -l u03 hdisk2 hdisk6
# migratepv -l u04 hdisk2 hdisk6
# migratepv -l u05 hdisk2 hdisk6
# migratepv -l u06 hdisk2 hdisk6
# migratepv -l u07 hdisk2 hdisk6

No comments:

Post a Comment