Chinaunix首页 | 论坛 | 博客
  • 博客访问: 652725
  • 博文数量: 70
  • 博客积分: 145
  • 博客等级: 入伍新兵
  • 技术积分: 1150
  • 用 户 组: 普通用户
  • 注册时间: 2012-10-11 08:15
个人简介

没有简介就是最好的简介

文章分类

全部博文(70)

文章存档

2020年(1)

2018年(2)

2017年(3)

2016年(11)

2015年(12)

2014年(16)

2013年(19)

2012年(6)

我的朋友

分类: 其他UNIX

2014-07-17 16:45:39

操作系统信息

# uname -a

HP-UX hostname B.11.11 U 9000/800 1462255580 unlimited-user license

一,故障信息预览

1,# strings /etc/lvmtab

/dev/vg00

/dev/dsk/c0t6d0

/dev/dsk/c2t6d0

2,# vgdisplay |more

vgdisplay: Warning: couldn't query physical volume "/dev/dsk/c2t6d0":

The specified path does not correspond to physical volume attached to

this volume group

vgdisplay: Warning: couldn't query all of the physical volumes.

vgdisplay: Volume group not activated.

vgdisplay: Cannot display volume group "/dev/vgdata".

vgdisplay: Volume group not activated.

vgdisplay: Cannot display volume group "/dev/vglock".

--- 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)            8              

Total PE                    4340   

Alloc PE                    4076   

Free PE                     264    

Total PVG                   0       

Total Spare PVs             0             

Total Spare PVs in use      0  

3,# ioscan -funCdisk

Class     I  H/W Path        Driver   S/W State   H/W Type     Description

===========================================================================

disk      0  0/0/0/2/0.6.0   sdisk    CLAIMED     DEVICE       HP 36.4GST336753LC

                            /dev/dsk/c0t6d0   /dev/rdsk/c0t6d0

disk      1  0/0/0/2/1.2.0   sdisk    CLAIMED     DEVICE       HP      DVD-ROM 305

                            /dev/dsk/c1t2d0   /dev/rdsk/c1t2d0

.

.

.

 

disk     18  1/0/0/2/0.6.0   sdisk    CLAIMED     DEVICE       HP 36.4GST336753LC

                            /dev/dsk/c10t6d0   /dev/rdsk/c10t6d0

disk     19  1/0/0/2/1.2.0   sdisk    CLAIMED     DEVICE       HP      DVD-ROM 305

                            /dev/dsk/c11t2d0   /dev/rdsk/c11t2d0

disk     20  1/0/0/3/0.6.0   sdisk    CLAIMED     DEVICE       HP 36.4GST336753LC

                            /dev/dsk/c12t6d0   /dev/rdsk/c12t6d0

 

从上面的输出中可以看出只有三块本地盘,出现故障的磁盘没有出现。

 

二,更换磁盘前的准备

1,  首先拆除镜像

# lvreduce -m 0 /dev/vg00/lvol1 /dev/dsk/c2t6d0

lvreduce: Warning: couldn't query physical volume "/dev/dsk/c2t6d0":

The specified path does not correspond to physical volume attached to this volume group

lvreduce: Warning: couldn't query all of the physical volumes.

lvreduce: Physical volume "/dev/dsk/c2t6d0" does not belongto volume group "/dev/vg00".

Logical volume "/dev/vg00/lvol1" is not reduced.

拆除镜像失败从报错可以看出系统已经识别不到/dev/dsk/c2t6d0这块磁盘

尝试强制降/dev/dsk/c2t6d0从卷组中拆除

# vgreduce vg00 /dev/dsk/c2t6d0

vgreduce: Couldn't query physical volume "/dev/dsk/c2t6d0":

The specified path does not correspond to physical volume attached to this volume group

Hp unix 对于已经不存在的磁盘或者磁盘已经故障不再有数据信息不能采用lvreduce 这个命令来取消/dev/dsk/c2t6d0这块磁盘上面的mirror信息了。Hp 提供了一个基于pv_key的方式来取消mirror,具体每个lv的信息里包含的pv_key可以用下面的命令查看。

 

# lvdisplay -kv /dev/vg00/lvol1

lvdisplay: Warning: couldn't query physical volume "/dev/dsk/c2t6d0":

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)            504            

Current LE                  63       

Allocated PE                126         

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/c0t6d0    63        63       

 

   --- Logical extents ---

   LE    PV1                PE1   Status 1 PV2                PE2   Status 2

   00000      0             00000 current       1             00000 stale   

   00001      0             00001 current       1             00001 stale   

   00002      0             00002 current       1             00002 stale   

   00003      0             00003 current       1             00003 stale   

   00004      0             00004 current       1             00004 stale   

   00005      0             00005 current       1             00005 stale   

   00006      0             00006 current       1             00006 stale   

   00007      0             00007 current       1             00007 stale   

   00008      0             00008 current       1             00008 stale   

   00009      0             00009 current       1             00009 stale   

   00010      0             00010 current       1             00010 stale   

   00011      0             00011 current       1             00011 stale   

   00012      0             00012 current       1             00012 stale   

   00013      0             00013 current       1             00013 stale   

   00014      0             00014 current       1             00014 stale   

 

可以看到pvpv_key=1,并且其中的pv状态已经变为stale状态了。那么我们需要去掉这个PVVG00中的信息。下面这个命令增加了一个-k参数,最后一个1表示PV2pv_key,用它代替了/dev/dsk/c2t6d0这块硬盘。

# lvreduce -k -m 0 /dev/vg00/lvol1 1

Logical volume "/dev/vg00/lvol1" has been successfully reduced.

lvlnboot: Warning: couldn't query physical volume "/dev/dsk/c2t6d0":

The specified path does not correspond to physical volume attached to

this volume group

lvlnboot: Warning: couldn't query all of the physical volumes.

lvlnboot: Warning: couldn't query physical volume "/dev/dsk/c2t6d0":

The specified path does not correspond to physical volume attached to

this volume group

lvlnboot: Warning: couldn't query all of the physical volumes.

lvlnboot: Warning: couldn't query physical volume "/dev/dsk/c2t6d0":

The specified path does not correspond to physical volume attached to

this volume group

lvlnboot: Warning: couldn't query all of the physical volumes.

lvlnboot: Warning: couldn't query physical volume "/dev/dsk/c2t6d0":

The specified path does not correspond to physical volume attached to

this volume group

lvlnboot: Warning: couldn't query all of the physical volumes.

lvlnboot: Warning: couldn't query physical volume "/dev/dsk/c2t6d0":

The specified path does not correspond to physical volume attached to

this volume group

lvlnboot: Warning: couldn't query all of the physical volumes.

Warning:  Can not determine all Physical Volumes on which mirrored copies of

the Logical Volume are located.   "/etc/lvmtab" is missing Physical Volumes.

lvlnboot: Warning: couldn't query physical volume "/dev/dsk/c2t6d0":

The specified path does not correspond to physical volume attached to

this volume group

lvlnboot: Warning: couldn't query all of the physical volumes.

Warning:  Can not determine all Physical Volumes on which mirrored copies of

the Logical Volume are located.   "/etc/lvmtab" is missing Physical Volumes.

lvlnboot: Warning: couldn't query physical volume "/dev/dsk/c2t6d0":

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/c2t6d0":

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/c2t6d0":

The specified path does not correspond to physical volume attached to

this volume group

vgcfgbackup: Couldn't query physical volume "/dev/dsk/c2t6d0":

The specified path does not correspond to physical volume attached to

this volume group

报错可以忽略,清理完成后查看lv的状态

# lvdisplay -kv /dev/vg00/lvol1|more

lvdisplay: Warning: couldn't query physical volume "/dev/dsk/c2t6d0":

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)            504            

Current LE                  63       

Allocated PE                63         

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/c0t6d0    63        63       

 

   --- Logical extents ---

   LE    PV1                PE1   Status 1

   00000      0             00000 current 

   00001      0             00001 current 

里面的报错信息说明/dev/dsk/c2t6d0这块找不到的磁盘依然存在在vg00中,但是lv已经去掉镜像了,按照相同的方法将剩余的7lv的镜像也拆除掉。

2,  剔除坏掉磁盘

当所有lv的镜像拆掉掉后,下面将坏掉的磁盘从vg00中剔除

# vgreduce -f vg00

PV with key 1 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信息的方法,按照步骤进行

2.1首先备份,然后删除

# cp /etc/lvmtab /etc/lvmtab.bak

# rm -f /etc/lvmtab

2.2重新扫描

# vgscan -v

Creating "/etc/lvmtab".

vgscan: Couldn't access the list of physical volumes for volume group "/dev/vg00".

vgscan: Couldn't access the list of physical volumes for volume group "/dev/vgora".

vgscan: Couldn't access the list of physical volumes for volume group "/dev/vglock".

vgscan: Couldn't access the list of physical volumes for volume group "/dev/vgdata".

Couldn't stat physical volume "/dev/dsk/c1t2d0":

Invalid argument

Physical Volume "/dev/dsk/c40t0d4" contains no LVM information

Physical Volume "/dev/dsk/c40t0d5" contains no LVM information

Physical Volume "/dev/dsk/c42t0d4" contains no LVM information

Physical Volume "/dev/dsk/c42t0d5" contains no LVM information

Couldn't stat physical volume "/dev/dsk/c11t2d0":

Invalid argument

Physical Volume "/dev/dsk/c44t0d4" contains no LVM information

Physical Volume "/dev/dsk/c44t0d5" contains no LVM information

Physical Volume "/dev/dsk/c46t0d4" contains no LVM information

Physical Volume "/dev/dsk/c46t0d5" contains no LVM information

 

 

/dev/vg00

/dev/dsk/c0t6d0

 

 

Following Physical Volumes belong to one Volume Group.

Unable to match these Physical Volumes to a Volume Group.

Use the vgimport command to complete the process.

/dev/dsk/c40t0d0

/dev/dsk/c40t0d1

/dev/dsk/c40t0d2

/dev/dsk/c40t0d3

/dev/dsk/c42t0d0

/dev/dsk/c42t0d1

/dev/dsk/c42t0d2

/dev/dsk/c42t0d3

/dev/dsk/c44t0d0

/dev/dsk/c44t0d1

/dev/dsk/c44t0d2

/dev/dsk/c44t0d3

/dev/dsk/c46t0d0

/dev/dsk/c46t0d1

/dev/dsk/c46t0d2

/dev/dsk/c46t0d3

 

Following Physical Volumes belong to one Volume Group.

Unable to match these Physical Volumes to a Volume Group.

Use the vgimport command to complete the process.

/dev/dsk/c40t0d6

/dev/dsk/c42t0d6

/dev/dsk/c44t0d6

/dev/dsk/c46t0d6

 

Following Physical Volumes belong to one Volume Group.

Unable to match these Physical Volumes to a Volume Group.

Use the vgimport command to complete the process.

/dev/dsk/c40t0d7

/dev/dsk/c42t0d7

/dev/dsk/c44t0d7

/dev/dsk/c46t0d7

 

 

/dev/vgora

/dev/dsk/c10t6d0

/dev/dsk/c12t6d0

 

 

The Volume Group /dev/vglock was not matched with any Physical Volumes.

The Volume Group /dev/vgdata was not matched with any Physical Volumes.

Scan of Physical Volumes Complete.

*** LVMTAB has been created successfully.

*** If PV links are configured in the system.

*** Do the following to resync information on disk.

*** #1.   vgchange -a y

*** #2.  lvlnboot -R

查看最后出来的结果

# strings /etc/lvmtab

/dev/vg00

/dev/dsk/c0t6d0

/dev/vgora

/dev/dsk/c10t6d0

/dev/dsk/c12t6d0

2.4 从新备份

# vgcfgbackup /dev/vg00

Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf

设置启动信息

# setboot -p 0/0/0/2/0.6.0

到这里坏盘的信息已经彻底清理干净,可以进行硬盘更换,拔出坏掉的磁盘,讲好的磁盘更换上。

可以使用dd命令来确定坏盘的槽位。

三,更换磁盘后的操作

首先使用下面的命令进行更新磁盘信息

# ioscan -fnCdisk

Class     I  H/W Path        Driver   S/W State   H/W Type     Description

===========================================================================

disk      0  0/0/0/2/0.6.0   sdisk    CLAIMED     DEVICE       HP 36.4GST336753LC

                            /dev/dsk/c0t6d0   /dev/rdsk/c0t6d0

disk      1  0/0/0/2/1.2.0   sdisk    CLAIMED     DEVICE       HP      DVD-ROM 305

                            /dev/dsk/c1t2d0   /dev/rdsk/c1t2d0

disk      2  0/0/0/3/0.6.0   sdisk    CLAIMED     DEVICE       HP 36.4GST336753LC

                            /dev/dsk/c2t6d0   /dev/rdsk/c2t6d0

.

.

.

disk     18  1/0/0/2/0.6.0   sdisk    CLAIMED     DEVICE       HP 36.4GST336753LC

                            /dev/dsk/c10t6d0   /dev/rdsk/c10t6d0

disk     19  1/0/0/2/1.2.0   sdisk    CLAIMED     DEVICE       HP      DVD-ROM 305

                            /dev/dsk/c11t2d0   /dev/rdsk/c11t2d0

disk     20  1/0/0/3/0.6.0   sdisk    CLAIMED     DEVICE       HP 36.4GST336753LC

                            /dev/dsk/c12t6d0   /dev/rdsk/c12t6d0

从命令输出中可以看出新更换的磁盘已经被系统识别到。

1,创建pv一定要加-B因为要做成启动盘

# pvcreate -B /dev/rdsk/c2t6d0

Physical volume "/dev/rdsk/c2t6d0" has been successfully created.

2,将磁盘增加到vg00

# vgextend /dev/vg00 /dev/dsk/c2t6d0

Volume group "/dev/vg00" has been successfully extended.

Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf

3,  增加后的效果

# vgdisplay -v vg00

--- 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                      2      

Max PE per PV               4350        

VGDA                        4  

PE Size (Mbytes)            8              

Total PE                    8680   

Alloc PE                    4076   

Free PE                     4604   

Total PVG                   0       

Total Spare PVs             0             

Total Spare PVs in use      0                    

 

   --- Logical volumes ---

   LV Name                     /dev/vg00/lvol1

   LV Status                   available/syncd          

   LV Size (Mbytes)            504            

   Current LE                  63       

   Allocated PE                63         

   Used PV                     1      

 

   LV Name                     /dev/vg00/lvol2

   LV Status                   available/syncd          

   LV Size (Mbytes)            16000          

   Current LE                  2000     

   Allocated PE                2000       

   Used PV                     1      

 

   LV Name                     /dev/vg00/lvol3

   LV Status                   available/syncd          

   LV Size (Mbytes)            1000           

   Current LE                  125      

   Allocated PE                125        

   Used PV                     1      

 

   LV Name                     /dev/vg00/lvol4

   LV Status                   available/syncd          

   LV Size (Mbytes)            4000           

   Current LE                  500      

   Allocated PE                500        

   Used PV                     1      

 

   LV Name                     /dev/vg00/lvol5

   LV Status                   available/syncd          

   LV Size (Mbytes)            4000            

   Current LE                  500      

   Allocated PE                500        

   Used PV                     1      

 

   LV Name                     /dev/vg00/lvol6

   LV Status                   available/syncd          

   LV Size (Mbytes)            2000           

   Current LE                  250      

   Allocated PE                250        

   Used PV                     1      

 

   LV Name                     /dev/vg00/lvol7

   LV Status                   available/syncd          

   LV Size (Mbytes)            504            

   Current LE                  63       

   Allocated PE                63         

   Used PV                     1      

 

   LV Name                     /dev/vg00/lvol8

   LV Status                   available/syncd          

   LV Size (Mbytes)            4600           

   Current LE                  575      

   Allocated PE                575        

   Used PV                     1      

 

 

   --- Physical volumes ---

   PV Name                     /dev/dsk/c0t6d0

   PV Status                   available               

   Total PE                    4340   

   Free PE                     264    

   Autoswitch                  On       

   Proactive Polling           On              

 

   PV Name                     /dev/dsk/c2t6d0

   PV Status                   available               

   Total PE                    4340   

   Free PE                     4340   

   Autoswitch                  On       

   Proactive Polling           On       

4,在/dev/dsk/c2t6d0上创建LIF并比较两块盘上的信息一致性

# mkboot -l /dev/dsk/c2t6d0

# lifls -l /dev/dsk/c2t6d0

# lifls -l /dev/dsk/c0t6d0

5,对lv作镜像

# for i in 1 2 3 4 5 6 7 8

> do

> lvextend -m 1 /dev/vg00/lvol$i /dev/dsk/c2t6d0

> 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/dsk/c2t6d0

# lvlnboot -b /dev/vg00/lvol1

Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf

# lvlnboot -s /dev/vg00/lvol2

Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf

# lvlnboot -r /dev/vg00/lvol3

Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf

# lvlnboot -d /dev/vg00/lvol2

Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf

# setboot -p 0/0/0/2/0.6.0

# setboot -a 0/0/0/3/0.6.0

至此硬盘更换及镜像已经完毕。


仅供参考学习,具体环境应具体分析对待。

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