新租服务器,想对硬盘的健康情况和读写速度进行基本测试,如使用 CentOS 7系统,可使用smartctl 和 hdparm 的命令。
过程:
1.yum -y install smartmontools hdparm # 安装相应的软件
2.smartctl --test=short /dev/sda # 假如硬盘设备名称是 /dev/sda,进行简单测试

3.smartctl -l selftest /dev/sda # 几分钟后,查看测试结果,如本例,关键信息是 Completed without error,无错误

4.smartctl -H /dev/sda # 查看整体健康情况,关键信息是 SMART overall-health self-assessment test result: PASSED,测试通过

5.hdparm -Tt /dev/sda # 测试读取速度,本例是 125.98 MB/sec

6.dd if=/dev/zero of=tempfile bs=1M count=1024 conv=fdatasync,notrunc status=progress # 用 dd 来测试写入速度,第一次 66.6 MB/s
7.echo 3 > /proc/sys/vm/drop_caches # 清除 buffer-cache
8.dd if=tempfile of=/dev/null bs=1M count=1024 status=progress # 再次测试,96.6 MB/s
9.dd if=tempfile of=/dev/null bs=1M count=1024 status=progress # 最后一次测试,有 buffer-cache ,是 1.7 GB/s

参考: