Oracle Solaris ZFS 管理指南

解决缺少设备的问题

如果设备无法打开,则它在 zpool status 输出中显示为 UNAVAIL状态。此状态表示在首次访问池时 ZFS 无法打开设备,或者设备自那时以来已变得不可用。如果设备导致顶层虚拟设备不可用,则无法访问池中的任何内容。此外,池的容错能力可能已受到损害。无论哪种情况,只需要将设备重新附加到系统即可恢复正常操作。

例如,设备出现故障后,可能会在 fmd 的输出中看到与以下内容类似的消息:


SUNW-MSG-ID: ZFS-8000-FD, TYPE: Fault, VER: 1, SEVERITY: Major
EVENT-TIME: Thu Jun 24 10:42:36 PDT 2010
PLATFORM: SUNW,Sun-Fire-T200, CSN: -, HOSTNAME: neo2
SOURCE: zfs-diagnosis, REV: 1.0
EVENT-ID: a1fb66d0-cc51-cd14-a835-961c15696fcb
DESC: The number of I/O errors associated with a ZFS device exceeded
acceptable levels.  Refer to http://sun.com/msg/ZFS-8000-FD for more information.
AUTO-RESPONSE: The device has been offlined and marked as faulted.  An attempt
will be made to activate a hot spare if available. 
IMPACT: Fault tolerance of the pool may be compromised.
REC-ACTION: Run 'zpool status -x' and replace the bad device.

要查看有关设备问题和解决办法的更详细信息,请使用 zpool status -x 命令。例如:


# zpool status -x
  pool: tank
 state: DEGRADED
status: One or more devices could not be opened.  Sufficient replicas exist for
        the pool to continue functioning in a degraded state.
action: Attach the missing device and online it using 'zpool online'.
   see: http://www.sun.com/msg/ZFS-8000-2Q
 scrub: scrub completed after 0h0m with 0 errors on Tue Feb  2 13:15:20 2010
config:

        NAME        STATE     READ WRITE CKSUM
        tank        DEGRADED     0     0     0
          mirror-0  DEGRADED     0     0     0
            c1t0d0  ONLINE       0     0     0
            c1t1d0  UNAVAIL      0     0     0  cannot open

errors: No known data errors

从此输出中可以看到,缺少的设备 c1t1d0 不起作用。如果您确定该设备有问题,请予以替换。

然后,使用 zpool online 命令将替换的设备联机。例如:


# zpool online tank c1t1d0

最后一步是确认设备更换后的池正常运行。例如:


# zpool status -x tank
pool 'tank' is healthy

以物理方式重新附加设备

重新附加缺少的设备的具体方式取决于相关设备。如果设备是网络连接驱动器,则应该恢复与网络的连接。如果设备是 USB 设备或其他可移除介质,则应该将它重新附加到系统。如果设备是本地磁盘,则控制器可能已出现故障,以致设备对于系统不再可见。在这种情况下,应该替换控制器,以使磁盘重新可用。可能存在其他问题,具体取决于硬件的类型及其配置。如果驱动器出现故障,且对系统不再可见,则应该将该设备视为损坏的设备。按照更换或修复损坏的设备中概述的过程进行操作。

将设备可用性通知 ZFS

将设备重新附加到系统后,ZFS 可能会也可能不会自动检测其可用性。如果池以前是有故障的,或者在附加过程中重新引导了系统,则 ZFS 在尝试打开池时会自动地重新扫描所有驱动器。如果在系统运行时池的性能降低且设备已替换,则必须通知 ZFS 设备现在是可用的并可以使用 zpool online 命令重新打开。例如:


# zpool online tank c0t1d0

有关使设备联机的更多信息,请参见使设备联机