非正常关机
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.
采取一些主动的步骤可以帮助你避免或识别非正常关机:
- **使用不间断电源(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.
导致非正常关机的事件
了解导致不洁关机的主要触发因素有助于您防止此类事件发生。探索下方选项卡以获取每种情况的详细信息。
- 意外断电
- 闪存驱动器故障
- 开启终端会话
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) 插件。
Unraid waits for all open terminal or SSH sessions to close during shutdown. If these sessions remain active and the shutdown timer expires, a forced shutdown occurs.
Dynamix停止Shell 插件可以自动关闭持续存在的bash或SSH会话,从而有助于确保优雅关机。然而,如果有正在进行的写入操作到array,请谨慎。
配置关机超时
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.
设置位置
- 设置 → 虚拟机管理 → 虚拟机关机(高级)
考虑
最佳做法
将超时设置为至少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.