Linux Hardware Detection

Source: Internet
Author: User
Http://lidu678.blog.163.com/blog/static/898060062010112010421532/ computer system is composed of software system and hardware system. Checking the hardware status is very important to ensure the stability of the entire system. Whether the operating system is Linux or windows, once the hardware fails, the overall system security will be serious. Here we mainly detect the CPU, hard disk, and memory of computer systems running Linux.

Central processor status detection

The central processor is the core hardware of Linux Hosts. Let's take a look at the content in the/proc directory under the linux root directory. The files in this directory are not stored on the disk. The file system in this directory is called the proc file system, which is the image of the system kernel. That is to say, the files in this directory are stored in the system memory. It provides interfaces for accessing system kernel data in the form of a file system. Users and applications can obtain system information through/proc and change certain kernel parameters. Because system information (such as processes) is dynamically changed, when a user or application reads the proc file, the proc file system dynamically reads the required information from the system kernel and submits it.

CPU information is stored in the "cpuinfo" file. You can also use the following command to View Details:
# Cat/proc/cpuinfo

The following uses the author's amd athlon 1100 as an example:

Processor: 0
Vendor_id: Authentic amd
CPU family: 6
Model: 7
Model name: AMD athlon (TM) processor
Stepping: 0
CPU MHz: 1100.046
Cache size: 64 kB # cache capacity #
Fdiv_bug: No # No bug #
Hlt_bug: No # No bug #
F00f_bug: No # No bug #
Coma_bug: No # No bug #
FPU: Yes
Fpu_exception: Yes
Cpuid level: 1
WP: Yes
Flags: fpu vme de pse tsc msr pae mce cx8 APIC Sep mtrr pge mca cmov
Pat limit 36 MMX fxsr SSE syscall mmxext 3 dnowext 3 dnow
Bogomips: 2195.45

Make sure that the CPU Hardware has no bugs and is identified by the system as a specific model. The above only shows the basic CPU information. For real-time situations, we use the mbmon software to detect CPU usage,

1. Software Download: http://www.nt.phys.kyushu-u.ac.jp/shimizu/download/xmbmon203.tar.gz,http://www.nt.phys.kyushu-u.ac.jp/shimizu/download/readme-xmbmon203.html.

After the software is downloaded, take a look:
README-xmbmon203pl1.html

Check whether the software supports your motherboard chip.

2. Install software:

Gunzip xmbmon203.tar.gz
Tar xmbmon203.tar
CD xmbmon203
./Configure; Make; make install
3. Run the software: <br> mbmon can work in the command line and X Window. First, check the author's motherboard:
<Ccid_nobr>
<Table width = "400" border = "1" cellspacing = "0" cellpadding = "2"
Bordercolorlight = "black" bordercolordark = "# ffffff" align = "center">
<Tr>
<TD bgcolor = "e6e6e6" class = "code" style = "font-size: 9pt">
<PRE> <ccid_code>./mbmon-d
Using via686 hwm directly !!
* Via chip vt82c686a/B found.

  

The above content indicates that the motherboard chip is the vt82c686a/B of Weisheng. Run the following command line.

./Mbmon
Temp. = 42.1, 33.0, 24.2; rot. = 5357, 0, 0
Vcore = 1.78, 3.11; Volt. = 3.41, 4.93, 12.19, 0.00, 0.00

The above shows that the temperature of the central processor is 42.1, the power supply temperature is 33.0, the motherboard temperature is 24.2, the CPU fan speed is 5357 rpm, And the CPU core voltage is 1.78 volts, the input voltage is 12.19 volts, 3.41 volts, and 4.93 volts. By default, the above content is updated once every five seconds.

Mbmon runs in the X Window. Result 1 is displayed.
./Xmbmon

Figure 1 mbmon running in X Window

4. Remote Monitoring

The latest version of mbmon also provides remote monitoring:
./Mbmon-P 22

"-P 22" indicates that port 22 is enabled, so that you can use Telnet, ssh, and other remote tools to connect to the Linux host to check the CPU status.

Hard Disk track Detection

Hard Disk Physical Bad Sectors are the most troublesome among all Linux hardware faults on the hard disk. It makes your Linux computer crash frequently, and makes all your data useless. The current factory hard drive (after 1993) basically supports automatic detection analysis and reporting technology (Self Monitoring Analysis and Reporting Technology. Smart technology can monitor the Disk Head Unit, Drive System of Disk Motor, internal circuit of the disk, and media on the disk surface. When smart detects and analyzes possible problems with the hard disk, it will promptly report an alarm to the user to avoid loss of computer data. The smart technology must be supported by the motherboard, and
Smart technology cannot predict all possible hard drive failures. Smart (SFF-8035i) is an industrial standard established by hard drive manufacturers. This standard is to save a table with attributes such as execution status, reliability, and read-seeking error rate on the hard disk. All attributes have a standard value of 1 byte (size range: 1-253), and contain another key stage value of 1 byte. If the data in the Attribute Table is close to less than or reaches the critical stage value, the hard disk is not working properly.

Smartmontools is a Linux hard disk detection tool. Its homepage is http: // smartmontools.sourceforge.net. Download link: ftp: // fr2.rpmfind.net/linux/sourceforge/smartmontools/smartmontools-5.1-18.i386.rpm.

1. software installation:
RPMs-IVH/smartmontools-5.1-18.i386.rpm

After the software is installed, the program smartctl will be generated in the/usr/local/directory. First, check whether the hard disk and motherboard support smart technology (see figure 2 ).
Smartctl-I/dev/hda7

Figure 2 check whether the hard drive supports smart

Figure 2 shows that the author's hard drive supports SMART models: st320414a (Seagate's cool fish III, 72000 rpm, 2 MB cache ).

2. Comprehensive detection of Hard Disks
Run the following hard disk detection command:
Smartctl-A/dev/hda7

Figure 3 physical logic status of a hard disk

Figure 3 shows the detected hard disk information. The displayed information varies with your hard disk manufacturer. Line 1-represents the different physical performance of the hard disk, and column 1 represents the logical status of the hard disk.

Flag is a flag, and the standard value should be smaller than or equal to the key value (thresh ). When_failed indicates the error message. The when_failed vertical line in Figure 3 is empty, indicating that the hard disk is not faulty. If when_failed shows a number, it indicates that the hard disk track may have a relatively large bad track.

Smartctl has more than a dozen parameters. For details, refer to the following command:
Smartctl -- Help

3. Advanced Applications

We can use the crontab command to perform daily scheduled scanning:

(1) first create a file named linuxect (set by yourself ):
# Crontab-e

(2) file content:
05 16 ** 5 smartctl-A/dev/hda7

After editing with VI, save the disk and exit. Use the crontab command to add it to the task list:
# Crontab linuxect

In this way, all users in the system will automatically scan at every Friday.

Memory Detection

We usually think that memory errors are not likely to be damaged, and think that if the memory is broken, it is impossible to pass the motherboard BIOS boot self-check program. In fact, this self-check program has few functions and only detects the capacity speed. Many memory errors cannot be detected. If a program occasionally loses its response while running the program; when opening the file, the system occasionally prompts that the file is damaged, but it is okay to open it later ...... You should check your memory.

1. Use Linux commands to detect
(1) use the "free" command on the command line to monitor memory usage

# Free
Total used free shared buffers cached
Mem: 256024 192284 63740 0 10676 101004
-/+ Buffers/cache: 80604 175420
Swap: 522072 0 522072

The above shows a mb ram and a MB swap space system.

(2) run the vmstat command to monitor virtual memory usage:

# Vmstat
Procs ----------- memory ---------- --- swap -- ----- Io ---- System -- ---- CPU ----
R B SWPD free buff cache Si so Bi Bo in CS us Sy ID wa
1 0 0 63692 10704 101008 0 239 42 126 48 45 7 0

The vmstat () command is a common monitoring program. It is short for virtual MEOMORY statistics (Virtual Memory statistics. If you do not use any command line parameters of the vmstat command, you will get a one-time report. The vmstat Command reports that the main activity types include process (procs), memory (in kilobytes), swap partition (in kilobytes), from block device (hard drive) the input output, system interruption (the number of times each second occurs), and Central Processing Unit (CPU) allocated to the user's system and the proportion occupied by idle time respectively.

2. Use tool software testing

Memtest86 is a free memory testing software with high test accuracy and the potential memory problems can also be checked out. You can download the latest release on the http://www.memtest86.com/page.

Download link: http://www.memtest86.com/memtest86-3.0.tar.gz

Software installation:

# Tar xzvf memtest86-2.5.tar.gz
# Cd memtest86-2.5
# Make

Then, insert a 3.5 inch blank disk to the floppy disk drive and enter:
# Make install

In addition, you can also download the http://www.memtest86.com/memtest86-3.0.iso.gz file, decompress it is an iOS file, burn to the CD, and then start the computer.

Restart the computer and enable it with a soft drive in the BIOS. The software running interface is shown in Figure 4.

Figure 4 memtest86 software running interface

Figure 4 shows the processor model used by the current system: AMD-duron and frequency: 1056, as well as the CPU level-1 cache (128 K) and level-2 cache (64 K ), the physical memory capacity and speed of the system (64) (315 Mb/s ). The last display is the chipset type used by the motherboard. The Test Progress is displayed on the right of the system information. "Pass" shows the progress of the main test process. "Test" shows the progress of the current test project. "Test #1" shows the current test project. "Walltime" shows the time consumed by the test. In this row of data, the "ECC" column shows whether the current memory supports enabling the ECC verification function. "Test" shows the test mode, which is available in "standard" and "full" modes. "

Set detection options: click "c" to open the settings menu of memtest86, and then click "2" to select the "test selection" option, click "3" and select "all test" to enable the full test mode (5 ).

Figure 5 set detection options

Major memory bursts (such as "dead" bits) will be detected within a few seconds. If the fault is triggered by the special locating mode, it takes a long time for the test to be detected. If your memory capacity is large, you need to wait patiently for the detection results. The memory used by the author is 64 MB and pc133. It takes 24 minutes to use the full detection mode.

Summary

The core of the Linux system is the central processor, hard disk, and memory. One of the notable features of Linux is its extraordinary stability. If your hardware is defective or configured incorrectly, the security of the data in the system is dangerous. Therefore, it is important to detect the status of the data in real time.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.