LVM: Unmirror/Mirror "rootvg" Volume Group

Tested on AIX 5.3


# UN-MIRRORING "rootvg"
# ------------------------------------------------------------------------------------------

# We are un-mirroring a "rootvg" VG distributed on "hdisk0" & "hdisk1" disks like this one
# (we'll take "hdisk1" out of the mirror for whatever reason):


lspv | grep rootvg
   hdisk0          0039c23db037da0b                    rootvg          active
   hdisk1          0039c23db037dae6                    rootvg          active


lsvg -l rootvg
   rootvg:
   LV NAME             TYPE       LPs     PPs     PVs  LV STATE      MOUNT POINT
   hd5                 boot       1       2       2    closed/syncd  N/A
   hd6                 paging     128     256     2    open/syncd    N/A
   hd8                 jfslog     1       2       2    open/syncd    N/A
   hd4                 jfs        1       2       2    open/syncd    /
   hd2                 jfs        14      28      2    open/syncd    /usr
   hd9var              jfs        8       16      2    open/syncd    /var
   hd3                 jfs        8       16      2    open/syncd    /tmp
   lv_dump2            sysdump    32      32      1    open/syncd    N/A
   hd10opt             jfs        8       16      2    open/syncd    /opt
   loglv00             jfs2log    1       2       2    open/syncd    N/A
   localoptlv          jfs2       309     618     2    open/stale    /local/opt
   lv_dump1            sysdump    32      32      1    open/syncd    N/A
   fslv00              jfs2       8       16      2    open/stale    /local/home


lspv -l hdisk0
   hdisk0:
   LV NAME               LPs     PPs     DISTRIBUTION          MOUNT POINT
   hd10opt               8       8       00..00..01..00..07    /opt
   hd3                   8       8       00..00..08..00..00    /tmp
   hd9var                8       8       00..00..08..00..00    /var
   hd2                   14      14      00..00..11..01..02    /usr
   hd4                   1       1       00..00..01..00..00    /
   hd8                   1       1       00..00..01..00..00    N/A
   hd6                   128     128     00..101..27..00..00   N/A
   hd5                   1       1       01..00..00..00..00    N/A
   fslv00                8       8       00..00..01..07..00    /local/home
   lv_dump1              32      32      00..00..32..00..00    N/A
   localoptlv            309     309     108..08..19..101..73  /local/opt
   loglv00               1       1       01..00..00..00..00    N/A


lspv -l hdisk1
   hdisk1:
   LV NAME               LPs     PPs     DISTRIBUTION          MOUNT POINT
   hd10opt               8       8       00..00..08..00..00    /opt
   lv_dump2              32      32      00..00..00..00..32    N/A
   hd3                   8       8       00..00..08..00..00    /tmp
   hd9var                8       8       00..00..08..00..00    /var
   hd2                   14      14      00..00..14..00..00    /usr
   hd4                   1       1       00..00..01..00..00    /
   hd8                   1       1       00..00..01..00..00    N/A
   hd6                   128     128     00..109..19..00..00   N/A
   hd5                   1       1       01..00..00..00..00    N/A
   fslv00                8       8       00..00..00..00..08    /local/home
   localoptlv            309     309     108..00..50..109..42  /local/opt
   loglv00               1       1       01..00..00..00..00    N/A



# First of all verify if there are any volumes belonging to "hdisk1" acting as dump device;
# if this is the cas, we'll free them up:

sysdumpdev -l
   primary              /dev/lv_dump1
   secondary            /dev/lv_dump2        <---
   copy directory       /var/adm/ras
   forced copy flag     TRUE
   always allow dump    FALSE
   dump compression     ON



sysdumpdev -s /dev/sysdumpnull
   primary              /dev/lv_dump1
   secondary            /dev/sysdumpnull     <---
   copy directory       /var/adm/ras
   forced copy flag     TRUE
   always allow dump    FALSE
   dump compression     ON



# Let's remove "/dev/lv_dump2" from "hdisk1"

rmlv lv_dump2

# ... and, finally, completely un-mirror rootvg (take out "hdisk1"):

reducevg rootvg hdisk1







# RE-MIRRORING "rootvg"
# ------------------------------------------------------------------------------------------

# We are re-constructing mirror that was split on previous step or just mirroring "rootvg"
# in order to have a redundancy is case of problems with one of the boot disks


# Verify that the disk where we are creating the mirror, "hdisk1", is not in use - It
# doesn't belong to any VG ("None") -

lspv
   hdisk0          0039c23db037da0b                    rootvg          active
   hdisk1          0039c23db037dae6                    None
[...]



# Just for info, check Logical Volume distribution on both disks

lspv -l hdisk0
   hdisk0:
   LV NAME               LPs     PPs     DISTRIBUTION          MOUNT POINT
   hd10opt               8       8       00..00..01..00..07    /opt
   hd3                   8       8       00..00..08..00..00    /tmp
   hd9var                8       8       00..00..08..00..00    /var
   hd2                   14      14      00..00..11..01..02    /usr
   hd4                   1       1       00..00..01..00..00    /
   hd8                   1       1       00..00..01..00..00    N/A
   hd6                   128     128     00..101..27..00..00   N/A
   hd5                   1       1       01..00..00..00..00    N/A
   fslv00                8       8       00..00..01..07..00    /local/home
   lv_dump1              32      32      00..00..32..00..00    N/A
   localoptlv            309     309     108..08..19..101..73  /local/opt
   loglv00               1       1       01..00..00..00..00    N/A


lspv -l hdisk1
   0516-320 : Physical volume 0039c23db037dae60000000000000000 is not assigned to
           a volume group.



# Extend "rootvg" with the new disk (it system detects that there is any information on
# disk belonging to an old VG it may be necessary to use -f option, like here)

extendvg rootvg hdisk1
   0516-1398 extendvg: The physical volume hdisk1, appears to belong to
   another volume group. Use the force option to add this physical volume
   to a volume group.
   0516-792 extendvg: Unable to extend volume group.


extendvg -f rootvg hdisk1


lspv
   hdisk0          0039c23db037da0b                    rootvg          active
   hdisk1          0039c23db037dae6                    rootvg          active
[...]




# Mirror all "rootvg" volumes on "hdisk1". For the moment we won't synchronize data, that
# will be done on a further step

mirrorvg -s rootvg hdisk1
   0516-1804 chvg: The quorum change takes effect immediately.
   0516-1126 mirrorvg: rootvg successfully mirrored, user should perform
           bosboot of system to initialize boot records.  Then, user must modify
           bootlist to include:  hdisk0 hdisk1.

# -s Disable Sync
#   Returns the mirrorvg command immediately without performing any type of mirror
#   synchronization. If this option is used, the mirror may exist for a logical volume
#   but is not used by the operating system until it has been synchronized with the
#   syncvg command.



# Check number of copies (PVs) of each volume. Note that for lv_dump1 there is only
# one copy. This is because system has detected that lv_dump1 corresponds to a
# dump device that shouldn't be mirrored. We'll create manually another copy of dump
# device on a new volume on mirror disk...

lsvg -l rootvg
   rootvg:
   LV NAME             TYPE       LPs     PPs     PVs  LV STATE      MOUNT POINT
   hd5                 boot       1       2       2    closed/stale  N/A
   hd6                 paging     128     256     2    open/stale    N/A
   hd8                 jfslog     1       2       2    open/stale    N/A
   hd4                 jfs        1       2       2    open/stale    /
   hd2                 jfs        14      28      2    open/stale    /usr
   hd9var              jfs        8       16      2    open/stale    /var
   hd3                 jfs        8       16      2    open/stale    /tmp
   hd10opt             jfs        8       16      2    open/stale    /opt
   loglv00             jfs2log    1       2       2    open/stale    N/A
   localoptlv          jfs2       309     618     2    open/stale    /local/opt
   lv_dump1            sysdump    32      32      1    open/syncd    N/A         <---
   fslv00              jfs2       8       16      2    open/stale    /local/home


mklv -t sysdump -y lv_dump2 rootvg 32 hdisk1
   lv_dump2


lsvg -l rootvg
   rootvg:
   LV NAME             TYPE       LPs     PPs     PVs  LV STATE      MOUNT POINT
   hd5                 boot       1       2       2    closed/stale  N/A
   hd6                 paging     128     256     2    open/stale    N/A
   hd8                 jfslog     1       2       2    open/stale    N/A
   hd4                 jfs        1       2       2    open/stale    /
   hd2                 jfs        14      28      2    open/stale    /usr
   hd9var              jfs        8       16      2    open/stale    /var
   hd3                 jfs        8       16      2    open/stale    /tmp
   lv_dump2            sysdump    32      32      1    closed/syncd  N/A         <---
   hd10opt             jfs        8       16      2    open/stale    /opt
   loglv00             jfs2log    1       2       2    open/stale    N/A
   localoptlv          jfs2       309     618     2    open/stale    /local/opt
   lv_dump1            sysdump    32      32      1    open/syncd    N/A         <---
   fslv00              jfs2       8       16      2    open/stale    /local/home


# ...and configure dump device correctly (as it was before un-mirroring "rootvg")

sysdumpdev -l
   primary              /dev/lv_dump1
   secondary            /dev/sysdumpnull     <---
   copy directory       /var/adm/ras
   forced copy flag     TRUE
   always allow dump    FALSE
   dump compression     ON


sysdumpdev -s /dev/lv_dump2
   primary              /dev/lv_dump1
   secondary            /dev/lv_dump2        <---
   copy directory       /var/adm/ras
   forced copy flag     TRUE
   always allow dump    FALSE
   dump compression     ON



# Check list of boot devices and add "hdisk1"

bootlist -m normal -o
   hdisk0 blv=hd5
   hdisk1

bosboot -ad hdisk1
   bosboot: Boot image is 44765 512 byte blocks.

bootlist -m normal -o
   hdisk0 blv=hd5
   hdisk1 blv=alt_hd5     <--- It will remain like that until disk data
                               is synchronized between disks in "rootvg"



# And, finally, synchronize data on "rootvg" volumes

varyonvg rootvg

# Alternatively, we can use following command:

# syncvg -v rootvg



# Check status of Volume Group

lsvg rootvg
   VOLUME GROUP:       rootvg                   VG IDENTIFIER:  0039c23d00004c000000011a95b978c9
   VG STATE:           active                   PP SIZE:        128 megabyte(s)
   VG PERMISSION:      read/write               TOTAL PPs:      1092 (139776 megabytes)
   MAX LVs:            256                      FREE PPs:       54 (6912 megabytes)
   LVs:                13                       USED PPs:       1038 (132864 megabytes)
   OPEN LVs:           12                       QUORUM:         1 (Disabled)
   TOTAL PVs:          2                        VG DESCRIPTORS: 3
   STALE PVs:          1                        STALE PPs:      486
   ACTIVE PVs:         2                        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

# Synchronization progress can be monitored like this:

lsvg rootvg | grep -i stale
   STALE PVs:          1                        STALE PPs:      484

lsvg rootvg | grep -i stale
   STALE PVs:          1                        STALE PPs:      478



# Finally, check list of boot devices

bootlist -m normal -o
   hdisk0 blv=hd5
   hdisk1 blv=hd5

 

 

source: https://sites.google.com/site/syscookbook/aix/lvm-rootvg-unmirror-mirror

Attachments
There are no attachments for this article.
Related Articles RSS Feed
Burn Image to DVD in AIX
Viewed 13436 times since Thu, Sep 20, 2018
Create memory resident filesystems (RAM disk) on AIX
Viewed 2672 times since Thu, Feb 21, 2019
Part 1, The basics of network troubleshooting
Viewed 5202 times since Tue, May 22, 2018
AIX Encrypted File System
Viewed 5806 times since Tue, Jul 17, 2018
How to determine why your AIX oslevel is downlevel (and a script to help!)
Viewed 4098 times since Fri, Jul 13, 2018
7 Tips – Tuning Command Line History in Bash
Viewed 5201 times since Fri, Jul 5, 2019
VIO Server Howto
Viewed 10071 times since Mon, Jun 11, 2018
AIX - How to get IP and MAC address of ethernet adapter in AIX
Viewed 24975 times since Fri, Jun 8, 2018
AIX↑ AIX www links
Viewed 3709 times since Sat, Apr 20, 2019
Using expect to automate mundane tasks
Viewed 1868 times since Mon, Jun 3, 2019