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

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

Info

Publication number
CN112256535B
CN112256535B CN202011125864.8A CN202011125864A CN112256535B CN 112256535 B CN112256535 B CN 112256535B CN 202011125864 A CN202011125864 A CN 202011125864A CN 112256535 B CN112256535 B CN 112256535B
Authority
CN
China
Prior art keywords
hard disk
moment
field
time
smart information
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.)
Active
Application number
CN202011125864.8A
Other languages
Chinese (zh)
Other versions
CN112256535A (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

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

Abstract

The invention relates to the technical field of hard disk detection, and provides a hard disk alarming method, a device, computer equipment and a storage medium, wherein the method comprises the following steps: the smart information of the hard disk at a first moment and a second moment is respectively obtained, wherein the first moment is earlier than the second moment; positioning the state of the hard disk according to preset fields in the smart information at the first moment and the second moment; and alarming according to the state. Compared with the prior art, the embodiment of the invention can automatically acquire the smart information of the hard disk at the front moment and the rear moment, and the smart information at the two moments is compared to determine the state of the hard disk and alarm the state, so that the whole process is automatically completed by a computer, the user does not need to participate, the abnormality of the hard disk can be found in time, and convenience is provided for positioning and solving the problem of the hard disk.

Description

Hard disk alarm method, device, computer equipment and storage medium
Technical Field
The present invention relates to the field of hard disk detection technologies, and in particular, to a method and apparatus for hard disk alarm, a computer device, and a storage medium.
Background
smart, also known as s.m. a.r.t., is known as "Self-Monitoring Analysis and Reporting Technology," i.e., "Self-monitoring, analysis, and reporting techniques," smart is an automatic hard disk state detection and early warning system and specification. The operation conditions of hardware such as magnetic heads, discs, motors and circuits of the hard disk are monitored and recorded through detection instructions in the hardware of the hard disk and compared with preset safety values set by manufacturers, and if the monitoring conditions are beyond the safety range of the preset safety values, the monitoring hardware or software of a host can automatically warn a user and carry out slight automatic repair so as to ensure the safety of the data of the hard disk in advance.
In the prior art, a hard disk user usually executes a command for acquiring hard disk smart information, the user analyzes the command execution result, and the user judges whether the hard disk is abnormal or not, so that the hard disk abnormality cannot be found in time, and great inconvenience is caused to positioning and solving the hard disk problem.
Disclosure of Invention
The invention aims to provide a hard disk alarming method, a device, computer equipment and a storage medium, which can automatically acquire the smart information of a hard disk at the front moment and the rear moment, and position the state of the hard disk and alarm the state by comparing the smart information at the two moments, wherein the whole process is automatically completed by a computer without participation of a user, so that the abnormality of the hard disk can be found in time, and convenience is provided for positioning and solving the problem of the hard disk.
In order to achieve the above object, the technical scheme adopted by the embodiment of the invention is as follows:
in a first aspect, the present invention provides a hard disk alert method, the method comprising: the smart information of the hard disk at a first moment and a second moment is respectively obtained, wherein the first moment is earlier than the second moment; positioning the state of the hard disk according to preset fields in the smart information at the first moment and the second moment; and alarming according to the state.
In a second aspect, the present invention provides a hard disk alert device, the device comprising: the device comprises an acquisition module, a storage module and a storage module, wherein the acquisition module is used for respectively acquiring smart information of a hard disk at a first moment and a second moment, and the first moment is earlier than the second moment; the positioning module is used for positioning the state of the hard disk according to preset fields in the smart information at the first moment and the second moment; and the alarm module is used for alarming according to the state.
In a third aspect, the present invention provides a computer device electrically connected to a hard disk, the computer device comprising: one or more processors; and 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 front moment and the rear moment, and compares the smart information at the two moments to locate the state of the hard disk and give an alarm for the state, and the whole process is automatically completed by the computer without participation of a user, so that the abnormality of the hard disk can be found in time, and convenience is provided for locating and solving the problem of the hard disk.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the embodiments will be briefly described below, it being understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and other related drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 shows a flow chart of a hard disk warning method according to an embodiment of the present invention.
Fig. 2 is a schematic flow chart of another method for warning a hard disk according to an embodiment of the present invention.
Fig. 3 is a schematic flow chart of another method for warning a hard disk according to an embodiment of the present invention.
Fig. 4 is a schematic flow chart of another method for warning a hard disk according to an embodiment of the present invention.
Fig. 5 shows a flowchart of another hard disk alert method according to an embodiment of the present invention.
Fig. 6 is a schematic flow chart of another method for warning a hard disk according to an embodiment of the present invention.
Fig. 7 is a schematic flow chart of another method for warning a hard disk according to an embodiment of the present invention.
Fig. 8 is a schematic flow chart of another method for warning a hard disk according to an embodiment of the present invention.
Fig. 9 is a schematic block diagram of a hard disk alarm device according to an embodiment of the present invention.
Fig. 10 shows a block schematic diagram of a computer device according to an embodiment of the present invention.
Icon: 10-a computer device; 11-a processor; 12-memory; 13-bus; 14-a peripheral interface; 100-a hard disk alarm device; 110-an acquisition module; 120-positioning module; 130-an alarm module; 140-detection module.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments of the present invention. The components of the 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 invention, as 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 made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
It should be noted that: like reference numerals and letters denote like items in the following figures, and thus once an item is defined in one figure, no further definition or explanation thereof is necessary in the following figures.
In the description of the present invention, it should be noted that, if the terms "upper", "lower", "inner", "outer", and the like indicate an azimuth or a positional relationship based on the azimuth or the positional relationship shown in the drawings, or the azimuth or the positional relationship in which the inventive product is conventionally put in use, it is merely for convenience of describing the present invention and simplifying the description, and it is not indicated or implied that the apparatus or element referred to must have a specific azimuth, be configured and operated in a specific azimuth, and thus it should not be construed as limiting the present invention.
Furthermore, the terms "first," "second," and the like, if any, are used merely for distinguishing between descriptions and not for indicating or implying a 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 shows a flow chart of a hard disk alarming method according to an embodiment of the invention, and the method includes the following steps:
step S100, smart information of the hard disk at a first moment and a second moment is acquired respectively, wherein the first moment is earlier than the second moment.
In this embodiment, the time interval between the first time and the second time may be set according to needs, or default setting may be used, which needs to be described that, for some fields in the smart information, the time interval must be larger than a preset value to make sense, for example, in the smart information of some manufacturers, a field for characterizing the power-on duration is in units of hours, at this time, the interval between the first time and the second time is default to be larger than one hour, if the user sets to be smaller than one hour, the values of the field acquired at the first time and the second time may not be updated, and at this time, the judgment cannot be made according to the values of the 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 smart information of the SSD Disk may be different, field identifiers representing the same meaning may be different, even if they are all SSD disks, smart information displayed by different manufacturers may be different, and for some fields that may be customized, definitions of the fields by different manufacturers may be different, so those skilled in the art may adapt according to fields that represent corresponding meanings in smart information of the hard Disk without performing creative labor, so as to achieve the purpose of locating the hard Disk in different states.
In this embodiment, as a specific implementation manner, under the linux system, smart information of the hard disk may be obtained by executing a smart trl command, for example: run under the linux system: smarttl-a/dev/sdx to obtain the smart information of the hard disk sdx.
In this embodiment, as a specific implementation manner, the smart information at the first time may be smart information obtained for the first time after the hard disk is started and the smart function is started, and the smart information at the second time may be smart information obtained after the first time and when a preset time period is separated from the first time. As another specific embodiment, 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 when a preset time period is separated from the first time.
Step S102, locating the state of the hard disk according to the preset field in the smart information at the first moment and the second moment.
In this embodiment, the preset field is a reference field for determining whether an abnormality occurs in the hard disk, for example, in an SSD disk of a manufacturer, a field power_on_Hours is used to characterize the Power-On duration of the hard disk, and is in units of Hours. If the time interval between the first time and the second time is greater than one hour and the value of the field acquired at the second time is not increased, the calculation error of the power-on duration of the hard disk can be judged, and the hard disk is in an abnormal state that the statistics of the power-on duration is abnormal. The preset field may also be a field for characterizing the number of bad blocks of the hard disk, or a field for characterizing the number of check errors when the hard disk checks the transmission data, etc.
Step S103, alarming according to the state.
In this embodiment, the present invention may perform different alarms for different states, for example, if the hard disk is in an abnormal state with power-on duration calculation error, a prompt message "power-on duration calculation error, please pay attention to-! If the hard disk is in an abnormal state with abnormal bad blocks, prompt information of' hard disk newly added bad blocks, please check hard disk particles or optimize screening strategies! ". Of course, due to the requirement of an application scene, when the hard disk is in a normal state, a corresponding alarm prompt can be performed, for example, when simulation test is required to be performed on the abnormal state of the hard disk, if the simulation of the abnormal state of the hard disk is successful, 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 can be performed.
It should be noted that, the embodiment is not limited to a specific alarm mode, and the alarm mode may be a mode of displaying characters on a screen, or may be a mode of controlling an alarm lamp on a hard disk to alarm, or sending mail or information to a user, or sending sound to alarm, etc.
The method for alarming the hard disk automatically acquires the smart information of the hard disk at the front moment and the rear moment, and compares the smart information at the front moment and the rear moment to locate the state of the hard disk and alarm the state, the whole process is automatically completed by a computer without participation of a user, the hard disk abnormality can be timely found, convenience is provided for locating and solving the problem of the hard disk, and meanwhile, errors caused by carelessly looking wrong fields in manual detection, misinformation, missing report or misinformation of the hard disk alarm are avoided because of independent detection of workers.
On the basis of fig. 1, the embodiment of the present invention further provides an implementation manner of a specific positioning state being a bad block exception, referring to fig. 2, fig. 2 shows a flow chart of another hard disk alert method provided by the embodiment of the present invention, and step S102 includes the following substeps:
and step S102-10, if the value of the first field at the second moment is larger than that at the first moment, locating the state of the hard disk as bad block abnormality.
In this embodiment, the first field is used to characterize the number of bad blocks of the hard disk, where in a certain factory, the ID of the first field is 5, and the corresponding description is: the corresponding Chinese meaning is: the sector count is remapped, and each hard disk has a certain number of spare sectors, so that the spare sectors are used for replacing the normal sectors when the normal sectors have read-write errors so as to maintain the stability of the hard disk and data. For an SSD disk, since SSD disk write data is in units of blocks, the meaning of this field corresponds to: if the value of the field increases, it means that the bad block increases, and there may be bad block abnormality in the SSD disc, which means that the quality of the granule of the SSD disc is bad or that the adopted block screening policy needs to be optimized.
It should be noted that, in order to enhance the reliability monitoring of the hard disk read-write, some manufacturers also use optional fields in the smart information to monitor the hard disk read-write, which generally adopts the following ways: redefining a certain or some optional fields gives a specific meaning to perform special monitoring, for example, a manufacturer may redefine a field with an ID of 160 in the smart information of the SSD disc, set the field to represent the number of times of reading and writing bad blocks, and when the value of the field increases, it may also indicate that the bad blocks increase, that is, the state in which the SSD disc is in is the bad blocks increase.
According to the hard disk alarming method provided by the embodiment of the invention, the hard disk is positioned in the abnormal state of the bad block according to the first fields of the first moment and the second moment, so that a user can find the abnormal state of the bad block in time, and timely take corresponding measures for the abnormal state, for example, immediately stopping the read-write operation of the hard disk, and saving the current operation log, so that a developer can conveniently position and analyze the problem in time.
On the basis of fig. 1, the embodiment of the present invention further provides an implementation manner in which a specific positioning state is a statistical abnormality of a power-on duration, please refer to fig. 3, fig. 3 shows a schematic flow chart of another hard disk alert method provided by the embodiment of the present invention, and step S101 includes the following substeps:
and S102-20, 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, locating the state of the hard disk as the power-on duration statistical abnormality.
In this embodiment, the second field is used to characterize the accumulated power-on duration of the hard disk, typically in hours. In the smart information of the SSD disc of some manufacturers, the second field may be a field with ID of 9, and the corresponding description information is: power_on_Hours.
As an embodiment, if the accumulated power-on duration is in units of hours, it may be determined whether the time interval between the first time and the second time is greater than or equal to one hour, and if not, it is not further determined that the value of the second field at the second time is less than or equal to the value of the second field at the first time, and no alarm is performed, or the user is prompted: the monitoring period is less than one hour, and the unit of power-on duration statistics is the hour. If yes, continuing to judge, 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, locating the state of the hard disk as the statistical abnormality of the power-on duration, otherwise, determining that the hard disk is in a normal state without warning.
According to the hard disk alarming method provided by the embodiment of the invention, the state that the hard disk is in the abnormal state of the statistics of the power-on time length can be positioned according to the second fields of the first time and the second time, so that a user can be helped to timely find the abnormal state of the statistics of the power-on time length, timely take corresponding measures for the abnormal state, for example, immediately stop executing the test cases related to the power-on time length, and save the current running log, so that a developer can conveniently and timely position and analyze the problems.
On the basis of fig. 1, the embodiment of the present invention further provides an implementation manner in which a specific positioning state is a link abnormality, referring to fig. 4, fig. 4 shows a flow chart of another hard disk alert method provided by the embodiment of the present invention, and step S101 includes the following sub-steps:
in the substep S102-30, if the value of the third field at the second time is greater than the value of the third field at the first time, the state of the hard disk is located as the link abnormality.
In this embodiment, the third field is used to characterize the number of checking errors 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 ID of 199, and the corresponding description information is: UDMA_CRC_error_count represents the number of errors that the hard disk checks for the transmitted data using CRC check. In general, when the link is normal, the number of times is not increased, and if the number of times is increased, this means that the number of times of checking errors is increased, at this time, the link quality may be deteriorated or the link quality may be unstable, that is, the link is abnormal.
As another embodiment, in order to avoid erroneous judgment caused by occasional small fluctuations in link quality, it is also possible to consider 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.
According to the hard disk alarming method provided by the embodiment of the invention, the state that the hard disk is in the abnormal state of the link can be positioned according to the third fields of the first moment and the second moment, so that a user can be helped to find out the abnormal state of the link in time, and timely take corresponding measures for the abnormal state, for example, immediately stopping the reading and writing of the hard disk, saving the current operation log, and timely checking out the reason of the abnormal state of the link.
On the basis of fig. 1, the embodiment of the present invention further provides an implementation manner of statistics of the number of times of power-up of the hard disk in a specific positioning state, please refer to fig. 5, fig. 5 shows a schematic flow chart of another hard disk alarming method provided by the embodiment of the present invention, and step S101 includes the following sub-steps:
substep S102-40, calculating a difference between the value of the fourth field at the second time and the value of the fourth field at the first time.
In this embodiment, the fourth field is used to characterize the number of times of powering on the hard disk, and in the smart information of the SSD disk of some manufacturers, the fourth field may be a field with ID of 12, and the corresponding description information is: power_cycle_count represents the number of Power-up times of the SSD disk.
And S102-41, if the number of times of powering up the hard disk between the first moment and the second moment is a preset value and the difference value is not equal to the preset value, locating the state of the hard disk as the statistical abnormality of the number of times of powering up the hard disk.
In this embodiment, the user may preset the number of times of power-up between the first time and the second time to a preset value, and then perform power-up and power-down operations on the hard disk between the first time and the second time.
According to the hard disk alarming method provided by the embodiment of the invention, the state that the hard disk is in the abnormal statistics of the number of times of electrification is positioned according to the fourth fields of the first time and the second time, so that a user can be helped to timely find the abnormal statistics of the number of times of electrification of the hard disk, timely take corresponding measures for the abnormal statistics, for example, immediately stop the relevant test cases of the number of times of electrification of the hard disk, save the current running log and timely check the reason of the abnormal statistics of the number of times of electrification of the hard disk.
In this embodiment, in order to facilitate analysis of smart information at the first time and the second time, the acquired smart information may be saved in a file and then analyzed, so on the basis of fig. 1, the embodiment of the present invention further provides another specific implementation manner of hard disk alarm, please refer to fig. 6, fig. 6 shows a flow diagram of another hard disk alarm method provided by the embodiment of the present invention, and after step S100, the method further includes the steps of:
step S101, smart information at 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 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.
In this embodiment, the period for acquiring the smart information may be set in advance, for example, the period is set to 5 minutes, that is, the smart information of the hard disk is acquired every 5 minutes, the smart information acquired in the period is the second time, and the smart information acquired in the previous period is the first time.
According to the hard disk alarming method provided by the embodiment of the invention, the smart information at the first moment and the second moment is recorded in the file, so that the smart information at the plurality of moments is conveniently analyzed, the change trend of the preset field in a period of time is obtained, the influence of the time dimension on the running state of the hard disk is increased, and the abnormal state of the hard disk related to the time dimension is positioned.
On the basis of fig. 1, the embodiment of the present invention further provides an implementation manner for determining a smart function abnormality, referring to fig. 7, fig. 7 shows a flow chart of another hard disk alert method provided by the embodiment of the present invention, where the method further includes the steps of:
in step S200, if the smart information of the hard disk fails to be acquired, determining that the smart function of the hard disk is abnormal or the connection state of the hard disk is abnormal.
In this embodiment, the smart function is started in advance by the hard disk, and in the normal use process of the hard disk, the user can manually close the smart function, but when the read-write of the hard disk is abnormal, the smart function is usually also automatically closed, and in the case that the smart function is closed, acquiring the smart information of the hard disk fails to acquire. Therefore, the hard disk smart information can be determined to be automatically closed according to the smart information acquisition failure of the hard disk, and further the hard disk is determined to be possibly abnormal.
It should be noted that, another abnormal situation 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 an abnormality occurs, the smart information of the hard disk may also be caused to be acquired.
In one embodiment, the failure to acquire the smart information of the hard disk may be determined by including keywords such as "Disabled" or "No device" in the feedback prompt when executing the smart command.
It should be noted that, when the smart function of the hard disk is abnormal, the abnormality may be alerted, for example, when the smart function of the hard disk adx disk is abnormal, information may be prompted: "sdx disk drive does not exist, please check-! The following is carried out The smart enable of the OR sdx disk is abnormally turned off, please check ≡! The following is carried out "etc.
According to the hard disk alarming method provided by the embodiment of the invention, when the smart information of the hard disk fails to be acquired, the smart function abnormality of the hard disk or the connection state abnormality of the hard disk is timely determined so as to timely process the smart function abnormality or timely check the connection state of the hard disk, for example, the reading and writing of the hard disk are immediately stopped, the current running log is saved, and the reason of the smart function abnormality is timely checked.
It should be noted that, based on the above embodiment, a person skilled in the art may also obtain other preset fields 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 passed, the health state of the hard disk is considered to be good, 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 bad, at this time, the read-write data is unreliable, and the replacement of the hard disk is suggested. The specific implementation is similar to the above embodiment and is not listed here.
On the basis of fig. 1, the embodiment of the present invention further provides an implementation manner for detecting the reliability of the hard disk, referring to fig. 8, fig. 8 shows a flow chart of another hard disk alarm method provided by 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 the preset period, and acquiring the smart information at the new first moment and the new second moment again so as to carry out 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 values are the same, and if no abnormality occurs in the hard disk, in order to detect the reliability of the hard disk, the smart information may be detected in a cyclic manner according to a preset period, for example, the first time is T1, the second time is T2, a preset period T is spaced between T1 and T2, if the value of the preset field in the smart information at T1 is the same as the value of the preset field in the smart information at T2, the T2 time is taken as a new first time, the t2+t time is taken as a new second time, and if the two values are the same in each comparison, the hard disk is determined to be reliable, otherwise, the hard disk is determined to be unreliable.
According to the hard disk alarming 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 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, the prompt "xx field value is increased, the original value is n, the latest value is m, please pay attention to-! If the values of the fields are not increased, the prompt or not according to the user requirement can be performed, and if the values of the fields are reduced, the corresponding prompt can be performed.
It should be further noted that, the above-mentioned 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 arbitrarily combined two by two or more, so as to achieve the purpose of simultaneously positioning different states according to different preset fields, so as to respectively alarm different states.
In order to execute the above-mentioned embodiments of the hard disk alert method and corresponding steps in each possible implementation manner, an implementation manner of the hard disk alert device is given below. Referring to fig. 9, fig. 9 is a block diagram illustrating a hard disk alarm device 100 according to an embodiment of the invention. The hard disk warning device 100 includes: the system comprises 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, where the first time is earlier than the second time.
The positioning module 120 is configured to position the state of the hard disk according to a preset field in the 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 characterize the number of bad blocks of the hard disk, and the positioning module 120 is specifically configured to: if the value of the first field at the second moment is larger than that of the first field at the first moment, the state of the hard disk is positioned to be bad block abnormality.
As a specific embodiment, the preset field further includes a second field, where the second field is used to characterize an accumulated power-on duration of the hard disk, and the positioning module 120 is specifically further configured to: 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, the state of the hard disk is positioned to be the statistical abnormality of the power-on duration.
As a specific embodiment, the preset field further includes a third field, where the third field is used to characterize the number of checking errors when the hard disk checks the transmission data, and the positioning module 120 is specifically further configured to: if the value of the third field at the second moment is larger than the value of the third field at the first moment, the state of the hard disk is positioned to be abnormal.
As a specific embodiment, the preset field further includes a fourth field, where the fourth field is used to characterize the number of times the hard disk is powered on, and the positioning module 120 is specifically further configured to: calculating a difference between the value of the fourth field at the second time and the value of the fourth field at the first time; if the number of times of powering up the hard disk between the first moment and the second moment is a preset value and the difference value is not equal to the preset value, the state of the hard disk is positioned to be the statistical abnormality of the number of times of powering up the hard disk.
As a specific embodiment, the hard disk pre-opens the smart function, and the positioning module 120 is further configured to: if the smart information of the hard disk fails to be acquired, determining that the smart function of the hard disk is abnormal or the connection state of the hard disk is abnormal.
And the alarm module 130 is used for alarming according to the state.
The detection module 140 is configured to update the first time and the second time according to a preset period 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 acquire the smart information at the new first time and the new second time again, so as to perform cycle detection on the hard disk. .
The embodiment of the invention also provides a computer device 10 for executing the hard disk warning method in the embodiment, please refer to fig. 10, fig. 10 shows a block schematic diagram of the computer device 10 according to the embodiment of the invention. The computer device 10 comprises a processor 11, a memory 12, a bus 13, a peripheral interface 14, the processor 11 being connected to the memory 12 via the bus 13, the computer device 10 being electrically connected to the hard disk via the peripheral interface 14.
The memory 12 is used for storing a program, for example, the hard disk alert device 100 in fig. 9, where the hard disk alert device 100 includes at least one software functional module that may be stored in the memory 12 in the form of software or firmware (firmware), and the processor 11 executes the program after receiving the execution instruction to implement the hard disk alert method disclosed in the embodiment of the present invention.
The processor 11 may be an integrated circuit chip with signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware in the processor 11 or by instructions in the form of software. The processor 11 may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU), a micro control unit (Microcontroller Unit, MCU), a complex programmable logic device (Complex Programmable Logic Device, CPLD), a Field-programmable gate array (Field-Programmable Gate Array, FPGA), an embedded ARM, or the like.
The embodiment of the invention also provides a computer readable storage medium, on which a computer program is stored, which when executed by the processor 11 implements the hard disk warning method disclosed in the above embodiment.
In summary, the embodiments of the present invention provide a method, an apparatus, a computer device, and a storage medium for hard disk alert, where the method includes: the smart information of the hard disk at a first moment and a second moment is respectively obtained, wherein the first moment is earlier than the second moment; positioning the state of the hard disk according to preset fields in the smart information at the first moment and the second moment; and alarming according to the state. Compared with the prior art, the embodiment of the invention can automatically acquire the smart information of the hard disk at the front moment and the rear moment, and the smart information at the two moments is compared to locate the state of the hard disk and give an alarm for the state, so that the whole process is automatically completed by a computer, the participation of a user is not needed, the abnormality of the hard disk can be timely found, and convenience is provided for locating and solving the problem of the hard disk.
The foregoing is merely illustrative of the present invention, and the present invention is not limited thereto, and any changes or substitutions easily contemplated by those skilled in the art within the scope of the present invention should be included in the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (10)

1. A hard disk alert method, the method comprising:
the smart information of the hard disk at a first moment and a second moment is respectively obtained, wherein the first moment is earlier than the second moment;
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 and the values of the preset field are the same, and the two values indicate that the hard disk is not abnormal, updating the first moment and the second moment according to a preset period, and acquiring the smart information at the new first moment and the new second moment again so as to circularly detect the hard disk;
comparing preset fields in the smart information at the first moment and the second moment, and positioning the state of the hard disk; the preset field is a reference field for judging whether the hard disk is abnormal or not;
and alarming according to the states, wherein different states correspond to different alarming prompt messages.
2. The hard disk warning method according to claim 1, wherein the preset field includes a first field, the first field is used for characterizing 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 larger than the value of the first field at the first moment, locating the state of the hard disk as a bad block abnormality.
3. The hard disk warning method according to claim 1, wherein the preset field further includes a second field, the second field is used for characterizing 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:
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, the state of the hard disk is positioned to be the power-on time length statistical abnormality.
4. The hard disk alert method as claimed in claim 1, wherein the preset field further includes a third field, the third field is used for characterizing the number 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 field 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 larger than the value of the third field at the first moment, locating the state of the hard disk as a link abnormality.
5. The hard disk alarming method of claim 1, wherein the preset field further comprises a fourth field, the fourth field is used for representing the number of times of powering up the hard disk, and the step of locating the state of the hard disk according to the preset field in the smart information of the hard disk at the first moment and the second moment comprises:
calculating a difference between the value of the fourth field at the second time and the value of the fourth field at the first time;
if the number of times of powering up the hard disk between the first moment and the second moment is a preset value and the difference value is not equal to the preset value, locating the state of the hard disk as the statistical abnormality of the number of times of powering up the hard disk.
6. The hard disk alert method as claimed in claim 1, the hard disk pre-opening smart function, the method further comprising:
and if the smart information of the hard disk fails to be acquired, determining that the smart function of the hard disk is abnormal or the connection state of the hard disk is abnormal.
7. The hard disk warning method as claimed in claim 1, wherein the smart information at the first time is smart information obtained for the first time after the start of the smart function of the hard disk, and the smart information at the second time is smart information obtained after the first time and a predetermined time period from the first time.
8. A hard disk alert device, the device comprising:
the device comprises an acquisition module, a storage module and a storage module, wherein the acquisition module is used for respectively acquiring smart information of a hard disk at a first moment and a second moment, and the first moment is earlier than the second moment;
the detection module is used for updating the first moment and the second moment according to a preset period if the value of a 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 and the values of the preset field are the same to indicate that the hard disk is not abnormal, and acquiring the smart information at the new first moment and the new second moment again according to the preset period so as to circularly detect the hard disk;
the positioning module is used for comparing preset fields in the smart information at the first moment and the second moment and positioning the state of the hard disk; the preset field is a reference field for judging whether the hard disk is abnormal or not;
and the alarm module is used for alarming according to the states, and different states correspond to different alarm prompt messages.
9. A computer device 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 warning method of any of claims 1-7.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements a hard disk warning method as claimed in any one of claims 1-7.
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 CN112256535A (en) 2021-01-22
CN112256535B true 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)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113903368B (en) * 2021-10-15 2023-07-14 成都芯盛集成电路有限公司 Automatic test method, device and equipment for disc 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

Also Published As

Publication number Publication date
CN112256535A (en) 2021-01-22

Similar Documents

Publication Publication Date Title
US10496509B2 (en) Systems and methods for event tracking and health assessment of battery-powered information handling systems
US9747182B2 (en) System and method for in-service diagnostics based on health signatures
US5537052A (en) System and method for executing on board diagnostics and maintaining an event history on a circuit board
US20080198489A1 (en) Cartridge drive diagnostic tools
CN107678909B (en) Circuit and method for monitoring chip configuration state in server
CN103514068A (en) Method for automatically locating internal storage faults
US20050210161A1 (en) Computer device with mass storage peripheral (s) which is/are monitored during operation
US20100115252A1 (en) Automated firmware recovery
US8234526B2 (en) Computer system and monitoring device
JPH10105343A (en) Computer data storage system
CN112256535B (en) Hard disk alarm method, device, computer equipment and storage medium
CN108899059B (en) Detection method and equipment for solid state disk
CN111048138A (en) Hard disk fault detection method and related device
CN114758714A (en) Hard disk fault prediction method and device, electronic equipment and storage medium
CN103049345A (en) Magnetic disk state transition detection method and device based on asynchronous communication mechanism
US9158646B2 (en) Abnormal information output system for a computer system
CN113672306A (en) Server component self-checking abnormity recovery method, device, system and medium
CN115525486A (en) SSD SMBUS temperature alarm and low power consumption state test verification method and device
CN116225802A (en) Fault testing method and device and computing equipment
CN113625957B (en) Method, device and equipment for detecting hard disk faults
CN113917385A (en) Self-detection method and system for electric energy meter
TW202238383A (en) Computer system, computer server and method of starting the same
CN110928213A (en) Exception handling method, device and equipment and exception handler
CN111190781A (en) Test self-check method of server system
CN116414611A (en) Redundant storage-based fault positioning system for power-on self-checking equipment

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