更换 VxVM 下的故障磁盘

在 VxVM 的情况下,如果磁盘组中的磁盘出现故障,我们可以在线更换它(如果它是镜像的)。
在 VxVM 下更换故障磁盘的过程非常简单。

现在,我在磁盘组“mydg”下有一个故障磁盘。
卷“myvol”是镜像的,因此数据在失败后将保持完整。
mydg的vxprint输出如下,显示其中一个plex处于DISABLED,NODEVICE状态

# vxprint -htg mydg
..........
dg mydg         default      default  5000     1382967597.23.onitroad
dm disk01       c1t2d0s2     auto     65536    2027168  
dm disk02       -            -        -        -        NODEVICE
v  myvol        -            ENABLED  ACTIVE   204800   SELECT    -        fsgen
pl myvol-01     myvol        ENABLED  ACTIVE   204800   CONCAT    -        RW
sd disk01-01    myvol-01     disk01   0        204800   0         c1t2d0   ENA
pl myvol-02     myvol        DISABLED NODEVICE 204800   CONCAT    -        WO
sd disk02-01    myvol-02     disk02   0        204800   0         -        NDEV

此外,如果我们看到 vxdisk 命令输出,我们将看到故障磁盘:

# vxdisk -eoalldgs list
DEVICE       TYPE           DISK        GROUP        STATUS               OS_NATIVE_NAME   ATTR
c1t0d0s2     auto:sliced    rootdisk     rootdg      online               c1t0d0s2         
c1t1d0s2     auto:sliced    rootmirror   rootdg      online               c1t1d0s2         
c1t2d0s2     auto:cdsdisk   disk01       mydg        online               c1t2d0s2         
c1t4d0s2     auto:cdsdisk   -            -           online               c1t4d0s2         
c1t5d0s2     auto:cdsdisk   -            -           online               c1t5d0s2         
c1t6d0s2     auto:cdsdisk   -            -           online               c1t6d0s2         
c1t8d0s2     auto:cdsdisk   -            -           online               c1t8d0s2         
-            -         disk02       mydg         failed was:c1t3d0s2

现在我们可以借助 vxdiskadm 命令直接更换故障磁盘。
选择选项 5 以更换故障磁盘

# vxdiskadm
Volume Manager Support Operations
Menu: VolumeManager/Disk
 ........ (other options removed for brevity)
 5      Replace a failed or removed disk
 .........
Select an operation to perform: 5

使用“list”选项列出VxVM 下的故障磁盘,并从磁盘组mydg 中选择故障磁盘disk02.
我们将不得不选择一个备用磁盘来更换故障磁盘。
在 VxVM 下,新磁盘 (c1t4d0) 将自动命名为 disk02.

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 [[disk], list,q,?] list
Disk group: rootdg
DM NAME         DEVICE       TYPE     PRIVLEN  PUBLEN   STATE

Disk group: mydg
DM NAME         DEVICE       TYPE     PRIVLEN  PUBLEN   STATE
dm disk02       -            -        -        -        NODEVICE

Select a removed or failed disk [[disk],list,q,?] disk02
  The following devices are available as replacements:
        c1t4d0 c1t5d0 c1t6d0 c1t8d0
  You can choose one of these devices to replace disk02.
  Choose "none" to abort the replacement of disk02.
Choose a device, or select none
[[device],none,q,?]  (default: c1t4d0)
  VxVM  INFO V-5-2-382
The requested operation is to use the initialized device c1t4d0
  to replace the removed or failed disk disk02 in disk group mydg.
Continue with operation? [y,n,q,?]  (default: y)

现在我们可以使用 FMR(快速镜像重新同步)来快速有效地重新同步旧镜像。

Use FMR for plex resync? [y,n,q,?]  (default: n) y
  VxVM  INFO V-5-2-282
Replacement of disk disk02 in group mydg with disk device
  c1t4d0 completed successfully.
Replace another disk? [y,n,q,?]  (default: n) n
日期:2020-09-17 00:15:30 来源:oir作者:oir