CN112256535A - Hard disk alarm method and device, computer equipment and storage medium - Google Patents

Hard disk alarm method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN112256535A
CN112256535A CN202011125864.8A CN202011125864A CN112256535A CN 112256535 A CN112256535 A CN 112256535A CN 202011125864 A CN202011125864 A CN 202011125864A CN 112256535 A CN112256535 A CN 112256535A
Authority
CN
China
Prior art keywords
hard disk
time
moment
field
state
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202011125864.8A
Other languages
Chinese (zh)
Other versions
CN112256535B (en
Inventor
卜玉玲
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hunan Goke Microelectronics Co Ltd
Original Assignee
Hunan Goke Microelectronics Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hunan Goke Microelectronics Co Ltd filed Critical Hunan Goke Microelectronics Co Ltd
Priority to CN202011125864.8A priority Critical patent/CN112256535B/en
Publication of CN112256535A publication Critical patent/CN112256535A/en
Application granted granted Critical
Publication of CN112256535B publication Critical patent/CN112256535B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/32Monitoring with visual or acoustical indication of the functioning of the machine
    • G06F11/324Display of status information
    • G06F11/327Alarm or error message display
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/3037Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a memory, e.g. virtual memory, cache
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Quality & Reliability (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention relates to the technical field of hard disk detection, and provides a hard disk alarm method, a hard disk alarm device, computer equipment and a storage medium, wherein the method comprises the following steps: respectively acquiring smart information of a hard disk at a first moment and a second moment, wherein the first moment is earlier than the second moment; according to preset fields in smart information at a first moment and a second moment, locating the state of the hard disk; and alarming according to the state. Compared with the prior art, the method and the device for detecting the state of the hard disk can automatically acquire the smart information of the hard disk at the front moment and the back moment, determine the state of the hard disk and give an alarm according to the state by comparing the smart information at the two moments, automatically complete the whole process by a computer without participation of a user, can timely find the abnormality of the hard disk, and provide convenience for positioning and solving the problem of the hard disk.

Description

Hard disk alarm method and device, computer equipment and storage medium
Technical Field
The invention relates to the technical field of hard disk detection, in particular to a hard disk alarm method, a hard disk alarm device, computer equipment and a storage medium.
Background
smart, also known as s.m.a.r.t., is collectively referred to as "Self-Monitoring Analysis and Reporting Technology", i.e., "Self-Monitoring, Analysis and Reporting Technology", which is an automatic hard disk status detection and warning system and specification. The running conditions of hardware of the hard disk, such as a magnetic head, a disk, a motor and a circuit, are monitored and recorded through a detection instruction in the hard disk hardware, and are compared with a preset safety value set by a manufacturer, if the monitoring conditions are or exceed the safety range of the preset safety value, a warning can be automatically given to a user through the monitoring hardware or software of a host computer, and slight automatic repair can be carried out, so that the safety of hard disk data is ensured in advance.
In the prior art, a hard disk user usually executes a command for acquiring the smart information of the hard disk, analyzes the command execution result, and judges whether the hard disk is abnormal or not, and the mode cannot find the abnormality of the hard disk in time, so that great inconvenience is caused for positioning and solving the problem of the hard disk.
Disclosure of Invention
The invention aims to provide a hard disk alarm method, a hard disk alarm device, computer equipment and a storage medium, which can automatically acquire the smart information of hard disks at two moments before and after, locate the state of the hard disk by comparing the smart information of the two moments, and alarm according to the state.
In order to achieve the above purpose, the embodiment of the present invention adopts the following technical solutions:
in a first aspect, the present invention provides a hard disk alarm method, where the method includes: respectively acquiring smart information of a hard disk at a first moment and a second moment, wherein the first moment is earlier than the second moment; positioning the state of the hard disk according to preset fields in smart information of the first time and the second time; and alarming according to the state.
In a second aspect, the present invention provides a hard disk alarm device, including: the acquisition module is used for respectively acquiring smart information of the hard disk at a first time and a second time, wherein the first time is earlier than the second time; the positioning module is used for positioning the state of the hard disk according to preset fields in smart information of the first time and the second time; and the alarm module is used for giving an alarm according to the state.
In a third aspect, the present invention provides a computer device, the computer device being electrically connected to a hard disk, the computer device comprising: one or more processors; a memory for storing one or more programs that, when executed by the one or more processors, cause the one or more processors to implement the hard disk alert method described above.
In a fourth aspect, the present invention provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the hard disk alert method described above.
Compared with the prior art, the invention has the following beneficial effects: the invention automatically acquires the smart information of the hard disk at the two moments before and after, and compares the smart information at the two moments to position the state of the hard disk and give an alarm aiming at the state.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained according to the drawings without inventive efforts.
Fig. 1 shows a flowchart of a hard disk alarm method according to an embodiment of the present invention.
Fig. 2 is a flowchart illustrating another hard disk alarm method according to an embodiment of the present invention.
Fig. 3 is a flowchart illustrating another hard disk alarm method according to an embodiment of the present invention.
Fig. 4 is a flowchart illustrating another hard disk alarm method according to an embodiment of the present invention.
Fig. 5 is a flowchart illustrating another hard disk alarm method according to an embodiment of the present invention.
Fig. 6 is a flowchart illustrating another hard disk alarm method according to an embodiment of the present invention.
Fig. 7 is a flowchart illustrating another hard disk alarm method according to an embodiment of the present invention.
Fig. 8 is a flowchart illustrating another hard disk alarm method according to an embodiment of the present invention.
Fig. 9 is a block diagram illustrating a hard disk alarm device according to an embodiment of the present invention.
Fig. 10 shows a block schematic diagram of a computer device provided by an embodiment of the present invention.
Icon: 10-a computer device; 11-a processor; 12-a memory; 13-a bus; 14-peripheral interfaces; 100-hard disk alarm device; 110-an obtaining module; 120-a positioning module; 130-alarm module; 140-detection module.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. The components of embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations.
Thus, the following detailed description of the embodiments of the present invention, presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.
In the description of the present invention, it should be noted that if the terms "upper", "lower", "inside", "outside", etc. indicate an orientation or a positional relationship based on that shown in the drawings or that the product of the present invention is used as it is, this is only for convenience of description and simplification of the description, and it does not indicate or imply that the device or the element referred to must have a specific orientation, be constructed in a specific orientation, and be operated, and thus should not be construed as limiting the present invention.
Furthermore, the appearances of the terms "first," "second," and the like, if any, are used solely to distinguish one from another and are not to be construed as indicating or implying relative importance.
It should be noted that the features of the embodiments of the present invention may be combined with each other without conflict.
Referring to fig. 1, fig. 1 is a schematic flowchart illustrating a hard disk alarm method according to an embodiment of the present invention, where the method includes the following steps:
step S100, smart information of the hard disk at a first time and a second time is respectively obtained, wherein the first time is earlier than the second time.
In this embodiment, the time interval between the first time and the second time may be set as needed, or a default setting may be used, it should be noted that, for some fields in the smart information, the time interval must be greater than a preset value to be meaningful, for example, in some manufacturers' smart information, a field for representing the power-on time length is in units of hours, at this time, the interval between the first time and the second time is greater than one hour by default, if the user is set to be less than one hour, the value of this field acquired at the first time and the second time may not be updated, and at this time, the determination cannot be performed according to the value of this field at the first time and the second time.
In this embodiment, the hard Disk may be a mechanical hard Disk or a Solid State Disk (SSD), and it should be noted that specific information included in smart information of the mechanical hard Disk and the SSD may be different, and field identifiers indicating the same meaning may also be different, even though the smart information is the SSD Disk, smart information displayed by different manufacturers may be different, and for some customizable fields, definitions of the fields may be different by different manufacturers, so that a person skilled in the art may adapt according to a field indicating a corresponding meaning in the smart information of the hard Disk on the premise of not paying creative labor, so as to achieve a purpose of positioning the hard Disk in different states.
In this embodiment, as a specific implementation manner, in a linux system, smart information of a hard disk may be obtained by executing a smart command, for example: run under linux system: smartclt-a/dev/sdx to obtain smart information of the hard disk sdx.
In this embodiment, as a specific implementation manner, the smart information at the first time may be the smart information obtained for the first time after the smart function of the hard disk is started, and the smart information at the second time refers to the smart information obtained after the first time and at a preset time interval from the first time. As another specific implementation manner, the smart information at the first time may also be smart information obtained at any preset time, and correspondingly, the second time may also be smart information obtained after the first time and at a preset time interval from the first time.
And S102, positioning the state of the hard disk according to preset fields in smart information at the first time and the second time.
In this embodiment, the preset field is a reference field for determining whether the hard disk is abnormal, for example, in an SSD disk of a certain manufacturer, the field Power _ On _ Hours is used to represent the Power-On duration of the hard disk, and the preset field takes Hours as a unit. If the time interval between the first time and the second time is larger than one hour and the value of the field acquired at the second time is not increased, it can be determined that the calculation of the power-on duration of the hard disk is wrong and the hard disk is in an abnormal state in which the statistics of the power-on duration is abnormal. The preset field may also be a field for representing the number of bad blocks in the hard disk, or a field for representing the number of times of checking errors when the hard disk checks the transmission data, and the like.
And step S103, alarming according to the state.
In this embodiment, the present invention can perform different alarms for different states, for example, if the hard disk is in an abnormal state with wrong calculation of power-on duration, a prompt message "wrong calculation of power-on duration, please pay attention to! If the hard disk is in an abnormal state with abnormal bad blocks, a prompt message of' newly adding bad blocks to the hard disk, please check the hard disk particles or optimize the screening strategy! ". Naturally, for the needs of the application scenario, when the hard disk is in the normal state, a corresponding alarm prompt may also be performed, for example, when the abnormal state of the hard disk needs to be simulated and tested, if the simulation of the abnormal state of the hard disk succeeds, the hard disk should be in the abnormal state at this time, and if the hard disk is still in the normal state, the model hard disk fails abnormally, and at this time, a corresponding alarm may be performed.
It should be noted that, the present embodiment does not limit the specific alarm manner, and the alarm manner may be an alarm manner by displaying characters on a screen, or an alarm manner by controlling a warning light on a hard disk, or an alarm manner by sending a mail or a message to a user, or an alarm manner by making a sound.
The hard disk alarm method provided by the embodiment of the invention automatically acquires the smart information of the hard disks at the front and the back moments, positions the state of the hard disk and alarms according to the state by comparing the smart information of the two moments, the whole process is automatically completed by a computer, a user does not need to participate, the hard disk abnormity can be found in time, convenience is provided for positioning and solving the problem of the hard disk, and meanwhile, the false alarm, the missing alarm or the wrong alarm of the hard disk caused by the error caused by careless field reading due to manual detection are avoided because the detection of workers is not relied.
On the basis of fig. 1, an embodiment of the present invention further provides an implementation manner for specifically locating a bad block abnormality, referring to fig. 2, fig. 2 shows a flow diagram of another hard disk alarm method provided by the embodiment of the present invention, and step S102 includes the following sub-steps:
and a substep S102-10, if the value of the first field at the second moment is greater than the value of the first field at the first moment, locating that the state of the hard disk is a bad block exception.
In this embodiment, the first field is used to represent the number of bad blocks of the hard disk, and in a certain manufacturer, the ID of the first field is 5, and the corresponding description is: the corresponding Chinese meaning is as follows: remapping sector count, each hard disk has a certain number of spare sectors, and the spare sectors are used for replacing the sectors when read-write errors occur in normal sectors so as to maintain the stability of the hard disk and data. For the SSD disk, since the SSD disk write data is in units of blocks, the corresponding meaning of this field is: and remapping block count, wherein if the value of the field is increased, the bad block is increased, the SSD possibly has bad block abnormality, and the bad grain quality of the SSD is indicated or an adopted block screening strategy needs to be optimized.
It should be noted that, in order to enhance the reliability monitoring of hard disk reading and writing, some manufacturers may also use an optional field in smart information to monitor the hard disk reading and writing, and the general method is as follows: for example, a manufacturer may redefine a field with an ID of 160 in smart information of the SSD disk, set the field to represent the number of times of reading and writing the bad block, and when the value of the field increases, may also indicate that the bad block is increased, that is, the state of the SSD disk is increased as the bad block.
The hard disk alarm method provided by the embodiment of the invention can locate the state of the hard disk in the abnormal state of the bad block according to the first field at the first moment and the second moment so as to help a user to find the abnormal state of the bad block in time, and take corresponding measures against the abnormal state in time, such as immediately stopping the read-write operation on the hard disk and storing the current running log so as to facilitate the developer to locate and analyze the problem in time.
On the basis of fig. 1, an embodiment of the present invention further provides an implementation manner in which a specific location state is abnormal statistics of power-on time duration, please refer to fig. 3, where fig. 3 shows a flow diagram of another hard disk alarm method provided in the embodiment of the present invention, and step S101 includes the following sub-steps:
and a substep S102-20, if the value of the second field at the second moment is less than or equal to the value of the second field at the first moment, locating the state of the hard disk as the statistical abnormality of the power-on time length.
In this embodiment, the second field is used to represent the accumulated power-on duration of the hard disk, which is usually in hours. In the smart information of the SSD disc of some manufacturers, the second field may be a field with ID 9, and its corresponding description information is: power _ On _ Hours.
As an implementation manner, if the accumulated power-on duration is in hours, it may be determined whether a time interval between the first time and the second time is greater than or equal to one hour, if not, it is no longer determined that the value of the second field at the second time is less than or equal to the second field value at the first time, and no alarm prompt is performed, or a user is prompted: the monitoring period is less than one hour, and the unit of the power-on time statistics is hour. If so, continuing to judge, if the value of the second field at the second moment is less than or equal to the value of the second field at the first moment, positioning the state of the hard disk as the abnormal statistics of the power-on time, otherwise, determining that the hard disk is in the normal state without alarming.
The hard disk alarm method provided by the embodiment of the invention can position the hard disk in the abnormal state of the power-on time length statistics according to the second fields of the first moment and the second moment so as to help a user to find the abnormal state of the power-on time length statistics in time, and take corresponding measures in time aiming at the abnormal state, for example, immediately stopping the execution of the test case related to the power-on time length, and storing the current running log so as to facilitate developers to position and analyze problems in time.
On the basis of fig. 1, an embodiment of the present invention further provides an implementation manner in which a specific location state is a link abnormality, referring to fig. 4, fig. 4 shows a flow diagram of another hard disk alarm method provided by the embodiment of the present invention, and step S101 includes the following sub-steps:
and a substep S102-30, if the value of the third field at the second moment is greater than the value of the third field at the first moment, locating the state of the hard disk as the link abnormity.
In this embodiment, the third field is used to represent the number of times of error check when the hard disk checks the transmission data, and in the smart information of the SSD disk of some manufacturers, the third field may be a field with an ID of 199, and its corresponding description information is: and the UDMA _ CRC _ Error _ Count represents the number of times of Error checking when the hard disk checks the transmission data by adopting CRC checking. Normally, the number of times is not increased when the link is normal, and if the number of times is increased, the number of times of the check error is increased, and in this case, the link quality may be deteriorated or the link quality may be unstable, that is, the link may be abnormal.
As another embodiment, in order to avoid the link quality from accidentally having small fluctuations to cause erroneous judgment, it may also be considered that the link is abnormal when the difference between the value of the third field at the second time and the value of the third field at the first time is greater than a preset number of times.
The hard disk alarm method provided by the embodiment of the invention can locate the state of the hard disk in the link abnormity according to the third fields of the first moment and the second moment so as to help a user to find the link abnormity in time, and take corresponding measures against the abnormity in time, such as immediately stopping reading and writing the hard disk, storing the current running log and finding out the reason of the link abnormity in time.
On the basis of fig. 1, an embodiment of the present invention further provides an implementation manner in which a specific location state is abnormal statistics on the number of times of power-on of a hard disk, please refer to fig. 5, where fig. 5 shows a flow diagram of another hard disk alarm method provided in the embodiment of the present invention, and step S101 includes the following sub-steps:
substeps 102-40 of calculating a difference between the value of the fourth field at the second time instant and the value of the fourth field at the first time instant.
In this embodiment, the fourth field is used to represent the power-on times of the hard disk, and in the smart information of the SSD disk of some manufacturers, the fourth field may be a field with an ID of 12, and the corresponding description information is: and Power _ Cycle _ Count, which represents the Power-on times of the SSD disk.
And a substep S102-41, if the power-on times of the hard disk between the first time and the second time are preset values and the difference value is not equal to the preset value, positioning the state of the hard disk as the statistic abnormality of the power-on times of the hard disk.
In this embodiment, the user may preset the power-on times between the first time and the second time to be a preset value, and then perform the power-on and power-off operation on the hard disk between the first time and the second time.
The hard disk alarm method provided by the embodiment of the invention can position the state that the hard disk is in the abnormal power-on frequency statistics according to the fourth fields of the first moment and the second moment, so as to help a user to find the abnormal power-on frequency statistics of the hard disk in time, and take corresponding measures against the abnormal power-on frequency statistics in time, such as immediately stopping a relevant test case of the power-on frequency of the hard disk, storing a current running log, and timely searching the reason of the abnormal power-on frequency statistics of the hard disk.
In this embodiment, in order to facilitate analysis of smart information at a first time and a second time, the obtained smart information may be stored in a file, and then analyzed, so on the basis of fig. 1, an embodiment of the present invention further provides another specific implementation manner of a hard disk alarm, please refer to fig. 6, where fig. 6 shows a flowchart of another hard disk alarm method provided by the embodiment of the present invention, and after step S100, the method further includes:
step S101, smart information of the first time and the second time is recorded in a file.
In this embodiment, the smart information may be stored in a file, so as to analyze the smart information at the first time and the second time, the smart information at the first time and the second time may be stored in the same file, or the smart information at the first time and the second time may be stored in different files, respectively.
In this embodiment, a period for acquiring smart information may be set in advance, for example, the period is set to 5 minutes, that is, smart information of a hard disk is acquired every 5 minutes, the smart information acquired in this period is the second time, and the smart information acquired in the last period is the first time.
According to the hard disk alarm method provided by the embodiment of the invention, the smart information of the first moment and the second moment is recorded in the file, so that the smart information of a plurality of moments can be conveniently analyzed, the change trend of the preset field in a period of time can be obtained, the influence of the time dimension on the running state of the hard disk can be increased, and the abnormal state of the hard disk related to the time dimension can be positioned.
On the basis of fig. 1, an embodiment of the present invention further provides an implementation manner for determining smart function abnormality, please refer to fig. 7, and fig. 7 shows a flowchart of another hard disk alarm method provided in the embodiment of the present invention, where the method further includes the steps of:
and step S200, if acquisition of smart information of the hard disk fails, determining that smart function of the hard disk is abnormal or connection state of the hard disk is abnormal.
In this embodiment, the hard disk starts the smart function in advance, and in the normal use process of the hard disk, a user may manually turn off the smart function, but when the read-write of the hard disk is abnormal, the smart function is usually turned off automatically, and when the smart function is turned off, the acquisition of the smart information of the hard disk fails. Therefore, the smart information of the hard disk can be determined to be automatically closed according to the failure of the smart information acquisition of the hard disk, and further the possibility of abnormality of the hard disk is determined.
It should be noted that, another abnormal condition may also cause failure in acquiring the smart information of the hard disk, that is, when the connection between the hard disk and the computer device is broken or the connection is abnormal, failure in acquiring the smart information of the hard disk may also be caused.
As a specific implementation manner, the failure to acquire the smart information of the hard disk may be that when the smart tll command is executed, the feedback prompt includes a keyword such as "Disabled" or "No provision", and at this time, it may be determined that the failure to acquire the smart information of the hard disk occurs.
When the smart function of the hard disk is abnormal, the abnormality may be warned, for example, when the smart function of the hard disk adx is abnormal, the following information may be presented: "sdx drive letter does not exist, please check! | A The smart enable of the OR sdx disk is turned off abnormally, please check! | A "and the like.
According to the hard disk alarm method provided by the embodiment of the invention, when acquisition of the smart information of the hard disk fails, the smart function abnormality of the hard disk or the connection state abnormality of the hard disk is determined in time, so that the smart function abnormality is processed in time or the connection state of the hard disk is checked in time, for example, the reading and writing of the hard disk are stopped immediately, the current running log is stored, and the reason of the smart function abnormality is checked in time.
It should be noted that, on the basis of the foregoing embodiment, a person skilled in the art may also obtain other preset fields used in the smart information to locate the state of the hard disk related to the preset fields, for example, the preset fields may be health fields, if the value of the health field is past, the health state of the hard disk is considered to be good, and the read-write data is reliable, if the value of the health field is failed, the health state of the hard disk is considered to be not good, and at this time, the read-write data is unreliable, and the hard disk is recommended to be replaced. The specific implementation manner is similar to the above embodiments, and is not listed here.
On the basis of fig. 1, an embodiment of the present invention further provides an implementation manner for detecting reliability of a hard disk, please refer to fig. 8, where fig. 8 shows a flowchart of another hard disk alarm method provided in the embodiment of the present invention, and the method further includes the steps of:
step S300, if the value of the preset field in the smart information at the first moment is the same as the value of the preset field in the smart information at the second moment, updating the first moment and the second moment according to a preset period, and acquiring new smart information at the first moment and the second moment again so as to perform cycle detection on the hard disk.
In this embodiment, if the value of the preset field in the smart information at the first time is the same as the value of the preset field in the smart information at the second time, and the two are the same and indicate that the hard disk is not abnormal, in order to detect the reliability of the hard disk, the smart information may be cyclically detected according to a preset period, for example, the first time is T1, the second time is T2, a preset period T is provided between T1 and T2, if the preset field value in the smart information at T1 is the same as the preset field value in the smart information at T2, the time T2 is taken as a new first time, the time T2+ T is taken as a new second time, the smart information at the two times is compared again, and thus the cyclic detection is performed, if the two values are both reliable at each time, it is determined that the hard disk is unreliable, otherwise, the hard disk is determined that the hard disk is unreliable.
According to the hard disk alarm method provided by the embodiment of the invention, the reliability of the hard disk can be detected by circularly detecting the smart information according to the preset period.
It should be noted that the user may also specify one or more fields in the smart information that needs to be detected, and at this time, the fields specified by the user may be detected and prompted, for example, when the values of these fields are increased, a prompt "xx field value is increased, the original value is n, the latest value is m, please pay attention to! If the values of these fields are not increased, a prompt may be made or not according to the user's needs, and if the values of these fields are decreased, a corresponding prompt may be made.
It should be further noted that, the sub-steps S101-10 in fig. 2, S101-20 in fig. 3, S101-30 in fig. 4, S101-40 to S101-41 in fig. 5, S101 in fig. 6, S200 in fig. 7, and S300 in fig. 8 may be combined in any two or more combinations, so as to achieve the purpose of positioning different states according to different preset fields simultaneously, so as to respectively alarm different states.
In order to execute the corresponding steps in the above hard disk alarm method embodiment and each possible embodiment, an implementation manner of a hard disk alarm device is given below. Referring to fig. 9, fig. 9 is a block diagram illustrating a hard disk warning device 100 according to an embodiment of the present invention. The hard disk warning device 100 includes: an acquisition module 110, a positioning module 120, an alarm module 130, and a detection module 140.
The obtaining module 110 is configured to obtain smart information of the hard disk at a first time and a second time, respectively, where the first time is earlier than the second time.
And the positioning module 120 is configured to position the state of the hard disk according to preset fields in smart information at the first time and the second time.
As a specific embodiment, the preset field includes a first field, where the first field is used to represent the number of bad blocks of the hard disk, and the positioning module 120 is specifically configured to: and if the value of the first field at the second moment is greater than the value of the first field at the first moment, positioning the state of the hard disk as a bad block exception.
As a specific implementation manner, the preset field further includes a second field, where the second field is used to represent the accumulated power-on duration of the hard disk, and the positioning module 120 is further specifically configured to: and if the value of the second field at the second moment is less than or equal to the value of the second field at the first moment, positioning the state of the hard disk as the statistical abnormality of the electrifying time length.
As a specific implementation manner, the preset field further includes a third field, where the third field is used to represent the number of times of checking errors when the hard disk checks the transmission data, and the positioning module 120 is further specifically configured to: and if the value of the third field at the second moment is greater than the value of the third field at the first moment, the state of the hard disk is positioned as the link abnormity.
As a specific implementation manner, the preset field further includes a fourth field, where the fourth field is used to represent the power-on times of the hard disk, and the positioning module 120 is further specifically configured to: calculating the difference value of the fourth field at the second moment and the value of the fourth field at the first moment; and if the power-on times of the hard disk between the first moment and the second moment are preset values and the difference value is not equal to the preset value, the state of the hard disk is positioned as that the power-on times of the hard disk are abnormal in statistics.
As a specific implementation manner, the hard disk pre-turns on smart function, and the positioning module 120 is further configured to: and if the acquisition of the smart information of the hard disk fails, determining that the function of the smart of the hard disk is abnormal or the connection state of the hard disk is abnormal.
And an alarm module 130, configured to perform an alarm according to the status.
And the detecting module 140 is configured to, if the value of the preset field in the smart information at the first time is the same as the value of the preset field in the smart information at the second time, update the first time and the second time according to a preset period, and obtain new smart information at the first time and the new smart information at the second time again, so as to perform cycle detection on the hard disk. .
Referring to fig. 10, fig. 10 shows a block schematic diagram of the computer device 10 according to the embodiment of the present invention, where the computer device 10 is used to execute the hard disk alarm method in the foregoing embodiment. The computer device 10 comprises a processor 11, a memory 12, a bus 13 and a peripheral interface 14, wherein the processor 11 is connected with the memory 12 through the bus 13, and the computer device 10 is electrically connected with a hard disk through the peripheral interface 14.
The memory 12 is used for storing a program, such as the hard disk alarm device 100 in fig. 9, the hard disk alarm device 100 includes at least one software functional module which can be stored in the memory 12 in a form of software or firmware (firmware), and the processor 11 executes the program after receiving an execution instruction to implement the hard disk alarm method disclosed by the embodiment of the invention.
The processor 11 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware or instructions in the form of software in the processor 11. The processor 11 may be a general-purpose processor, and includes a Central Processing Unit (CPU), a Micro Control Unit (MCU), a Complex Programmable Logic Device (CPLD), a Field Programmable Gate Array (FPGA), and an embedded ARM.
The embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by the processor 11, the hard disk alarm method disclosed in the above embodiment is implemented.
In summary, embodiments of the present invention provide a hard disk alarm method, an apparatus, a computer device, and a storage medium, where the method includes: respectively acquiring smart information of a hard disk at a first moment and a second moment, wherein the first moment is earlier than the second moment; according to preset fields in smart information at a first moment and a second moment, locating the state of the hard disk; and alarming according to the state. Compared with the prior art, the method and the device for locating the hard disk abnormality can automatically obtain the smart information of the hard disk at the front moment and the back moment, locate the state of the hard disk and give an alarm according to the state by comparing the smart information of the two moments, the whole process is automatically completed by a computer, a user does not need to participate, the hard disk abnormality can be timely found, and convenience is provided for locating and solving the hard disk problem.
The above description is only for the specific embodiment of the present invention, but the scope of the present invention is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present invention are included in the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the appended claims.

Claims (11)

1. A hard disk alarm method is characterized by comprising the following steps:
respectively acquiring smart information of a hard disk at a first moment and a second moment, wherein the first moment is earlier than the second moment;
positioning the state of the hard disk according to preset fields in smart information of the first time and the second time;
and alarming according to the state.
2. The hard disk warning method according to claim 1, wherein the preset field includes a first field, the first field is used for representing the number of bad blocks of the hard disk, and the step of locating the state of the hard disk according to the preset field in the smart information at the first time and the second time includes:
and if the value of the first field at the second moment is greater than the value of the first field at the first moment, positioning the state of the hard disk as a bad block exception.
3. The hard disk alarm method according to claim 1, wherein the preset field further includes a second field, the second field is used for representing an accumulated power-on duration of the hard disk, and the step of locating the state of the hard disk according to the preset field in the smart information at the first time and the second time includes:
and if the value of the second field at the second moment is smaller than or equal to the value of the second field at the first moment, positioning the state of the hard disk as the statistic abnormality of the power-on time length.
4. The hard disk warning method according to claim 1, wherein the preset fields further include a third field, the third field is used for representing the number of times of checking errors when the hard disk checks the transmission data, and the step of locating the state of the hard disk according to the preset fields in the smart information at the first time and the second time includes:
and if the value of the third field at the second moment is greater than the value of the third field at the first moment, the state of the hard disk is positioned as a link abnormity.
5. The hard disk alarm method according to claim 1, wherein the preset fields further include a fourth field, the fourth field is used for representing the number of times of powering on the hard disk, and the step of locating the state of the hard disk according to the preset fields in the smart information of the hard disk at the first time and the second time includes:
calculating a difference between a value of the fourth field at the second time and a value of the fourth field at the first time;
and if the power-on times of the hard disk between the first moment and the second moment are preset values and the difference value is not equal to the preset value, positioning the state of the hard disk as the statistic abnormality of the power-on times of the hard disk.
6. The hard disk warning method according to claim 1, wherein the hard disk pre-activates smart function, the method further comprising:
and if acquisition of smart information of the hard disk fails, determining that smart function of the hard disk is abnormal or connection state of the hard disk is abnormal.
7. The hard disk alarm method according to claim 1, wherein the smart information at the first time is smart information obtained for the first time after the smart function of the hard disk is started, and the smart information at the second time is smart information obtained after the first time and at a preset time interval from the first time.
8. The hard disk alerting method of claim 1, further comprising:
and if the value of the preset field in the smart information at the first moment is the same as the value of the preset field in the smart information at the second moment, updating the first moment and the second moment according to a preset period, and acquiring new smart information at the first moment and the second moment again so as to perform cycle detection on the hard disk.
9. A hard disk warning device, the device comprising:
the acquisition module is used for respectively acquiring smart information of the hard disk at a first time and a second time, wherein the first time is earlier than the second time;
the positioning module is used for positioning the state of the hard disk according to preset fields in smart information of the first time and the second time;
and the alarm module is used for giving an alarm according to the state.
10. A computer device, wherein the computer device is electrically connected to a hard disk, the computer device comprising:
one or more processors;
memory for storing one or more programs that, when executed by the one or more processors, cause the one or more processors to implement the hard disk alert method of any of claims 1-8.
11. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the hard disk alert method according to any one of claims 1 to 8.
CN202011125864.8A 2020-10-20 2020-10-20 Hard disk alarm method, device, computer equipment and storage medium Active CN112256535B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011125864.8A CN112256535B (en) 2020-10-20 2020-10-20 Hard disk alarm method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011125864.8A CN112256535B (en) 2020-10-20 2020-10-20 Hard disk alarm method, device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112256535A true CN112256535A (en) 2021-01-22
CN112256535B CN112256535B (en) 2023-08-22

Family

ID=74245087

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011125864.8A Active CN112256535B (en) 2020-10-20 2020-10-20 Hard disk alarm method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112256535B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113903368A (en) * 2021-10-15 2022-01-07 江苏芯盛智能科技有限公司 Automatic testing method, device and equipment for disk and storage medium

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103197995A (en) * 2012-01-04 2013-07-10 百度在线网络技术(北京)有限公司 Hard disk fault detection method and device
CN105893231A (en) * 2016-05-06 2016-08-24 思创数码科技股份有限公司 Method and device for predicting hard disk sub-health index based on SMART (self-monitoring analysis and reporting technology)
CN107729199A (en) * 2017-10-19 2018-02-23 郑州云海信息技术有限公司 The hard disk detection method and system of a kind of storage device
CN109117327A (en) * 2018-07-20 2019-01-01 郑州云海信息技术有限公司 A kind of hard disk detection method and device
CN109408328A (en) * 2018-10-08 2019-03-01 郑州云海信息技术有限公司 A kind of monitoring method, device and the equipment of hard disk health status
CN110399238A (en) * 2019-06-27 2019-11-01 浪潮电子信息产业股份有限公司 A kind of disk failure method for early warning, device, equipment and readable storage medium storing program for executing
CN110413463A (en) * 2019-06-29 2019-11-05 苏州浪潮智能科技有限公司 A kind of SMART information inspection method of hard disk
CN110532139A (en) * 2019-07-31 2019-12-03 苏州浪潮智能科技有限公司 Method for early warning and device
CN111104275A (en) * 2019-12-24 2020-05-05 湖南国科微电子股份有限公司 Automatic testing method and device for flash SSD hard disk power supply
CN111563022A (en) * 2020-05-12 2020-08-21 中国民航信息网络股份有限公司 Centralized storage monitoring method and device
CN111682977A (en) * 2020-04-30 2020-09-18 普联技术有限公司 Method and device for processing exception of network equipment, storage medium and network equipment

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103197995A (en) * 2012-01-04 2013-07-10 百度在线网络技术(北京)有限公司 Hard disk fault detection method and device
CN105893231A (en) * 2016-05-06 2016-08-24 思创数码科技股份有限公司 Method and device for predicting hard disk sub-health index based on SMART (self-monitoring analysis and reporting technology)
CN107729199A (en) * 2017-10-19 2018-02-23 郑州云海信息技术有限公司 The hard disk detection method and system of a kind of storage device
CN109117327A (en) * 2018-07-20 2019-01-01 郑州云海信息技术有限公司 A kind of hard disk detection method and device
CN109408328A (en) * 2018-10-08 2019-03-01 郑州云海信息技术有限公司 A kind of monitoring method, device and the equipment of hard disk health status
CN110399238A (en) * 2019-06-27 2019-11-01 浪潮电子信息产业股份有限公司 A kind of disk failure method for early warning, device, equipment and readable storage medium storing program for executing
CN110413463A (en) * 2019-06-29 2019-11-05 苏州浪潮智能科技有限公司 A kind of SMART information inspection method of hard disk
CN110532139A (en) * 2019-07-31 2019-12-03 苏州浪潮智能科技有限公司 Method for early warning and device
CN111104275A (en) * 2019-12-24 2020-05-05 湖南国科微电子股份有限公司 Automatic testing method and device for flash SSD hard disk power supply
CN111682977A (en) * 2020-04-30 2020-09-18 普联技术有限公司 Method and device for processing exception of network equipment, storage medium and network equipment
CN111563022A (en) * 2020-05-12 2020-08-21 中国民航信息网络股份有限公司 Centralized storage monitoring method and device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113903368A (en) * 2021-10-15 2022-01-07 江苏芯盛智能科技有限公司 Automatic testing method, device and equipment for disk and storage medium

Also Published As

Publication number Publication date
CN112256535B (en) 2023-08-22

Similar Documents

Publication Publication Date Title
US5663656A (en) System and method for executing on board diagnostics and maintaining an event history on a circuit board
US8140837B2 (en) Automatically making selective changes to firmware or configuration settings
CN109117327A (en) A kind of hard disk detection method and device
JPH10105343A (en) Computer data storage system
CN111048139A (en) Storage medium detection method, device, equipment and readable storage medium
JP2000221238A (en) Testing system for self-testing circuit board
CN112256535B (en) Hard disk alarm method, device, computer equipment and storage medium
US8482307B2 (en) Method and apparatus for the prevention of untested or improperly tested printed circuit boards from being used in a fire pump control system
CN103049345A (en) Magnetic disk state transition detection method and device based on asynchronous communication mechanism
CN108899059B (en) Detection method and equipment for solid state disk
CN111048138A (en) Hard disk fault detection method and related device
US8799608B1 (en) Techniques involving flaky path detection
CN116225802A (en) Fault testing method and device and computing equipment
CN113625957B (en) Method, device and equipment for detecting hard disk faults
US11726853B2 (en) Electronic control device
CN113917385A (en) Self-detection method and system for electric energy meter
JP6094685B2 (en) Information processing apparatus and information processing apparatus control program
TW202242655A (en) Method, computer system and computer program product for storing state data of finite state machine
CN107766251B (en) Detection method, system and device for loading image and readable storage medium
CN112099383A (en) Avionic device self-checking control module
CN113626303B (en) Server device
CN111190781A (en) Test self-check method of server system
CN116414611A (en) Redundant storage-based fault positioning system for power-on self-checking equipment
TWI775360B (en) Storage device for recording status of hardware component of computer system and computer implementation method thereof
CN113220496B (en) Method, system and state machine for detecting abnormal IPMI command interaction times between BIOS and BMC

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant