linux notes - Hardware command [2]

1- Disk

1.1 View computer disk type

cat /sys/block/sda/queue/rotational  
0 #固态盘
cat /sys/block/sdb/queue/rotational
1 #机械盘

1.2-repair inspection

1.2.1- badblocks

badblocks -v /dev/sda10 > badsectors.txt 
#  命令检查你的 Linux 硬盘上的坏道/坏块, badblocks 扫描设备/dev/sda10(记得指定你的实际设备),-v选项让它显示操作的详情。另外,这里使用了输出重  定向将操作结果重定向到了文件badsectors.txt。

1.2.2- Smartmontools

This method is more reliable and efficient on modern disks with SMART (Self-Monitoring Analysis and Reporting Technology Self-Monitoring, Analysis and Reporting Technology) system (ATA / SATA and SCSI / SAS hard drives and solid state drives). SMART system can help detect, report, and may record their state of health, so you can identify any potential hardware failure.

smartctl -H /dev/sda10
#  执行 smartctrl 命令并在命令中指定你的设备作为参数,以下命令包含了参数 -H 或 --health 以显示 SMART 整体健康自我评估测试结果。

1.2.3- fsck

For inspection and maintenance inconsistent file system. If the system is powered down or disk problems occur, you can check the file system using the fsck command.

fsck /dev/sda4  
    
-a:自动修复文件系统,不询问任何问题;
-A:依照/etc/fstab配置文件的内容,检查文件内所列的全部文件系统;
-N:不执行指令,仅列出实际执行会进行的动作;
-P:当搭配"-A"参数使用时,则会同时检查所有的文件系统;
-r:采用互动模式,在执行修复时询问问题,让用户得以确认并决定处理方式;
-R:当搭配"-A"参数使用时,则会略过/目录的文件系统不予检查;
-s:依序执行检查作业,而非同时执行;
-t<文件系统类型>:指定要检查的文件系统类型;
-T:执行fsck指令时,不显示标题信息;
-V:显示指令执行过程。
-y:  自动修复,和 -a 作用一致,不过有些文件系统只支持 -y。
fsck  自检全部的硬盘

2- hardware information

2.1 Hardware information

2.1.2- dmidecode

DMI table of contents read by a computer, which displays the hardware information in a human readable format. (DMI Desktop Management Interface meaning, it was also said reading is SMBIOS - System Management BIOS). Description This table contains the hardware components of the system, as well as other useful information, such as serial number, manufacturer information, publication date, and other modified BIOS.

dmidecode -t memory # 只打印已安装的 RAM 模块。

2.1.3- hwinfo

Hardware information, which is another great utility for detecting the presence of the system hardware, and display detailed information about the various hardware components in a human readable format. It reports information about the CPU, RAM, keyboard, mouse, graphics card, sound, storage, network interfaces, disks, partitions, BIOS, and bridges, etc.

hwinfo --memory

2.1.4- inxi

A great tool that can check the hardware information on Linux, and offers a number of options to get all hardware information on Linux systems,
is a script that can quickly display system hardware, CPU, drivers, Xorg, Desktop kernel, GCC version, process, RAM usage, and a variety of other useful information, technical support forums and debugging tools can also be used.

2.1.5- cat /proc/cpuinfo

cat /proc/cpuinfo|grep phy
physical id    : 0     #####   physis cpu
address sizes    : 36 bits physical, 48 bits virtual
physical id    : 0     #####   physis cpu
address sizes    : 36 bits physical, 48 bits virtual

2.1.6- dmesg

(Representing the message or message driven) is a command on most Unix-like operating systems, the kernel message buffer for printing.

2.1.7- atop

ASCII is a full-screen system for Linux performance monitoring tool that reports on all active server processes (even if the process has been completed during the interval).

2.1.8- glances

Written in Python cross-platform based on curses (LCTT Annotation: curses is a graphics library under Linux / Unix) system monitoring tool. We can say everything, just like the premier information contained in the smallest space. It uses psutil library to obtain information from the system.
You can monitor CPU, memory, load, process list, network interfaces, disk I / O, Raid, the sensor, the file system (and folders), Docker, monitors, alarms, system information, uptime, fast preview (CPU, memory, load) and so on.

Guess you like

Origin www.cnblogs.com/lemanlai/p/12325204.html