适用范围:
主机本地至少有两个磁盘,其中操作系统安装在一块硬盘上,另一块硬盘目前未使用,并且没有使用的硬盘的容量必须等于或者大于已经安装了操作系统的那块磁盘。为了提高主机的安全性,避免因本地磁盘上只使用一块磁盘装操作系统存在的单点故障导致机器宕机的危险,可以使用根盘镜像配置的方法消除主机的磁盘单点故障
主要操作步骤:
1, 查看主机的本地磁盘
#ioscan –knfCdisk
Class I H/W Path Driver S/W State H/W Type Description
=======================================================================
disk 1 0/0/2/0.6.0 sdisk CLAIMED DEVICE COMPAQ BF03687B54
/dev/dsk/c1t6d0 /dev/rdsk/c1t6d0
disk 0 0/0/2/1.6.0 sdisk CLAIMED DEVICE COMPAQ BF03687B54
/dev/dsk/c2t6d0 /dev/rdsk/c2t6d0
2, 查看本地磁盘使用情况
#pvdisplay /dev/dsk/c1t6d0
--- Physical volumes ---
PV Name /dev/dsk/c1t6d0
VG Name /dev/vg00
PV Status available
Allocatable yes
VGDA 2
Cur LV 10
PE Size (Mbytes) 16
Total PE 2170
Free PE 147
Allocated PE 2023
Stale PE 0
IO Timeout (Seconds) default
Autoswitch On
#pvdisplay /dev/dsk/c2t6d0
pvdisplay: Couldn't find the volume group to which physical volume "/dev/dsk/c2t6d0" belongs.
pvdisplay: Cannot display physical volume "/dev/dsk/c2t6d0".
从上述信息中可以知道:第一块磁盘(/dev/dsk/c1t6d0)已经被vg00使用,而第二磁盘(/dev/dsk/c2t6d0)未被使用
3, 查看vg00中包含的lv
#vgdisplay –v vg00
--- Volume groups ---
VG Name /dev/vg00
VG Write Access read/write
VG Status available
Max LV 255
Cur LV 10
Open LV 10
Max PV 16
Cur PV 1
Act PV 1
Max PE per PV 4384
VGDA 2
PE Size (Mbytes) 16
Total PE 2170
Alloc PE 2023
Free PE 147
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) 512
Current LE 32
Allocated PE 32
Used PV 1
LV Name /dev/vg00/lvol2
LV Status available/syncd
LV Size (Mbytes) 2048
Current LE 128
Allocated PE 128
Used PV 1
LV Name /dev/vg00/lvol3
LV Status available/syncd
LV Size (Mbytes) 1024
Current LE 64
Allocated PE 64
Used PV 1
LV Name /dev/vg00/lvol4
LV Status available/syncd
LV Size (Mbytes) 512
Current LE 32
Allocated PE 32
Used PV 1
LV Name /dev/vg00/lvol5
LV Status available/syncd
LV Size (Mbytes) 1024
Current LE 64
Allocated PE 64
Used PV 1
LV Name /dev/vg00/lvol6
LV Status available/syncd
LV Size (Mbytes) 4096
Current LE 256
Allocated PE 256
Used PV 1
LV Name /dev/vg00/lvol7
LV Status available/syncd
LV Size (Mbytes) 2048
Current LE 128
Allocated PE 128
Used PV 1
LV Name /dev/vg00/lvol8
LV Status available/syncd
LV Size (Mbytes) 4096
Current LE 256
Allocated PE 256
Used PV 1
LV Name /dev/vg00/oracle
LV Status available/syncd
LV Size (Mbytes) 8000
Current LE 500
Allocated PE 500
Used PV 1
LV Name /dev/vg00/sybase
LV Status available/syncd
LV Size (Mbytes) 9008
Current LE 563
Allocated PE 563
Used PV 1
--- Physical volumes ---
PV Name /dev/dsk/c1t6d0
PV Status available
Total PE 2170
Free PE 147
Autoswitch On
从上面的输出中得知:vg00包含以下lv,分别是lvol1、lvol2、lvol3、lvol4、lvol5、lvol6、lvol7、lvol8、oracle、sybase。因此在镜像时,这些lv都需要镜像。
4, 格式化第二块磁盘
#pvcreate -B /dev/rdsk/c2t6d0
参数-B的作用是将该磁盘格式化为可启动磁盘
注意:此处必须使用块设备
5, 将第二块磁盘加入vg00
#vgextend vg00 /dev/dsk/c2t6d0
6, 给新磁盘写入LIF header和LIF文件(ISL,AUTO,HPUX,LABEL)
#mkboot –l /dev/rdsk/c2t6d0
7, 查看给新磁盘写入的LIF header和LIF文件,确保写入正确
#lifls –l /dev/rdsk/c2t6d0
volume c2t6d0 data size 7984 directory size 8 07/08/08 12:44:39
filename type start size implement created
===============================================================
ISL -12800 584 306 0 02/05/10 16:25:44
AUTO -12289 896 1 0 02/05/10 16:25:44
HPUX -12928 904 848 0 02/05/10 16:25:44
PAD -12290 1752 1580 0 02/05/10 16:25:45
LABEL BIN 3336 8 0 07/08/10 17:19:04
8, 将vg00中的所有lv复制到一份到第二块磁盘上
#for lvol in lvol1 lvol2 lvol3 lvol4 lvol5 lvol6 lvol7 lvol8 oracle sybase
>do
>lvextend –m 1 /dev/vg00/$lvol /dev/dsk/c2t6d0
>done
此过程需要一段时间完成,需要耐心等待完成后再操作下一步
9, 给两个磁盘的AUTO文件写入新的内容
#mkboot –a‘hpux–lq’ /dev/rdsk/c1t6d0
#mkboot –a‘hpux–lq’ /dev/rdsk/c2t6d0
hpux –lq意为:autoboot without qurom enforced
10, 查看给两个磁盘的AUTO文件写入新的内容是否正确
#lifcp /dev/rdsk/c1t6d0:AUTO –
hpux -lq
#lifcp /dev/rdsk/c2t6d0:AUTO–
hpux–lq
11, 给LABELwen文件写入内容
#lvlnboot–b /dev/vg00/lvol1
#lvlnboot–r /dev/vg00/lvol3
#lvlnboot–s /dev/vg00/lvol2
#lvlnboot–d /dev/vg00/lvol2
12, 查看给LABEL文件写入内容是否正确
#lvlnboot -v
Boot Definitions for Volume Group /dev/vg00:
Physical Volumes belonging in Root Volume Group:
/dev/dsk/c1t6d0 (0/0/2/0.6.0) -- Boot Disk
/dev/dsk/c2t6d0 (0/0/2/1.6.0) -- Boot Disk
Boot: lvol1 on: /dev/dsk/c1t6d0
/dev/dsk/c2t6d0
Root: lvol3 on: /dev/dsk/c1t6d0
/dev/dsk/c2t6d0
Swap: lvol2 on: /dev/dsk/c1t6d0
/dev/dsk/c2t6d0
Dump: lvol2 on: /dev/dsk/c1t6d0, 0
13, 将第二块盘设置为从启动路径
#setboot–a0/0/2/1.6.0
14, 查看启动路径设置是否正确
#setboot
Primary bootpath : 0/0/2/0.6.0
Alternate bootpath : 0/0/2/1.6.0
Autoboot is ON (enabled)
Autosearch is ON (enabled)
15, 重新启动机器
#shutdown–r 0
16, 进入机器的bch,亦即10秒终端
出现To discontinue, press any key within 10 seconds.提示后按任意键
17, 从第二块硬盘启动,看机器是否可以启动正常
Boot terminated.
---- Main Menu ---------------------------------------------------------------
Command Description
------- -----------
BOot [PRI|ALT|<path>] Boot from specified path
PAth [PRI|ALT] [<path>] Display or modify a path
SEArch [DIsplay|IPL] [<path>] Search for boot devices
COnfiguration menu Displays or sets boot values
INformation menu Displays hardware information
SERvice menu Displays service commands
DIsplay Redisplay the current menu
HElp [<menu>|<command>] Display help for menu or command
RESET Restart the system
----
Main Menu: Enter command or menu > sea
Searching for potential boot device(s)
This may take several minutes.
To discontinue search, press any key (termination may not be immediate).
IODC
Path# Device Path (dec) Device Path (mnem) Device Type Rev
----- ----------------- ------------------ ----------- ----
P0 0/0/2/0.6 intscsia.6 Random access media 1
P1 0/0/2/1.6 intscsib.6 Random access media 1
P2 0/4/0/0.0 Random access media 6
P3 1/10/0/0.0 Random access media 6
Main Menu: Enter command or menu > bo p1
Interact with IPL (Y, N, or Cancel)?> n
Booting...
Boot IO Dependent Code (IODC) revision 1
HARD Booted.
。。。。。。。。。。。。。。。。。。。。
18, 检查vg00的所有lv是否都是synced,即同步,确保都是synced
--- Volume groups ---
VG Name /dev/vg00
VG Write Access read/write
VG Status available
Max LV 255
Cur LV 10
Open LV 10
Max PV 16
Cur PV 2
Act PV 2
Max PE per PV 4384
VGDA 4
PE Size (Mbytes) 16
Total PE 4340
Alloc PE 4046
Free PE 294
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) 512
Current LE 32
Allocated PE 64
Used PV 2
LV Name /dev/vg00/lvol2
LV Status available/syncd
LV Size (Mbytes) 2048
Current LE 128
Allocated PE 256
Used PV 2
LV Name /dev/vg00/lvol3
LV Status available/syncd
LV Size (Mbytes) 1024
Current LE 64
Allocated PE 128
Used PV 2
LV Name /dev/vg00/lvol4
LV Status available/syncd
LV Size (Mbytes) 512
Current LE 32
Allocated PE 64
Used PV 2
LV Name /dev/vg00/lvol5
LV Status available/syncd
LV Size (Mbytes) 1024
Current LE 64
Allocated PE 128
Used PV 2
LV Name /dev/vg00/lvol6
LV Status available/syncd
LV Size (Mbytes) 4096
Current LE 256
Allocated PE 512
Used PV 2
LV Name /dev/vg00/lvol7
LV Status available/syncd
LV Size (Mbytes) 2048
Current LE 128
Allocated PE 256
Used PV 2
LV Name /dev/vg00/lvol8
LV Status available/syncd
LV Size (Mbytes) 4096
Current LE 256
Allocated PE 512
Used PV 2
LV Name /dev/vg00/oracle
LV Status available/syncd
LV Size (Mbytes) 8000
Current LE 500
Allocated PE 1000
Used PV 2
LV Name /dev/vg00/sybase
LV Status available/syncd
LV Size (Mbytes) 9008
Current LE 563
Allocated PE 1126
Used PV 2
--- Physical volumes ---
PV Name /dev/dsk/c1t6d0
PV Status available
Total PE 2170
Free PE 147
Autoswitch On
PV Name /dev/dsk/c2t6d0
PV Status available
Total PE 2170
Free PE 147
Autoswitch On