跳到主要内容

非正常关机

An unclean shutdown happens when Unraid detects that the array was not properly stopped before the system powered off. This situation can trigger an automatic parity check during the next boot to ensure data integrity.

Recommendations 防止不洁的关闭

采取一些主动的步骤可以帮助你避免或识别非正常关机:

  • **使用不间断电源(UPS):**确保服务器连接到UPS并设置在电池电量不足时自动关闭。
  • **尝试优雅关闭:**如果您的服务器无响应,短按电源按钮以触发安全关闭。不要长按该按钮,因为这将强制硬关机并导致不洁关机。
  • 启用持久日志记录:前往设置 → 系统日志服务器以激活在重新启动后持久存在的日志记录。详细信息请参阅持久日志 (系统日志服务器)
  • Attach diagnostics for support: If an unclean shutdown occurs, Unraid will attempt to save diagnostics to /log/diagnostics.zip on your flash device. Attach this file to forum posts when you seek help.
UPS 配置最佳实践

配置良好的 UPS 是防止因掉电导致非正常关机的最佳防卫。

  • 通过 USB 连接 UPS 到 Unraid 服务器。
  • 在设置中启用 UPS 支持。
  • **配置关机超时时间:**设置UPS以便在电池电量不足之前触发受控关机。调整“剩余电池运行时间”或“电池充电电平”阈值,以提供足够的时间让Unraid 停止array 并安全关机。
  • 测试配置: 模拟掉电以确保 UPS 和 Unraid 的正确反应。

查看NUT插件,以便能够更广泛地兼容更多高级的UPS型号或不支持的硬件。

导致非正常关机的事件

了解导致不洁关机的主要触发因素有助于您防止此类事件发生。探索下方选项卡以获取每种情况的详细信息。

Power interruptions are one of the main reasons for unclean shutdowns. Protect your system with a properly configured UPS that can automatically shut down Unraid before the battery runs out.

备注

Unraid 支持大多数使用 apcupsd协议 协议的UPS单元(APC和CyberPower通常兼容)。如果您的UPS不受支持,考虑使用社区应用程序中的Network UPS Tools (NUT) 插件。


配置关机超时

Properly configuring shutdown timeouts is essential to ensure your Unraid server can stop all services effectively, preventing unclean shutdowns, particularly during power loss or maintenance. Each component of your system - VMs, Docker containers, and the overall array - has its own timeout setting that can be adjusted.

推荐的超时设置

设置默认值推荐最低值在哪里配置
VM 关机超时60 秒300 秒 (5 分钟)设置 → 虚拟机管理 → 虚拟机关机(高级)
Docker 容器停止超时时间10 秒30–60 秒设置 → Docker (高级)
通用关机超时时间90 秒3 × VM 超时 + Docker 超时 + 15–30秒设置 → 磁盘设置 → 关机超时

虚拟机超时时间

点击展开/折叠

Unraid first shuts down all configured virtual machines (VMs) before stopping Docker containers or the array itself. The VM Shutdown Timeout determines how long Unraid waits for each VM to shut down gracefully.

设置位置

  • 设置 → 虚拟机管理 → 虚拟机关机(高级)

考虑

  • Windows 虚拟机 可能需要更长时间关机,尤其是如果更新待处理或虚拟机处于睡眠/休眠中。
  • 如果超时时间过短,虚拟机 将被强制停止,有可能导致数据丢失或损坏。

最佳做法

将超时设置为至少300秒(5分钟)以应用于WindowsVMs。将更新安排在启动时运行,而不是关机时,以避免延迟。

“Docker 容器超时时间”

点击展开/折叠

After VMs, Unraid stops all running Docker containers. The Docker Container Stop Timeout controls how long Unraid waits for each container to exit cleanly.

设置位置

  • 设置 → Docker (启用高级视图)

考虑

  • 容器是并行停止的。
  • 复杂容器,或具有大型数据库的容器,可能需要超过默认的 10 秒时间进行安全关闭。
  • 如果定时器到期,容器将被强制停止。

最佳实践

如果您运行的Docker容器需要额外的关闭时间,应将超时增加到30-60秒。

通用关机计时器

点击展开/折叠

The overall Shutdown time-out is the maximum time Unraid allows for all shutdown processes - VMs, Docker, and disk operations - before forcing a shutdown.

设置位置

  • 设置 → 磁盘设置 → 关机超时

如何计算

将您的VM和Docker超时时间相加,然后加上15-30秒用于磁盘卸载和其他过程。

  • 示例:3 × ***虚拟机关机超时*** + ***Docker 停止超时*** + 15–30 秒

最佳实践

设定此计时器以足够高的时间以适应您最慢的关机场景,尤其是当您拥有许多驱动器或大array时。

UPS电池寿命

点击展开/折叠

您的UPS必须提供足够的运行时间以允许所有关机计时器到期,然后服务器失去电力。

设置位置

  • 设置 → UPS 设置 (查看 剩余运行时间,所有磁盘旋转起来)

考虑

  • UPS 应该在关机序列完成前触发关闭。
  • 如果电池在关闭完成之前耗尽,您将面临不完全关闭和可能的数据丢失的风险。

最佳做法

Test your UPS by simulating a power outage and confirming that Unraid shuts down cleanly with time to spare.