Chinaunix首页 | 论坛 | 博客
  • 博客访问: 476082
  • 博文数量: 125
  • 博客积分: 3178
  • 博客等级: 中校
  • 技术积分: 1329
  • 用 户 组: 普通用户
  • 注册时间: 2006-04-19 08:20
文章分类

全部博文(125)

文章存档

2014年(2)

2013年(2)

2012年(3)

2011年(3)

2009年(2)

2008年(17)

2007年(52)

2006年(44)

我的朋友

分类: 其他UNIX

2013-11-18 12:00:53


思路:确认坏盘,去LV,减VG;换盘,扩VG,镜像同步,更新启动信息。

1、 用lvdisplay 和 ioscan确定哪块盘需要更换。
lvdisplay -v /dev/vg00/lvol* |grep stale  #查看哪块磁盘有坏块
ioscan -fnCdisk     #再次确认坏磁盘的设备文件名
2、摘镜象。
lvreduce -m 0 -A n /dev/vg00/lvol1 /dev/dsk/c2t1d0
lvreduce -m 0 -A n /dev/vg00/lvol2 /dev/dsk/c2t1d0
                                 .
                                 .
lvreduce -m 0 -A n /dev/vg00/lvol8 /dev/dsk/c2t1d0
坏盘所在vg里面所有的lv都要在这一步摘除,本次案例有13个lv,全部摘除。
*注意,摘除lv过程中lvreduce命令一分钟就执行完了,但是需要再等9分钟才能继续使用lvreduce,此时可以用kill命令杀死lvreduce进程。
hlrdb1:>#lvreduce -m 0 -A n /dev/vg00/lvol1 /dev/dsk/c2t1d0
Logical volume "/dev/vg00/lvol1" has been successfully reduced.   //这句出现之后就可以kill了
ps -ef|grep lvreduce
kill -9 xxxx
####当遇到无法摘除镜象时,使用强制法,如下:####
lvdisplay -v -k /dev/vg00/lvol1    #确认/dev/dsk/c2t1d0的pv_key=0(0和1代表的就是pv_key)
*******************************************************************
* testdb2#[]lvdisplay -v -k /dev/vg00/lvol1                              
* --- Logical volumes ---                                               
* LV Name                     /dev/vg00/lvol1                        
* VG Name                     /dev/vg00                            
* LV Permission               read/write                           
* LV Status                   available/syncd                      
* Mirror copies               1                                    
* Consistency Recovery        MWC                                  
* Schedule                    parallel                             
* LV Size (Mbytes)            304                                  
* Current LE                  38                                   
* Allocated PE                76                                   
* Stripes                     0                                    
* Stripe Size (Kbytes)        0                                    
* Bad block                   off                                  
* Allocation                  strict/contiguous                    
* IO Timeout (Seconds)        default                              
*                                                                  
*    --- Distribution of logical volume ---                        
*    PV Name            LE on PV  PE on PV                         
*    /dev/dsk/c2t2d0    38        38           #PV1                
*    /dev/dsk/c2t1d0    38        38           #PV2                
*                                                                  
*    --- Logical extents ---                                       
*    LE    PV1          PE1   Status 1 PV2          PE2   Status 2 
*    00000      0       00000 current       1       01930 current  
*******************************************************************


强制摘除镜象的命令:
lvreduce -k -m 0 /dev/vg00/lvol1 0
lvreduce -k -m 0 /dev/vg00/lvol2 0
                       .   
                       .   
lvreduce -k -m 0 /dev/vg00/lvol8 0             #lvol1---lvol8
建议通常都使用强制摘除镜象,避免鬼盘。


3、踢盘
vgreduce /dev/vg00 /dev/dsk/c2t1d0
vgreduce -f /dev/vg00   #强制把/dev/dsk/c2t1d0从vg00
################################################
# 补充一个确定坏盘的命令:                     #
# dd  if=/dev/dsk/c2t1d0   of=/dev/null  bs=256k   #
# 观察哪块硬盘指示灯常亮即为坏硬盘             #
*本次实操中dd命令又是hang住的,没有办法确定哪块是坏盘。。。后来在官方手册中找到曙光,根据坏盘路径确定是上面那块硬盘。
 


################################################


4、换盘,比如新盘认到的设备文件名为/dev/dsk/c2t1d0
pvcreate -fB /dev/rdsk/c2t1d0 
vgextend /dev/vg00 /dev/dsk/c2t1d0
mkboot -l /dev/rdsk/c2t1d0
mkboot -a "hpux -lq(;0)/stand/vmunix" /dev/rdsk/c2t1d0


5、将根盘卷中所有lv都镜像到新建立的可启动盘上。
(注意:首先镜像lvol1) 
lvextend -m 1 /dev/vg00/lvol1 /dev/dsk/c2t1d0
lvextend -m 1 /dev/vg00/lvol2 /dev/dsk/c2t1d0
                             .   
                             .   
lvextend -m 1 /dev/vg00/lvol8 /dev/dsk/c2t1d0   #lvol1---lvol8 
*此处lvextend需要等当前lv同步完才能镜像下一个lv,同步时间根据lv的大小不等。
6、更新BDRA 信息。
lvlnboot -b /dev/vg00/lvol1
lvlnboot -v -r /dev/vg00/lvol3
lvlnboot -s /dev/vg00/lvol2 
lvlnboot -d /dev/vg00/lvol2


7、确认以上信息是否都正确建立。
lvlnboot -R /dev/vg00 
lvlnboot -v 
setboot -v


可以使用脚本:


# vi mirrodisk.sh

"mirrodisk.sh" [New file]

#!/bin/sh

pvcreate -Bf /dev/rdsk/c2t1d0

vgextend /dev/vg00 /dev/dsk/c2t1d0

mkboot -l /dev/rdsk/c2t1d0

mkboot -a "hpux -lq(;0)/stand/vmunix" /dev/rdsk/c2t1d0

lvextend -m 1 /dev/vg00/lvol1 /dev/dsk/c2t0d0

lvextend -m 1 /dev/vg00/lvol2 /dev/dsk/c2t0d0

lvextend -m 1 /dev/vg00/lvol3 /dev/dsk/c2t0d0

lvextend -m 1 /dev/vg00/lvol4 /dev/dsk/c2t0d0

lvextend -m 1 /dev/vg00/lvol5 /dev/dsk/c2t0d0

lvextend -m 1 /dev/vg00/lvol6 /dev/dsk/c2t0d0

lvextend -m 1 /dev/vg00/lvol7 /dev/dsk/c2t0d0

lvextend -m 1 /dev/vg00/lvol8 /dev/dsk/c2t0d0

lvextend –m 1 /dev/vg00/lvolX /dev/dsk/c2t0d0

lvlnboot -b /dev/vg00/lvol1

lvlnboot -r /dev/vg00/lvol3

lvlnboot -s /dev/vg00/lvol2

lvlnboot -d /dev/vg00/lvol2

lvlnboot -R /dev/vg00

setboot –p /dev/dsk/c2t1d0


            # ./mirrordisk.sh
   
    检查:

            # ioscan –fnC disk

            # vgdisplay –v vg00

            # lvdisplay –v /dev/vg00/lvolx

            # setboot


如果在DAS上的硬盘
需要使用一个特殊的命令scsimgr,重启发现硬盘通道

插入新硬盘,并识别检查新硬盘状态(HPUX11.23HPUX11.11)

# dmesg

# insf –e

# ioscan –fnC disk

插入新硬盘,并识别检查新硬盘状态(HPUX11.31)

# dmesg

# scsimgr scsimgr replace_wwid –C lunpath –I XX

# insf –e

# ioscan –fnC disk






阅读(1923) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~