A kind of control method for realizing server hard disc state lighting instruction
Technical field
The present invention relates to control technology, more particularly to a kind of control method for realizing server hard disc state lighting instruction.
Background technology
In the prior art, there are as below methods can realize the lighting instruction of disk state:First, pass through hard disk controller
Itself is realized, but the hard disk for currently having many models does not support the function;Second, realized by simple discrete circuit,
But this pattern typically can only judge whether hard disk has access, it is impossible to judge whether hard disk is in read-write state;3rd, use
The data transmission mechanism of SGPIO buses, because support of the different hard disk producers to SGPIO standards is inconsistent, some producers it is hard
Disk does not support SGPIO bus protocols;4th, using complexity chip, although the chip can realize the instruction of disk state,
This kind of chip it is expensive, cost is higher.In addition, four kinds of methods do not support hard disk health status to indicate above.
The content of the invention
The technical problems to be solved by the invention are:A kind of control for realizing server hard disc state lighting instruction is provided
Method, it is not only widely applicable, reliable and stable, cheap, and various disk states can be indicated comprehensively.
In order to solve the above technical problems, the present invention proposes a kind of controlling party for realizing server hard disc state lighting instruction
Method, comprise the following steps:
Step 1, read by the timing of hard disk detecting system register on South Bridge chip on SATA controller come
Whether detection mainboard sata port inserts hard disk;
If step 2, having detected hard disk access, the indicator lamp of sata port correspondence position is lighted;If detecting does not have
Hard disk accesses, then extinguishes the indicator lamp of sata port correspondence position;
Step 3, disk read-write mark is set in hard disc data read-write interface module, the timing of LED control system is inquired about
The mark simultaneously answers the LED of port hard disk to read and write indicator lamp according to the state control pair of the mark;
Step 4, system perform SMART by timing and detect program to scan the health status of hard disk, if detecting hard disk
During damage, police instruction is realized by alarm.
Further, the alarm is alarm lamp, and police instruction is realized by the flicker of alarm lamp.
Above-mentioned technical proposal at least has the advantages that:Present system stable and reliable operation, it is cheap, disobey
Rely in specific hardware system, positioning, the disk read-write shape of hard disk position can be carried out respectively to each hard disk in server
The instruction of state, health status, and can easily change function.
Described above is only the general introduction of technical solution of the present invention, in order to better understand the technological means of the present invention,
And can be practiced according to the content of specification, and in order to allow the above and other objects, features and advantages of the present invention can
Become apparent, below especially exemplified by preferred embodiment, and describe in detail as follows.
Embodiment
It should be noted that in the case where not conflicting, the feature in embodiment and embodiment in the application can phase
Mutually combination.The present invention is described further below.
The present invention realizes that the control method of server hard disc state lighting instruction comprises the following steps:
Step 1, read by the timing of hard disk detecting system register on South Bridge chip on SATA controller come
Detection mainboard sata port whether insert hard disk, such as, when port0 has hard disk access, the register it is corresponding with port0 certain
One meeting is set to 1 by 0, while will indicate that the mark that corresponding ports hard disk whether there is puts 1;Otherwise, when port0 does not have hard disk to connect
Fashionable, the register a certain position corresponding with port0 can be set to 0, while the mark that instruction corresponding ports hard disk whether there is by 1
Will is reset.Other several marks also carry out assignment according to identical processing logic.
If step 2, having detected hard disk access, the LED light of sata port correspondence position is lighted;If detect not
There is hard disk access, then extinguish the LED light of sata port correspondence position;
Step 3, disk read-write mark is set in hard disc data read-write interface module, LED control system can be looked into regularly
Ask the mark and answer the LED of port hard disk to read and write the light on and off of indicator lamp according to the state control pair of the mark, specifically, due to
Linux system carries out having to call hard disc data read-write interface module during hard disc data read-write while needs to refer in the module
Surely the port numbers (each port can only connect a hard disk) of reading writing harddisk are wanted, disk read-write mark can be now set in the module
Will.Such as:When system will write data to hard disk corresponding to port0, in linux system reading writing harddisk data interface module
(generally ATA drive modules) is inner to be set to 1 read-write mark corresponding to port0, otherwise resets.Same mode is in Linux systems
Confirm whether other port have reading and writing data in system reading writing harddisk data interface module, if there are read-write data, corresponding port
Disk read-write mark be set to 1, otherwise reset.And LED control system can extinguish all port during system initialization when working
Hard disk LED reading and writing lamp, then system can timing read hard disk position and come what corresponding ports hard disk in alignment system whether there is
Mark, if this is masked as 1, referred to by controlling corresponding GPIO level to light the LED that corresponding instruction hard disk whether there is for height
Show lamp, otherwise, by controlling corresponding GPIO level to be low, the corresponding LED light that indicates hard disk and whether there is of extinguishing;Enter one
Step ground, if port has access hard disk, the value of disk read-write mark is read, if this is masked as 1, by way of controlling GPIO
To control whether corresponding port instructions hard disk enters line flicker in the LED of read-write, otherwise, corresponding port instructions hard disk is controlled to be
The no LED in read-write does not flash.After completing above-mentioned handling process, the system can sleep certain time, subsequently into the system
Re-execute said process.
Step 4, system perform SMART by timing and detect program to scan the health status of hard disk, if detecting hard disk
During damage, police instruction is realized by alarm, for example police instruction is realized by the flicker of alarm lamp, during work, timing
Perform smart orders detection and scan all hard disks, if testing result is:FAILED, disk alarm lamp is lighted, otherwise extinguishes disk
Alarm lamp.
To sum up, method mentioned in the present invention goes in the server product of all operation linux operating systems,
System run all right is reliable, cheap, and independent of specific hardware system, each hard disk in server can be distinguished
Positioning, the instruction of disk read-write state, health status of hard disk position are carried out, and can easily change function, for example is repaiied
Change flicker frequency of disk read-write status indicator lamp etc..
Described above is the embodiment of the present invention, it is noted that for those skilled in the art
For, under the premise without departing from the principles of the invention, some improvements and modifications can also be made, these improvements and modifications are also considered as
Protection scope of the present invention.