环境:52A AIX7.1 实验目的:

1、替换做了镜像中的某个坏的磁盘

2、替换未作镜像中磁盘损坏的情况,前提是这时的磁盘还能够读取数据


一、替换做了镜像中的某个坏的磁盘


root@testdb:/# lsvg -o
testvg
rootvg

root@testdb:/# bootlist -m normal -o
hdisk0 blv=hd5
hdisk1 blv=hd5
cd0


root@testdb:/# lspv      //假设hdisk0 损坏了
hdisk0          0007388ca583b447                    rootvg          active      
hdisk1          0007388ca7a889a1                    rootvg          active      
hdisk2          000b0856ec68f5de                    testvg          active      
hdisk3          000b0856eede6bdd                    testvg          active


1、卸载镜像 unmirrorvg hdisk0


root@testdb:/# unmirrorvg rootvg hdisk0
0516-1246 rmlvcopy: If hd5 is the boot logical volume, please run 'chpv -c '
        as root user to clear the boot record and avoid a potential boot
        off an old boot p_w_picpath that may reside on the disk from which this
        logical volume is moved/removed.
0516-1804 chvg: The quorum change takes effect immediately.
0516-1144 unmirrorvg: rootvg successfully unmirrored, user should perform
        bosboot of system to reinitialize boot records.  Then, user must modify
        bootlist to just include:  hdisk1.


root@testdb:/# lsvg -l rootvg
rootvg:
LV NAME             TYPE       LPs     PPs     PVs  LV STATE      MOUNT POINT
hd5                 boot       1       1       1    closed/syncd  N/A
hd6                 paging     6       6       1    open/syncd    N/A
hd8                 jfs2log    1       1       1    open/syncd    N/A
hd4                 jfs2       82      82      1    open/syncd    /
hd2                 jfs2       9       9       1    open/syncd    /usr
hd9var              jfs2       50      50      1    open/syncd    /var
hd3                 jfs2       5       5       1    open/syncd    /tmp
hd1                 jfs2       37      37      1    open/syncd    /home
hd10opt             jfs2       3       3       1    open/syncd    /opt
hd11admin           jfs2       1       1       1    open/syncd    /admin
lg_dumplv           sysdump    4       4       1    open/syncd    N/A
livedump            jfs2       1       1       1    open/syncd    /var/adm/ras/livedump


2、把HDISK0 移出rootvg


root@testdb:/# reducevg rootvg hdisk0
0516-016 ldeletepv: Cannot delete physical volume with allocated
        partitions. Use either migratepv to move the partitions or
        reducevg with the -d option to delete the partitions.
0516-884 reducevg: Unable to remove physical volume hdisk0.
root@testdb:/#
root@testdb:/# reducevg -d rootvg hdisk0
0516-914 rmlv: Warning, all data belonging to logical volume
        lg_dumplv on physical volume hdisk0 will be destroyed.
rmlv: Do you wish to continue? y(es) n(o)? y
0516-1251 rmlv: Warning, cannot remove logical volume lg_dumplv.
        This logical volume is also used as the primary dump device.
        Reset the dump device and retry the command.
0516-884 reducevg: Unable to remove physical volume hdisk0.


root@testdb:/# lspv -l hdisk1
hdisk1:
LV NAME               LPs     PPs     DISTRIBUTION          MOUNT POINT
hd6                   6       6       00..00..06..00..00    N/A
hd8                   1       1       00..00..01..00..00    N/A
hd5                   1       1       01..00..00..00..00    N/A
hd9var                50      50      00..50..00..00..00    /var
hd3                   5       5       00..00..05..00..00    /tmp
hd4                   82      82      00..00..82..00..00    /
hd2                   9       9       00..00..09..00..00    /usr
hd1                   37      37      00..37..00..00..00    /home
hd10opt               3       3       00..00..03..00..00    /opt
livedump              1       1       00..01..00..00..00    /var/adm/ras/livedump
hd11admin             1       1       00..00..01..00..00    /admin

root@testdb:/#
root@testdb:/# lspv -l hdisk0
hdisk0:
LV NAME               LPs     PPs     DISTRIBUTION          MOUNT POINT
lg_dumplv             4       4       00..04..00..00..00    N/A


root@testdb:/# migratepv -l lg_dumplv hdisk0 hdisk1   //移植逻辑卷


root@testdb:/# lspv -l hdisk0
root@testdb:/#     
root@testdb:/#
root@testdb:/# lspv -l hdisk1
hdisk1:
LV NAME               LPs     PPs     DISTRIBUTION          MOUNT POINT
hd6                   6       6       00..00..06..00..00    N/A
hd8                   1       1       00..00..01..00..00    N/A
hd5                   1       1       01..00..00..00..00    N/A
hd9var                50      50      00..50..00..00..00    /var
hd3                   5       5       00..00..05..00..00    /tmp
hd4                   82      82      00..00..82..00..00    /
hd2                   9       9       00..00..09..00..00    /usr
hd1                   37      37      00..37..00..00..00    /home
hd10opt               3       3       00..00..03..00..00    /opt
livedump              1       1       00..01..00..00..00    /var/adm/ras/livedump
lg_dumplv             4       4       00..04..00..00..00    N/A
hd11admin             1       1       00..00..01..00..00    /admin


root@testdb:/# lspv
hdisk0          0007388ca583b447                    rootvg          active      
hdisk1          0007388ca7a889a1                    rootvg          active      
hdisk2          000b0856ec68f5de                    testvg          active      
hdisk3          000b0856eede6bdd                    testvg          active      
root@testdb:/# reducevg rootvg hdisk0
root@testdb:/# lspv
hdisk0          0007388ca583b447                    None                        
hdisk1          0007388ca7a889a1                    rootvg          active      
hdisk2          000b0856ec68f5de                    testvg          active      
hdisk3          000b0856eede6bdd                    testvg          active  

root@testdb:/# rmdev -dl hdisk0    //删除hdisk0
hdisk0 deleted
root@testdb:/# lspv
hdisk1          0007388ca7a889a1                    rootvg          active      
hdisk2          000b0856ec68f5de                    testvg          active      
hdisk3          000b0856eede6bdd                    testvg          active   

如果机器支持热插拔就可以把hdisk0从机器中拔出来了,插入新的磁盘


oot@testdb:/# cfgmgr
root@testdb:/# lspv
hdisk0          0007388ca583b447                    None                        
hdisk1          0007388ca7a889a1                    rootvg          active      
hdisk2          000b0856ec68f5de                    testvg          active      
hdisk3          000b0856eede6bdd                    testvg          active      
root@testdb:/# chdev -l hdisk0 -a pv=yes
hdisk0 changed
root@testdb:/# lspv
hdisk0          0007388ca583b447                    None                        
hdisk1          0007388ca7a889a1                    rootvg          active      
hdisk2          000b0856ec68f5de                    testvg          active      
hdisk3          000b0856eede6bdd                    testvg          active   



root@testdb:/# extendvg rootvg hdisk0
root@testdb:/# lspv
hdisk0          0007388ca583b447                    rootvg          active      
hdisk1          0007388ca7a889a1                    rootvg          active      
hdisk2          000b0856ec68f5de                    testvg          active      
hdisk3          000b0856eede6bdd                    testvg          active   


root@testdb:/# mirrorvg rootvg
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.
root@testdb:/# 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     6       12      2    open/syncd    N/A
hd8                 jfs2log    1       2       2    open/syncd    N/A
hd4                 jfs2       82      164     2    open/syncd    /
hd2                 jfs2       9       18      2    open/syncd    /usr
hd9var              jfs2       50      100     2    open/syncd    /var
hd3                 jfs2       5       10      2    open/syncd    /tmp
hd1                 jfs2       37      74      2    open/syncd    /home
hd10opt             jfs2       3       6       2    open/syncd    /opt
hd11admin           jfs2       1       2       2    open/syncd    /admin
lg_dumplv           sysdump    4       4       1    open/syncd    N/A
livedump            jfs2       1       2       2    open/syncd    /var/adm/ras/lived



root@testdb:/# bosboot -ad /dev/hdisk0

bosboot: Boot p_w_picpath is 53276 512 byte blocks.


root@testdb:/# bootlist -m normal hdisk1 hdisk0
root@testdb:/# bootlist -m normal -o
hdisk1 blv=hd5
hdisk0 blv=hd5


#reboot 重启系统 ,

root@testdb:/# 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     6       12      2    open/syncd    N/A
hd8                 jfs2log    1       2       2    open/syncd    N/A
hd4                 jfs2       82      164     2    open/syncd    /
hd2                 jfs2       9       18      2    open/syncd    /usr
hd9var              jfs2       50      100     2    open/syncd    /var
hd3                 jfs2       5       10      2    open/syncd    /tmp
hd1                 jfs2       37      74      2    open/syncd    /home
hd10opt             jfs2       3       6       2    open/syncd    /opt
hd11admin           jfs2       1       2       2    open/syncd    /admin
lg_dumplv           sysdump    4       4       1    open/syncd    N/A
livedump            jfs2       1       2       2    open/syncd    /var/adm/ras/livedump



2、替换未作镜像中磁盘损坏的情况,前提是这时的磁盘还能够读取数据如果是未作镜像的磁盘组中的磁盘损坏,但能够读取数据时的处理方法如下:

A,插入新的一个磁盘

#cfgmgr

#lvpv

#chpv -l hdiskn -a pv=yes

#extendvg rootvg hdiskn

#migrate hdisk0 hdiskn

#lspv -M hdisk2

#reducevg rootvg hdisk0

#rmdel -dl hdisk0


注意在migratepv过程中,如果移动的磁盘中包含有启动卷,则需要将要替换的磁盘上的引导记录清除(chpv -c hdiskn),若需要在新的磁盘上建立启动卷,则需要用bosboot -ad /dev/hdiskn 建立启动,并用bootlist -m normal hdisk1 hdiskn 更新启动列表;如果损坏的磁盘上有page 或dump 则需要分别禁用它们,待新的磁盘移植完毕后激活