虽然使用linux较多,但是作为获取硬件信息的操作却不多。
本处以pve/debian系获取硬件简介
- 系统硬件信息
dmidecode -t 17
lspci
- 获取cpu信息
cat /proc/cpuinfo
- 获取网卡信息
lspci -vvv
- 获取温度
1)cpu温度
cd /sys/class/thermal/
#显示cpu温度 echo $[$(cat /sys/class/thermal/thermal_zone3/temp)/1000]°
2)获取全部的温度传感器信息
apt-get install lm-sensors sensors-detect sensors sensors -u coretemp-isa-0000 #获取cpu温度
- 获取硬盘信息
1)硬盘的smart信息
cd /dev
2)ssd硬盘坏道问题
3)硬盘温度
smartctl /dev/sda -a | grep -i Temp
4)获取硬盘的使用情况
a)硬盘挂载的空间、使用空间
b)查看没有挂载的硬盘空间
另外pve添加硬盘操作见此
c)磁盘的挂载
d)检查磁盘格式
5)硬盘对于trim的支持
lsblk --discard
非0为支持
6)硬盘的FIO测试
a) 随机读
yum install fio -y fio -filename=/tmp/test_randread -direct=1 -iodepth 1 -thread -rw=randread -ioengine=psync -bs=16k -size=2G -numjobs=10 -runtime=60 -group_reporting -name=mytest
b)随机写
fio -filename=/tmp/test_randread -direct=1 -iodepth 1 -thread -rw=randwrite -rwmixread=70 -ioengine=psync -bs=16k -size=2G -numjobs=10 -runtime=60 -group_reporting -name=test
c)随机读写
fio -filename=/tmp/test_randread -direct=1 -iodepth 1 -thread -rw=randrw -rwmixread=70 -ioengine=psync -bs=16k -size=2G -numjobs=10 -runtime=60 -group_reporting -name=test
e)顺序读测试
fio -filename=/tmp/test_rand -direct=1 -iodepth 1 -thread -rw=read -ioengine=psync -bs=16k -size=2G -numjobs=10 -runtime=60 -group_reporting -name=mytest
f)顺序写测试
fio -filename=/tmp/test_rand -direct=1 -iodepth 1 -thread -rw=write -ioengine=psync -bs=16k -size=2G -numjobs=10 -runtime=60 -group_reporting -name=mytest
g)顺序混合读写
fio -filename=/tmp/test_rand -direct=1 -iodepth 1 -thread -rw=readwrite -ioengine=psync -bs=16k -size=2G -numjobs=10 -runtime=60 -group_reporting -name=mytest
参考资料:
- https://wiki.archlinux.org/title/Lm_sensors
- https://askubuntu.com/questions/474669/ssd-temperature-sensor-readout-with-hddtemp
- https://www.jianshu.com/p/09584783bd1d
- https://www.yisu.com/zixun/9378.html
- https://www.linuxprobe.com/smartmontools-detect-harddisk.html
- https://www.cnblogs.com/xqzt/p/5512075.html
- https://segmentfault.com/a/1190000019052387
- https://www.insidentally.com/articles/000007/
- https://blog.csdn.net/qq_35440040/article/details/89087490