zlg88 发表于 2007-07-29 22:44

HPUX v11.11 在线去掉坏的Mirror根盘测试

前两天客户有台根盘做了Mirror的RP7410启不来了,幸好有MC/SG双机环境。
两块内置硬盘在另一台RP7410上做diskinfo都没返回信息,估计可能是两块
盘都出现故障了。后来停掉业务停机,在拔出另一台RP7410双机做了Mirror
的内置硬盘,插在故障机器上通过取消根盘Mirror,以及用新硬盘重做根盘
Mirror等操作才得以恢复。
由于整个故障排除不在现场,现根据这样的情况在自已的HP9000 C3000机器
上做个完整的HPUX v11.11根盘Mirror及去掉一块硬盘后取消根盘Mirror的测试:
测试环境:
主机    HP9000 C3000
OS   HP_UX v11.11
内置硬盘18.2GB*2
安装HP_UX v11.11操作系统及补丁这里略过,将HP_UX 11i的Application
Software四张安装CD的第一张放入光驱,
#mkdir /cdrom
#ioscan -fnC disk
Class   IH/W Path       Driver S/W State   H/W Type   Description
=======================================================================
disk      010/0/14/0.0.0sdisk CLAIMED   DEVICE       TEAC    CD-532E-B
                           /dev/dsk/c0t0d0   /dev/rdsk/c0t0d0
disk      110/0/15/1.5.0sdisk CLAIMED   DEVICE       COMPAQBD0186349B
                           /dev/dsk/c3t5d0   /dev/rdsk/c3t5d0
disk      210/0/15/1.6.0sdisk CLAIMED   DEVICE       COMPAQBD0186349B
                           /dev/dsk/c3t6d0   /dev/rdsk/c3t6d0
#mount /dev/dsk/c0t0d0 /cdrom
#swinstall -s /cdrom
在列表里找到B5403BA B.11.11 MirrorDisk/UX并执行安装,缺省安装这个软
件会重新编译内核,安装完成后系统自动重新启动。启动完成后就开始做根盘的Mirror
由于系统是安装在c3t5d0上,另一块盘c3t6d0做镜像盘。
#pvcreate -fB /dev/rdsk/c3t6d0
#vgextend /dev/vg00 /dev/dsk/c3t6d0
#vgdisplay -v vg00
确认根盘的8个LV,并且c3t6d0已经加入到vg00中了。
#mkboot -l /dev/dsk/c3t6d0
#lifls -l /dev/rdsk/c3t5d0
#lifls -l /dev/rdsk/c3t6d0
在c3t6d0上创建LIF,并对比两块硬盘的LIF信息一致性。

#for i in 1 2 3 4 5 6 7 8
>do
>lvextend -m 1 /dev/vg00/lvol$i /dev/dsk/c3t6d0
>done
The newly allocated mirrors are now being synchronized. This operation will
take some time. Please wait ....
Logical volume "/dev/vg00/lvol1" has been successfully extended.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
The newly allocated mirrors are now being synchronized. This operation will
take some time. Please wait ....
Logical volume "/dev/vg00/lvol2" has been successfully extended.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
The newly allocated mirrors are now being synchronized. This operation will
take some time. Please wait ....
Logical volume "/dev/vg00/lvol3" has been successfully extended.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
The newly allocated mirrors are now being synchronized. This operation will
take some time. Please wait ....
Logical volume "/dev/vg00/lvol4" has been successfully extended.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
The newly allocated mirrors are now being synchronized. This operation will
take some time. Please wait ....
Logical volume "/dev/vg00/lvol5" has been successfully extended.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
The newly allocated mirrors are now being synchronized. This operation will
take some time. Please wait ....
Logical volume "/dev/vg00/lvol6" has been successfully extended.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
The newly allocated mirrors are now being synchronized. This operation will
take some time. Please wait ....
Logical volume "/dev/vg00/lvol7" has been successfully extended.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
The newly allocated mirrors are now being synchronized. This operation will
take some time. Please wait ....
Logical volume "/dev/vg00/lvol8" has been successfully extended.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
#mkboot -a "hpux -lq(;0)/stand/vmunix" /dev/rdsk/c3t6d0
#lvlnboot -b /dev/vg00/lvol1
#lvlnboot -s /dev/vg00/lvol2
#lvlnboot -r /dev/vg00/lvol3
#lvlnboot -d /dev/vg00/lvol2
#setboot -p 10/0/15/1.6.0
#setboot -a 10/0/15/1.5.0   
至此根盘的Mirror工作完成,经过多次重新启动,多次更改setboot引导顺序后确认
Mirror没有问题。
接下来关机下电,拔掉c3t6d0这块硬盘,启动机器可看到报错信息,仍能够启动系统。
登录后vgdisplay也显示报错信息   
# vgdisplay
vgdisplay: Warning: couldn't query physical volume "/dev/dsk/c3t6d0":
The specified path does not correspond to physical volume attached to
this volume group
vgdisplay: Warning: couldn't query all of the physical volumes.
--- Volume groups ---
VG Name                     /dev/vg00
VG Write Access             read/write   
VG Status                   available               
Max LV                      255   
Cur LV                      8      
Open LV                     8      
Max PV                      16   
Cur PV                      2      
Act PV                      1      
Max PE per PV               4350         
VGDA                        2   
PE Size (Mbytes)            4               
Total PE                  4340   
Alloc PE                  3124   
Free PE                     1216   
Total PVG                   0      
Total Spare PVs             0            
Total Spare PVs in use      0
由于已经不存在c3t6d0硬盘或是这块硬盘已经故障不再有数据信息,这里就不能再使
用lvreduce -m 0 /dev/vg00/lvol1 /dev/dsk/c3t6d0等命令来取消c3t6d0上的Mirror信息
了,这里HP提供一个pv_key方试来取消Mirror,具体每个LV的信息里包括了pv_key,可以
通过下面命令查看
# lvdisplay -kv /dev/vg00/lvol1
lvdisplay: Warning: couldn't query physical volume "/dev/dsk/c3t6d0":
The specified path does not correspond to physical volume attached to
this volume group
lvdisplay: Warning: couldn't query all of the physical volumes.
--- Logical volumes ---
LV Name                     /dev/vg00/lvol1
VG Name                     /dev/vg00
LV Permission               read/write   
LV Status                   available/stale         
Mirror copies               1            
Consistency Recovery      MWC               
Schedule                  parallel   
LV Size (Mbytes)            300            
Current LE                  75      
Allocated PE                150         
Stripes                     0      
Stripe Size (Kbytes)      0                  
Bad block                   off         
Allocation                  strict/contiguous         
IO Timeout (Seconds)      default            
   --- Distribution of logical volume ---
   PV Name            LE on PVPE on PV
   /dev/dsk/c3t5d0    75      75      
   --- Logical extents ---
   LE    PV1                PE1   Status 1 PV2                PE2   Status 2
   00000      0             00000 stale         1             00000 current
   00001      0             00001 stale         1             00001 current
   00002      0             00002 stale         1             00002 current
   00003      0             00003 stale         1             00003 current
......   ......
可以看到PV1的pv_key=0 而其PV的状态已经stale了,那么我们需要去掉这个PV在
VG00中的信息。下面这个命令增加了一个-k参数,最后一个0表示PV1的pv_key,用它代替了
c3t6d0这块硬盘。
# lvreduce -k -m 0 /dev/vg00/lvol1 0
Logical volume "/dev/vg00/lvol1" has been successfully reduced.
lvlnboot: Warning: couldn't query physical volume "/dev/dsk/c3t6d0":
The specified path does not correspond to physical volume attached to
this volume group
lvlnboot: Warning: couldn't query all of the physical volumes.
vgcfgbackup: Warning: couldn't query physical volume "/dev/dsk/c3t6d0":
The specified path does not correspond to physical volume attached to
this volume group
vgcfgbackup: Warning: couldn't query all of the physical volumes.
vgcfgbackup: Couldn't query physical volume "/dev/dsk/c3t6d0":
The specified path does not correspond to physical volume attached to
this volume group
vgcfgbackup: Couldn't query physical volume "/dev/dsk/c3t6d0":
The specified path does not correspond to physical volume attached to
this volume group                              
将lvol1清理完成后再用lvdisplay看到如下正常信息。

# lvdisplay -kv /dev/vg00/lvol1|more
lvdisplay: Warning: couldn't query physical volume "/dev/dsk/c3t6d0":
The specified path does not correspond to physical volume attached to
this volume group
lvdisplay: Warning: couldn't query all of the physical volumes.
--- Logical volumes ---
LV Name                     /dev/vg00/lvol1
VG Name                     /dev/vg00
LV Permission               read/write   
LV Status                   available/syncd         
Mirror copies               0            
Consistency Recovery      MWC               
Schedule                  parallel   
LV Size (Mbytes)            300            
Current LE                  75      
Allocated PE                75         
Stripes                     0      
Stripe Size (Kbytes)      0                  
Bad block                   off         
Allocation                  strict/contiguous         
IO Timeout (Seconds)      default            
   --- Distribution of logical volume ---
   PV Name            LE on PVPE on PV
   /dev/dsk/c3t5d0    75      75      
   --- Logical extents ---
   LE    PV1                PE1   Status 1
   00000      1             00000 current
   00001      1             00001 current
   00002      1             00002 current
   00003      1             00003 current   
......   ......
这里仍有报错信息,这是由于c3t6d0仍在vg00这个卷组中有信息,后面再处理,现在先
在剩下的7个LV中用上面的pv_key的方法一一去掉c3t6d0的信息。完成后现在要将c3t6d0在vg00
里的信息删掉,即从vg00中用vgreduce命令删掉c3t6d0这个PV。
# vgreduce -f vg00
vgreduce: Couldn't query physical volume "/dev/dsk/c3t6d0":
The specified path does not correspond to physical volume attached to
this volume group
PV with key 0 sucessfully deleted from vg vg00
Repair done, please do the following steps.....:
1.save /etc/lvmtab to another file
2.remove /etc/lvmtab
3.use vgscan(1m) -v to re-create /etc/lvmtab
4.NOW use vgcfgbackup(1m) to save the LVM setup
这里vgreduce命令给出了四个清理LVM文件的步骤,按这个步骤一一完成就行。

# cp /etc/lvmtab /etc/lvmtab.bck
# rm -f /etc/lvmtab
# vgscan -v
Creating "/etc/lvmtab".
vgscan: Couldn't access the list of physical volumes for volume group "/dev/vg00".
Physical Volume "/dev/dsk/c0t0d0" contains no LVM information
/dev/vg00
/dev/dsk/c3t5d0
Scan of Physical Volumes Complete.
#vgcfgbackup
#setboot -p 10/0/15/1.5.0
#setboot -a 10/0/15/1.5.0
至此,全部完成了Mirror的清理工作,重新启动系统,vgdisplay,lvdisplay等命令已经不再
有报错信息了,完成了全部测试工作。
总结:
在线清除故障根盘的Mirror信息步骤如下
1、用下面的命令确认故障硬盘的pv_key
      lvdisplay -kv /dev/vg00/lvol1
      ......
      lvdisplay -kv /dev/vg00/lvol8
2、用pv_key的方试去掉LV中的故障硬盘的Mirror信息
      for i in 1 2 3 4 5 6 7 8
      do
      lvreduce -k -m 0 /dev/vg00/lvol$i 0      --最后那个0是上面确认的pv_key的值
      done
3、vgreduce -f /dev/vg00
4、cp /etc/lvmtab /etc/lvmtab.bck
5、rm -f /etc/lvmtab
6、vgscan -v
7、vgcfgbackup
8、setboot -p


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/4005/showart_349599.html
页: [1]
查看完整版本: HPUX v11.11 在线去掉坏的Mirror根盘测试