解决 ZFS 存储设备问题
请查看以下各节来解决缺少设备、设备被移除或发生故障等问题。
解决缺少设备或设备被移除的问题
如果设备无法打开,则它在 zpool status 输出中显示为 UNAVAIL状态。此状态表示在首次访问池时 ZFS 无法打开设备,或者设备自那时以来已变得不可用。如果设备导致顶层虚拟设备不可用,则无法访问池中的任何内容。此外,池的容错能力可能已受到损害。无论哪种情况,只需要将设备重新附加到系统即可恢复正常操作。如果需要替换因发生故障而处于 UNAVAIL 状态的设备,请参见替换 ZFS 存储池中的设备。
如果根池或镜像的根池中的某个设备状态为 UNAVAIL,请参见以下参考资料:
-
镜像根池磁盘发生故障-从镜像 ZFS 根池中的备用磁盘引导
-
替换根池中的磁盘
-
完整的根池灾难恢复-恢复 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: daleks 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 scan: scrub repaired 0 in 0h0m with 0 errors on Tue Sep 27 16:59:07 2011 config: NAME STATE READ WRITE CKSUM tank DEGRADED 0 0 0 mirror-0 DEGRADED 0 0 0 c2t2d0 ONLINE 0 0 0 c2t1d0 UNAVAIL 0 0 0 cannot open errors: No known data errors
从此输出中可以看到,设备 c2t1d0 未正常运行。如果您确定该设备有问题,请予以替换。
如有必要,可使用 zpool online 命令使替换的设备联机。例如:
# zpool online tank c2t1d0
如果 fmadm faulty 的输出标识出了该设备错误,请让 FMA 知道设备已被替换。例如:
# fmadm faulty --------------- ------------------------------------ -------------- --------- TIME EVENT-ID MSG-ID SEVERITY --------------- ------------------------------------ -------------- --------- Sep 27 16:58:50 e6bb52c3-5fe0-41a1-9ccc-c2f8a6b56100 ZFS-8000-D3 Major Host : neo Platform : SUNW,Sun-Fire-T200 Chassis_id : Product_sn : Fault class : fault.fs.zfs.device Affects : zfs://pool=tank/vdev=c75a8336cda03110 faulted and taken out of service Problem in : zfs://pool=tank/vdev=c75a8336cda03110 faulted and taken out of service Description : A ZFS device failed. Refer to http://sun.com/msg/ZFS-8000-D3 for more information. Response : No automated response will occur. Impact : Fault tolerance of the pool may be compromised. Action : Run 'zpool status -x' and replace the bad device. # fmadm repaired zfs://pool=tank/vdev=c75a8336cda03110
最后一步是确认设备更换后的池正常运行。例如:
# zpool status -x tank pool 'tank' is healthy
解决设备被移除的问题
如果某个设备已从系统中彻底删除,则 ZFS 会检测到该设备无法打开,并将其置于 REMOVED 状态。这一删除可能会导致整个池变得不可用,但也可能不会,具体取决于池的数据复制级别。如果镜像设备或 RAID-Z 设备中的一个磁盘被删除,仍可以继续访问池。在以下情况下&