ZFS 报告(在 FreeBSD 和 Linux 上通过 ZoL)

Day*_*ker 5 freebsd zfs reporting drive-failure zfsonlinux

作为 mdadm 的长期用户,刚刚遇到磁盘错误并记得我为 mdadm 配置了自动邮件报告磁盘错误。

因此我只需要在/etc/mdadm/mdadm.conf 中插入我的邮件地址

MAILADDR someone@exaplme.org
Run Code Online (Sandbox Code Playgroud)

但是我真的很想念 FreeBSD 上的那个。由于我的 ZFS RAID6 现在运行了半年多,我想如果磁盘出现故障会发生什么?

我从未配置任何外部邮件地址。有没有简单的方法来完成测试这个?

就像在 mdadm 上一样:

sudo mdadm –monitor –scan –test
Run Code Online (Sandbox Code Playgroud)

我将如何使用 ZoL(Linux 上的 ZFS)在 Linux 上执行此操作?

编辑:对不起,我的意思是自动报告。没有预定。

我知道我可以每分钟构建一个脚本并解析 zpool status -X。但我认为这不是完成报告问题的一种非常优雅的方法。最好在磁盘故障时立即得到通知(如 mdadm)

编辑[2]:感谢您的建议,但我没有遇到一些脚本问题,有人可以帮我解决 /bin/sh 中的 for 循环问题 -> PASTEBIN

编辑[3]:得到了我的 for 循环问题。:)(在PSTEBIN 中更新)

对我的脚本还有什么建议吗?

eww*_*ite 3

运行检查输出的常规脚本 (cron) zpool status -x。从长远来看,ZFS on Linux 项目正在以事件守护程序的形式实现这一目标。Solaris 派生系统可以访问故障管理体系结构。

就自动化报告而言,即使是像NexentaStor这样的商业解决方案也使用定期检查。这没有什么问题。

在此输入图像描述


像这样的东西:

[root@mdmarra ~]# zpool status -x
all pools are healthy
Run Code Online (Sandbox Code Playgroud)

与一些可怕的事情相比:

[root@mdmarra ~]# zpool status -x
  pool: vol1
 state: UNAVAIL
status: One or more devices are faulted in response to IO failures.
action: Make sure the affected devices are connected, then run 'zpool clear'.
   see: http://www.sun.com/msg/ZFS-8000-JQ
 scan: scrub repaired 0 in 1h15m with 0 errors on Sun Jul 28 21:15:10 2013
config:

        NAME          STATE     READ WRITE CKSUM
        vol1          UNAVAIL      0     0     0  insufficient replicas
          mirror-0    DEGRADED     0     0     0
            c1t0d0    UNAVAIL      0     0     0  cannot open
            c2t0d0    ONLINE       0     0     0
          mirror-1    DEGRADED     0     0     0
            c1t1d0    UNAVAIL      0     0     0  cannot open
            c2t1d0    ONLINE       0     0     0
          mirror-2    DEGRADED     0     0     0
            spare-0   UNAVAIL      0     0     0  insufficient replicas
              c1t2d0  UNAVAIL      0     0     0  cannot open
              c2t8d0  UNAVAIL      0     0     0  cannot open
            c2t2d0    ONLINE       0     0     0
          mirror-3    DEGRADED     0     0     0
            c1t3d0    UNAVAIL      0     0     0  cannot open
            c2t3d0    ONLINE       0     0     0
          mirror-4    DEGRADED     0     0     0
            c1t4d0    UNAVAIL      0     0     0  cannot open
            c2t4d0    ONLINE       0     0     0
          mirror-5    UNAVAIL      0     0     0  insufficient replicas
            c1t5d0    UNAVAIL      0     0     0  cannot open
            c2t5d0    FAULTED      0     0     0  too many errors
        cache
          c3t5d0      ONLINE       0     0     0
        spares
          c2t8d0      UNAVAIL   cannot open

errors: No known data errors
Run Code Online (Sandbox Code Playgroud)