命令行界面
While most tasks in Unraid can be performed through the WebGUI, certain operations - especially those related to diagnostics, drive management, or scripting - require using the system console or SSH terminal. This page offers Unraid-specific command-line tools and examples that can be used without needing extensive Linux knowledge.
Many disk-level Unraid operations depend on Linux device names, like /dev/sdX
. You can find the device identifier for any drive in the Main tab of the WebGUI. Look for the three-letter label sdX
or nvmeX
next to each disk. Use the appropriate identifier in all commands, replacing sdX
with your specific disk.
访问终端
Unraid includes a built-in web terminal that you can access directly from the WebGUI. Simply use the top-right dropdown menu and select ">_". This opens a command-line session as the root user, giving you full administrative access to your system.
您也可以使用 %SSH|ssh%(安全壳)与 PuTTY 等客户端外部连接到 Unraid 服务器。
如果您使用的是Windows,可能更喜欢使用PuTTY进行SSH访问,而不是内置终端。这个软件轻量级、免费,并允许您保存会话以便日后轻松访问。
- 运行例如
smartctl
、xfs_repair
、tail
或top
等诊断和命令行工具 - 执行不需要用户界面的插件脚本或工具
- Troubleshooting issues related to connectivity, system services, or user shares
驱动器测试和监控
如果您使用的是Windows,可能更喜欢使用PuTTY进行SSH访问,而不是内置终端。这个软件轻量级、免费,并允许您保存会话以便日后轻松访问。
如何安装和使用 PuTTY - 单击以展开/折叠
Unraid automatically configures the SSH server on the first boot. Ensure your networking is working properly and that your root password is set before attempting a remote connection.
驱动器测试和监控
这些工具有助于评估性能、检查驱动器健康情况以及解决array速度慢的问题。所有命令都应从终端或通过SSH执行。
diskspeed.sh
此脚本允许进行全面的表面性能测试,并生成可视化报告。
查看 diskspeed.sh 用法 - 单击以展开/折叠
以前这脚本需要从 Unraid 论坛下载。DiskSpeed 现在提供了一个更完善的软件包:
hdparm -tT /dev/sdX
-t
标志测试缓冲磁盘读取,而 -T
测试缓存读取。这主要衡量顺序读取性能,有助于识别异常缓慢的驱动器。
运行多个测试以提高准确性:
for ((i=0;i<5;i++)); do hdparm -tT /dev/sdX; done
查看驱动器信息:
hdparm -I /dev/sdX
这将显示型号、固件、缓存大小和支持的功能,帮助验证磁盘类型和控制器行为。
smartctl
此命令运行 SMART 诊断并监控驱动器健康。
查看 smartctl 选项 - 单击以展开/折叠
top
此命令提供实时的进程和资源监控。
查看 top 用法 - 单击以展开/折叠
系统监控
在 WebGUI 不可用或需要更详细诊断时,使用这些命令监控内存、进程和系统性能。
ps
使用此命令显示正在运行的进程及其详细信息。
查看 ps 选项 - 单击以展开/折叠
top
- 实时显示每个进程的 CPU 和内存使用情况。
- 按
q
退出。 - 使用方向键滚动,按
k
终止进程。
按内存使用排 序:
free
此命令显示内存使用统计信息。
查看 free 用法 - 单击以展开/折叠
free -h
这将以人类可读的格式显示 RAM 使用情况。-h
标志表示大小将以 KB、MB 或 GB 而非字节显示。
"可用"内存读数低并不一定表示问题——Linux 积极缓存数据以提高性能。
df
此命令显示文件系统磁盘空间使用情况。
查看 df 用法 - 单击以展开/折叠
列出所有进程的详细信息:
ps aux
考虑使用 htop
获取更友好的界面和增强的控制。
ps aux --sort=-%mem | head -20
按 CPU 使用排序:
ps aux --sort=-%cpu | head -20