在 Oracle® Solaris 11.2 中管理 ZFS 文件系统

退出打印视图

更新时间: 2014 年 12 月
 
 

解决缺少设备或设备被移除的问题

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

如果根池或镜像的根池中的某个设备状态为 UNAVAIL,请参见以下参考资料:

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

SUNW-MSG-ID: ZFS-8000-QJ, TYPE: Fault, VER: 1, SEVERITY: Minor
EVENT-TIME: Wed Jun 20 13:09:55 MDT 2012
PLATFORM: ORCL,SPARC-T3-4, CSN: 1120BDRCCD, HOSTNAME: tardis
SOURCE: zfs-diagnosis, REV: 1.0
EVENT-ID: e13312e0-be0a-439b-d7d3-cddaefe717b0
DESC: Outstanding dtls on ZFS device 'id1,sd@n5000c500335dc60f/a' in pool 'pond'.
AUTO-RESPONSE: No automated response will occur.
IMPACT: None at this time.
REC-ACTION: Use 'fmadm faulty' to provide a more detailed view of this event.
Run 'zpool status -lx' for more information. Please refer to the associated
reference document at http://support.oracle.com/msg/ZFS-8000-QJ for the latest
service procedures and policies regarding this diagnosis.

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

# zpool status -v
pool: pond
state: DEGRADED
status: One or more devices are unavailable in response to persistent errors.
Sufficient replicas exist for the pool to continue functioning in a
degraded state.
action: Determine if the device needs to be replaced, and clear the errors
using 'zpool clear' or 'fmadm repaired', or replace the device
with 'zpool replace'.
scan: scrub repaired 0 in 0h0m with 0 errors on Wed Jun 20 13:16:09 2012
config:

NAME                   STATE     READ WRITE CKSUM
pond                   DEGRADED     0     0     0
mirror-0               ONLINE       0     0     0
c0t5000C500335F95E3d0  ONLINE       0     0     0
c0t5000C500335F907Fd0  ONLINE       0     0     0
mirror-1               DEGRADED     0     0     0
c0t5000C500335BD117d0  ONLINE       0     0     0
c0t5000C500335DC60Fd0  UNAVAIL      0     0     0

device details:

c0t5000C500335DC60Fd0    UNAVAIL          cannot open
status: ZFS detected errors on this device.
The device was missing.
see: http://support.oracle.com/msg/ZFS-8000-LR for recovery

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

如有必要,可使用 zpool online 命令使替换的设备联机。例如:

# zpool online pond c0t5000C500335DC60Fd0

如果 fmadm faulty 的输出标识出设备错误,请让 FMA 知道该设备已被替换。例如:

# fmadm faulty
--------------- ------------------------------------  -------------- ---------
TIME            EVENT-ID                              MSG-ID         SEVERITY
--------------- ------------------------------------  -------------- ---------
Jun 20 13:15:41 3745f745-371c-c2d3-d940-93acbb881bd8  ZFS-8000-LR    Major

Problem Status    : solved
Diag Engine       : zfs-diagnosis / 1.0
System
Manufacturer  : unknown
Name          : ORCL,SPARC-T3-4
Part_Number   : unknown
Serial_Number : 1120BDRCCD
Host_ID       : 84a02d28

----------------------------------------
Suspect 1 of 1 :
Fault class : fault.fs.zfs.open_failed
Certainty   : 100%
Affects     : zfs://pool=86124fa573cad84e/
  vdev=25d36cd46e0a7f49/pool_name=pond/
  vdev_name=id1,sd@n5000c500335dc60f/a
Status      : faulted and taken out of service

FRU
Name             : "zfs://pool=86124fa573cad84e/
vdev=25d36cd46e0a7f49/pool_name=pond/
vdev_name=id1,sd@n5000c500335dc60f/a"
Status        : faulty

Description : ZFS device 'id1,sd@n5000c500335dc60f/a' 
in pool 'pond' failed to open.

Response    : An attempt will be made to activate a hot spare if available.

Impact      : Fault tolerance of the pool may be compromised.

Action      : Use 'fmadm faulty' to provide a more detailed view of this event.
Run 'zpool status -lx' for more information. Please refer to the
associated reference document at
http://support.oracle.com/msg/ZFS-8000-LR for the latest service
procedures and policies regarding this diagnosis.

摘取 fmadm faulty 命令输出中 Affects: 部分的字符串,并将其包含在以下命令中,以便通知 FMA 该设备已替换:

# fmadm repaired zfs://pool=86124fa573cad84e/ \
   vdev=25d36cd46e0a7f49/pool_name=pond/ \
   vdev_name=id1,sd@n5000c500335dc60f/a
fmadm: recorded repair to of zfs://pool=86124fa573cad84e/
   vdev=25d36cd46e0a7f49/pool_name=pond/vdev_
name=id1,sd@n5000c500335dc60f/a

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

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

解决设备被移除的问题

如果某个设备已从系统中彻底删除,则 ZFS 会检测到该设备无法打开,并将其置于 REMOVED 状态。这一删除可能会导致整个池变得不可用,但也可能不会,具体取决于池的数据复制级别。如果镜像设备或 RAID-Z 设备中的一个磁盘被删除,仍可以继续访问池。在下列情况下,池可能会变为 UNAVAIL(即无法访问数据,除非重新附加设备):

如果意外移除并重新插入了冗余存储池设备,那么大多数情况下您只需清除设备错误即可。例如:

# zpool clear tank c1t1d0

以物理方式重新附加设备

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

如果设备连接受到损害,池可能变为 SUSPENDED 状态。在设备问题得到解决之前,SUSPENDED 池一直处于 wait 状态。例如:

# zpool status cybermen
pool: cybermen
state: SUSPENDED
status: One or more devices are unavailable in response to IO failures.
The pool is suspended.
action: Make sure the affected devices are connected, then run 'zpool clear' or
'fmadm repaired'.
Run 'zpool status -v' to see device specific details.
see: http://support.oracle.com/msg/ZFS-8000-HC
scan: none requested
config:

NAME       STATE     READ WRITE CKSUM
cybermen   UNAVAIL      0    16     0
c8t3d0     UNAVAIL      0     0     0
c8t1d0     UNAVAIL      0     0     0

当设备连接恢复后,请清除池或设备错误。

# zpool clear cybermen
# fmadm repaired zfs://pool=name/vdev=guid

将设备可用性通知 ZFS

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

# zpool online tank c0t1d0

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