title: 服务器考机 author: Gamehu date: 2025-06-04 10:35:09
刚购置了一台服务器,准备付尾款了,但是因为服务器是全新的,只装了几台虚拟机,显卡啥的都还没有用,所以在付钱之前需要先测试一下,看看表现。
跑了一整晚,第二天,看着没问题就删掉了虚拟机,忘了截图。
sudo apt install ubuntu-drivers-common
ubuntu-drivers devices
sudo ubuntu-drivers autoinstall
#!/bin/bash
set -e
# 设置工具路径(修改为你实际的 gpu_burn 目录)
GPU_BURN_PATH="$HOME/gpu-burn/gpu_burn"
# 检查是否存在命令
command -v stress-ng >/dev/null 2>&1 || { echo >&2 "需要安装 stress-ng:sudo apt install stress-ng -y"; exit 1; }
command -v fio >/dev/null 2>&1 || { echo >&2 "需要安装 fio:sudo apt install fio -y"; exit 1; }
# 检查 GPU_BURN 是否存在
if [ ! -f "$GPU_BURN_PATH" ]; then
echo "找不到 gpu_burn,可在 https://github.com/wilicc/gpu-burn 下载并编译"
exit 1
fi
echo "开始 GPU + CPU + 内存 + IO 综合烤机测试"
# GPU 测试
"$GPU_BURN_PATH" 86400 &
GPU_PID=$!
# CPU 测试
stress-ng --cpu 0 --timeout 24h --metrics-brief &
CPU_PID=$!
# 内存测试
stress-ng --vm 4 --vm-bytes 80% --timeout 24h --metrics-brief &
MEM_PID=$!
# 磁盘I/O测试
fio --name=randwrite --ioengine=libaio --iodepth=16 --rw=randwrite --bs=4k --direct=1 --size=4G --numjobs=4 --runtime=86400 --group_reporting &
IO_PID=$!
echo "测试开始,PID: GPU=$GPU_PID, CPU=$CPU_PID, MEM=$MEM_PID, IO=$IO_PID"
wait
watch命令
# 每5秒刷新GPU状态
watch -n 5 nvidia-smi
# 每10秒刷新(减少刷新频率)
watch -n 10 nvidia-smi
# 只看关键信息
watch -n 5 "nvidia-smi --query-gpu=name,temperature.gpu,power.draw,utilization.gpu,memory.used --format=csv"
nvtop
bash# 安装nvtop - GPU实时监控工具
sudo apt update
sudo apt install nvtop -y
# 运行nvtop
nvtop
3.安装netdata + GPU集成插件