硬件环境:1×E450(3×36GB disk)
软件环境:Solaris 9,Vxvm 3.5
1.由于我的环境中的根盘是好的,可能会与实际环境不同,在这里特别指出,但是方法一样!
root@sun # vxdisk list
DEVICE TYPE DISK GROUP STATUS
c0t0d0s2 sliced rootdisk rootdg online(实际中此个盘坏了,报failed)
c0t1d0s2 sliced rootmirr rootdg online
root@sun # format
Searching for disks...done
AVAILABLE DISK SELECTIONS:
0. c0t0d0 (这个是正常状态,坏盘后可能会有出入)
/pci@1f,4000/scsi@3/sd@0,0
1. c0t1d0
/pci@1f,4000/scsi@3/sd@1,0
Specify disk (enter its number): ^D
root@sun # vxprint -ht
Disk group: rootdg
DG NAME NCONFIG NLOG MINORS GROUP-ID
DM NAME DEVICE TYPE PRIVLEN PUBLEN STATE
RV NAME RLINK_CNT KSTATE STATE PRIMARY DATAVOLS SRL
RL NAME RVG KSTATE STATE REM_HOST REM_DG REM_RLNK
V NAME RVG KSTATE STATE LENGTH READPOL PREFPLEX UTYPE
PL NAME VOLUME KSTATE STATE LENGTH LAYOUT NCOL/WID MODE
SD NAME PLEX DISK DISKOFFS LENGTH [COL/]OFF DEVICE MODE
SV NAME PLEX VOLNAME NVOLLAYR LENGTH [COL/]OFF AM/NM MODE
DC NAME PARENTVOL LOGVOL
SP NAME SNAPVOL DCO
dg rootdg default default 0 1164968519.1025.sun
dm rootdisk c0t0d0s2 sliced 2888 71124291 -
dm rootmirr c0t1d0s2 sliced 2888 71124291 -
v rootvol - ENABLED ACTIVE 20480121 ROUND - root
pl rootvol-01 rootvol ENABLED ACTIVE 20480121 CONCAT - RW
(实际坏了盘的话,这里应该是DISABLE NODISK,或DISABLE REMOVE)sd rootdisk-02 rootvol-01 rootdisk 50644170 20480121 0 c0t0d0 ENA
pl rootvol-02 rootvol ENABLED ACTIVE 20480121 CONCAT - RW
sd rootmirr-02 rootvol-02 rootmirr 4191939 20480121 0 c0t1d0 ENA
v swapvol - ENABLED ACTIVE 4191939 ROUND - swap
pl swapvol-01 swapvol ENABLED ACTIVE 4191939 CONCAT - RW(实际坏了盘的话,这里应该是DISABLE NODISK,或DISABLE REMOVE)
sd rootdisk-01 swapvol-01 rootdisk 0 4191939 0 c0t0d0 ENA
pl swapvol-02 swapvol ENABLED ACTIVE 4191939 CONCAT - RW
sd rootmirr-01 swapvol-02 rootmirr 0 4191939 0 c0t1d0 ENA
2.运行vxdiskadm命令,将坏了的根盘从vxvm里面REMOVE掉:
root@sun # vxdiskadm
Volume Manager Support Operations
Menu: VolumeManager/Disk
1 Add or initialize one or more disks
2 Encapsulate one or more disks
3 Remove a disk
4 Remove a disk for replacement
5 Replace a failed or removed disk
6 Mirror volumes on a disk
7 Move volumes from a disk
8 Enable access to (import) a disk group
9 Remove access to (deport) a disk group
10 Enable (online) a disk device
11 Disable (offline) a disk device
12 Mark a disk as a spare for a disk group
13 Turn off the spare flag on a disk
14 Unrelocate subdisks back to a disk
15 Exclude a disk from hot-relocation use
16 Make a disk available for hot-relocation use
17 Prevent multipathing/Suppress devices from VxVM's view
18 Allow multipathing/Unsuppress devices from VxVM's view
19 List currently suppressed/non-multipathed devices
20 Change the disk naming scheme
21 Get the newly connected/zoned disks in VxVM view
list List disk information
? Display help about menu
?? Display help about the menuing system
q Exit from menus
Select an operation to perform: 4
Remove a disk for replacement
Menu: VolumeManager/Disk/RemoveForReplace
Use this menu operation to remove a physical disk from a disk
group, while retaining the disk name. This changes the state
for the disk name to a "removed" disk. If there are any
initialized disks that are not part of a disk group, you will be
given the option of using one of these disks as a replacement.
Enter disk name [,list,q,?] list
Disk group: rootdg
DM NAME DEVICE TYPE PRIVLEN PUBLEN STATE
dm rootdisk c0t0d0s2 sliced 2888 71124291 -
dm rootmirr c0t1d0s2 sliced 2888 71124291 -
Enter disk name [,list,q,?] rootdisk
The following volumes will lose mirrors as a result of this
operation:
rootvol swapvol
No data on these volumes will be lost.
The requested operation is to remove disk rootdisk from disk group
rootdg. The disk name will be kept, along with any volumes using
the disk, allowing replacement of the disk.
Select "Replace a failed or removed disk" from the main menu
when you wish to replace the disk.
Continue with operation? [y,n,q,?] (default: y) y
Removal of disk rootdisk completed successfully.
Remove another disk? [y,n,q,?] (default: n) n
Volume Manager Support Operations
Menu: VolumeManager/Disk
1 Add or initialize one or more disks
2 Encapsulate one or more disks
3 Remove a disk
4 Remove a disk for replacement
5 Replace a failed or removed disk
6 Mirror volumes on a disk
7 Move volumes from a disk
8 Enable access to (import) a disk group
9 Remove access to (deport) a disk group
10 Enable (online) a disk device
11 Disable (offline) a disk device
12 Mark a disk as a spare for a disk group
13 Turn off the spare flag on a disk
14 Unrelocate subdisks back to a disk
15 Exclude a disk from hot-relocation use
16 Make a disk available for hot-relocation use
17 Prevent multipathing/Suppress devices from VxVM's view
18 Allow multipathing/Unsuppress devices from VxVM's view
19 List currently suppressed/non-multipathed devices
20 Change the disk naming scheme
21 Get the newly connected/zoned disks in VxVM view
list List disk information
? Display help about menu
?? Display help about the menuing system
q Exit from menus
Select an operation to perform: q
Goodbye.
3.查看一下状态:
root@sun # vxdisk list
DEVICE TYPE DISK GROUP STATUS
c0t1d0s2 sliced rootmirr rootdg online
- - rootdisk rootdg removed was:c0t0d0s2
root@sun # vxprint -ht
Disk group: rootdg
DG NAME NCONFIG NLOG MINORS GROUP-ID
DM NAME DEVICE TYPE PRIVLEN PUBLEN STATE
RV NAME RLINK_CNT KSTATE STATE PRIMARY DATAVOLS SRL
RL NAME RVG KSTATE STATE REM_HOST REM_DG REM_RLNK
V NAME RVG KSTATE STATE LENGTH READPOL PREFPLEX UTYPE
PL NAME VOLUME KSTATE STATE LENGTH LAYOUT NCOL/WID MODE
SD NAME PLEX DISK DISKOFFS LENGTH [COL/]OFF DEVICE MODE
SV NAME PLEX VOLNAME NVOLLAYR LENGTH [COL/]OFF AM/NM MODE
DC NAME PARENTVOL LOGVOL
SP NAME SNAPVOL DCO
dg rootdg default default 0 1164968519.1025.sun
dm rootdisk - - - - REMOVED
dm rootmirr c0t1d0s2 sliced 2888 71124291 -
v rootvol - ENABLED ACTIVE 20480121 ROUND - root
pl rootvol-01 rootvol DISABLED REMOVED 20480121 CONCAT - RW
sd rootdisk-02 rootvol-01 rootdisk 50644170 20480121 0 - RMOV
pl rootvol-02 rootvol ENABLED ACTIVE 20480121 CONCAT - RW
sd rootmirr-02 rootvol-02 rootmirr 4191939 20480121 0 c0t1d0 ENA
v swapvol - ENABLED ACTIVE 4191939 ROUND - swap
pl swapvol-01 swapvol DISABLED REMOVED 4191939 CONCAT - RW
sd rootdisk-01 swapvol-01 rootdisk 0 4191939 0 - RMOV
pl swapvol-02 swapvol ENABLED ACTIVE 4191939 CONCAT - RW
sd rootmirr-01 swapvol-02 rootmirr 0 4191939 0 c0t1d0 ENA
root@sun # cfgadm -al
Ap_Id Type Receptacle Occupant Condition
c0 scsi-bus connected configured unknown
c0::dsk/c0t0d0 disk connected configured unknown
c0::dsk/c0t1d0 disk connected configured unknown
c1 scsi-bus connected configured unknown
c1::dsk/c1t6d0 CD-ROM connected configured unknown
4.在此需要修改一下dump设备路径,将dump设备路径指向mirror盘,不然从设备树中删除根盘的时候会有问题:
root@sun # cfgadm -c unconfigure c0::dsk/c0t0d0
cfgadm: 部分系统忙,重试: 脱机失败:
Resource Information
------------------ -----------------------
/dev/dsk/c0t0d0s1 dump device (dedicated)
root@sun # dumpadm
Dump content: kernel pages
Dump device: /dev/dsk/c0t0d0s1 (dedicated)
Savecore directory: /var/crash/sun
Savecore enabled: 是
root@sun # dumpadm -d /dev/dsk/c0t1d0s1
Dump content: kernel pages
Dump device: /dev/dsk/c0t1d0s1 (dedicated)
Savecore directory: /var/crash/sun
Savecore enabled: 是
root@sun # cfgadm -al
Ap_Id Type Receptacle Occupant Condition
c0 scsi-bus connected configured unknown
c0::dsk/c0t0d0 disk connected unconfigured unknown
c0::dsk/c0t1d0 disk connected configured unknown
c1 scsi-bus connected configured unknown
c1::dsk/c1t6d0 CD-ROM connected configured unknown
root@sun # cfgadm -c unconfigure c0::dsk/c0t0d0
5.带好防静电手套,更换根盘;
6.重配根盘;
root@sun # cfgadm -c configure c0::dsk/c0t0d0
root@sun # cfgadm -al
Ap_Id Type Receptacle Occupant Condition
c0 scsi-bus connected configured unknown
c0::dsk/c0t0d0 disk connected configured unknown
c0::dsk/c0t1d0 disk connected configured unknown
c1 scsi-bus connected configured unknown
c1::dsk/c1t6d0 CD-ROM connected configured unknown
7.将根盘加入vxvm:
root@sun # vxdctl enable
root@sun # vxdisk list
DEVICE TYPE DISK GROUP STATUS
c0t0d0s2 sliced - - error
c0t1d0s2 sliced rootmirr rootdg online
- - rootdisk rootdg removed was:c0t0d0s2
root@sun # vxdisksetup -i c0t0d0
root@sun # vxdiskadm
Volume Manager Support Operations
Menu: VolumeManager/Disk
1 Add or initialize one or more disks
2 Encapsulate one or more disks
3 Remove a disk
4 Remove a disk for replacement
5 Replace a failed or removed disk
6 Mirror volumes on a disk
7 Move volumes from a disk
8 Enable access to (import) a disk group
9 Remove access to (deport) a disk group
10 Enable (online) a disk device
11 Disable (offline) a disk device
12 Mark a disk as a spare for a disk group
13 Turn off the spare flag on a disk
14 Unrelocate subdisks back to a disk
15 Exclude a disk from hot-relocation use
16 Make a disk available for hot-relocation use
17 Prevent multipathing/Suppress devices from VxVM's view
18 Allow multipathing/Unsuppress devices from VxVM's view
19 List currently suppressed/non-multipathed devices
20 Change the disk naming scheme
21 Get the newly connected/zoned disks in VxVM view
list List disk information
? Display help about menu
?? Display help about the menuing system
q Exit from menus
Select an operation to perform: 5
Replace a failed or removed disk
Menu: VolumeManager/Disk/ReplaceDisk
Use this menu operation to specify a replacement disk for a disk
that you removed with the "Remove a disk for replacement" menu
operation, or that failed during use. You will be prompted for
a disk name to replace and a disk device to use as a replacement.
You can choose an uninitialized disk, in which case the disk will
be initialized, or you can choose a disk that you have already
initialized using the Add or initialize a disk menu operation.
Select a removed or failed disk [,list,q,?] list
Disk group: rootdg
DM NAME DEVICE TYPE PRIVLEN PUBLEN STATE
dm rootdisk - - - - REMOVED
Select a removed or failed disk [,list,q,?] rootdisk
Select disk device to initialize [,list,q,?] list
DEVICE DISK GROUP STATUS
c0t0d0 - - online
c0t1d0 rootmirr rootdg online
Select disk device to initialize [,list,q,?] c0t0d0
The following disk device appears to have been initialized already.
The disk is currently available as a replacement disk.
Output format: [Device_Name]
c0t0d0
Use this device? [y,n,q,?] (default: y) y
The following disk you selected for use appears to already have
been initialized for the Volume Manager. If you are certain the
disk has already been initialized for the Volume Manager, then you
do not need to reinitialize the disk device.
Output format: [Device_Name]
c0t0d0
Reinitialize this device? [y,n,q,?] (default: y) y
The requested operation is to initialize disk device c0t0d0 and
to then use that device to replace the removed or failed disk
rootdisk in disk group rootdg.
Continue with operation? [y,n,q,?] (default: y) y
Use fastresync for plex synchronization? [y,n,q,?] (default: n) y
Replacement of disk rootdisk in group rootdg with disk device
c0t0d0 completed successfully.
Replace another disk? [y,n,q,?] (default: n) n
Volume Manager Support Operations
Menu: VolumeManager/Disk
1 Add or initialize one or more disks
2 Encapsulate one or more disks
3 Remove a disk
4 Remove a disk for replacement
5 Replace a failed or removed disk
6 Mirror volumes on a disk
7 Move volumes from a disk
8 Enable access to (import) a disk group
9 Remove access to (deport) a disk group
10 Enable (online) a disk device
11 Disable (offline) a disk device
12 Mark a disk as a spare for a disk group
13 Turn off the spare flag on a disk
14 Unrelocate subdisks back to a disk
15 Exclude a disk from hot-relocation use
16 Make a disk available for hot-relocation use
17 Prevent multipathing/Suppress devices from VxVM's view
18 Allow multipathing/Unsuppress devices from VxVM's view
19 List currently suppressed/non-multipathed devices
20 Change the disk naming scheme
21 Get the newly connected/zoned disks in VxVM view
list List disk information
? Display help about menu
?? Display help about the menuing system
q Exit from menus
Select an operation to perform: q
Goodbye.
root@sun #
root@sun #
root@sun # vxdisk list
DEVICE TYPE DISK GROUP STATUS
c0t0d0s2 sliced rootdisk rootdg online
c0t1d0s2 sliced rootmirr rootdg online 8.查看同步状态;
root@sun # vxtask list
TASKID PTID TYPE/STATE PCT PROGRESS
176 PARENT/R 0.00% 2/0(1) VXRECOVER rootdisk
177 177 ATCOPY/R 02.98% 0/20480121/610304 PLXATT rootvol rootvol-01
9.查看卷状态;
root@sun # vxprint -ht
Disk group: rootdg
DG NAME NCONFIG NLOG MINORS GROUP-ID
DM NAME DEVICE TYPE PRIVLEN PUBLEN STATE
RV NAME RLINK_CNT KSTATE STATE PRIMARY DATAVOLS SRL
RL NAME RVG KSTATE STATE REM_HOST REM_DG REM_RLNK
V NAME RVG KSTATE STATE LENGTH READPOL PREFPLEX UTYPE
PL NAME VOLUME KSTATE STATE LENGTH LAYOUT NCOL/WID MODE
SD NAME PLEX DISK DISKOFFS LENGTH [COL/]OFF DEVICE MODE
SV NAME PLEX VOLNAME NVOLLAYR LENGTH [COL/]OFF AM/NM MODE
DC NAME PARENTVOL LOGVOL
SP NAME SNAPVOL DCO
dg rootdg default default 0 1164968519.1025.sun
dm rootdisk c0t0d0s2 sliced 2888 71124291 -
dm rootmirr c0t1d0s2 sliced 2888 71124291 -
v rootvol - ENABLED ACTIVE 20480121 ROUND - root
pl rootvol-01 rootvol ENABLED ACTIVE 20480121 CONCAT - RW
sd rootdisk-02 rootvol-01 rootdisk 50644170 20480121 0 c0t0d0s2 ENA
pl rootvol-02 rootvol ENABLED ACTIVE 20480121 CONCAT - RW
sd rootmirr-02 rootvol-02 rootmirr 4191939 20480121 0 c0t1d0 ENA
v swapvol - ENABLED ACTIVE 4191939 ROUND - swap
pl swapvol-01 swapvol ENABLED ACTIVE 4191939 CONCAT - RW
sd rootdisk-01 swapvol-01 rootdisk 0 4191939 0 c0t0d0s2 ENA
pl swapvol-02 swapvol ENABLED ACTIVE 4191939 CONCAT - RW
sd rootmirr-01 swapvol-02 rootmirr 0 4191939 0 c0t1d0 ENA
10.将dump设备换回到根盘上:
root@sun # dumpadm -d /dev/dsk/c0t0d0s1
Dump content: kernel pages
Dump device: /dev/dsk/c0t0d0s1 (swap)
Savecore directory: /var/crash/sun
Savecore enabled: 是
如果卷状态如上说明换盘成功!
有时实际和我的环境还是有很大出入的,可能用vxdiskadm选4选5换不了,或是换了以后同步有问题等等,欢迎大家拍砖。。。。。