Storage device abnormality determination method and device, storage medium, and electronic device

By analyzing the number and distribution trend of abnormal storage blocks during the storage cycle, the problem of inaccurate detection of hard disk abnormalities is solved, accurate abnormal detection and early warning of hard disks is achieved, and the accuracy of monitoring of hard disk health is improved.

CN113672426BActive Publication Date: 2024-12-27ZHEJIANG HUAQI INTELLIGENT TECHNOLOGY CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110977762.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-08-24
Publication Date
2024-12-27
Estimated Expiration
2041-08-24

AI Technical Summary

Technical Problem

In the prior art, the abnormal detection of hard disks is inaccurate, and the problem of bad blocks on the hard disk cannot be effectively identified.

Method used

By obtaining the number of abnormal storage blocks in each storage cycle when storing data, analyzing its distribution trend, determining the abnormal situation of the storage device, including linear or exponential distribution, calculating linear slope or exponential power, judging the abnormal state of the storage device, and Carry out early warning and correction.

Benefits of technology

Accurate detection of hard disk abnormalities is achieved, the accuracy of hard disk failure prediction is improved, and the risk of hard disk damage is avoided.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113672426B_ABST
    Figure CN113672426B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention provides a method and device for determining an abnormality of a storage device, a storage medium, and an electronic device. The method includes: when storing data in a current storage block of a storage device, if an abnormality occurs in the current storage block, obtaining the number of abnormal storage blocks that occur in each storage cycle of the storage device where the current storage block is located, wherein the abnormal storage block is used to represent a storage block in the storage device that cannot store data; and determining the abnormality of the storage device based on the distribution trend of the number of abnormal storage blocks that occur in each storage cycle. Through the present invention, the problem of inaccurate abnormality detection of a hard disk is solved, and the effect of accurately detecting the abnormality of the hard disk is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of communications, and in particular, to a method and device for determining an abnormality of a storage device, a storage medium, and an electronic device. Background Art

[0002] Hard disks are the most important equipment for data storage in the security industry. Given the heavy reliance on hard disks, hard disk failure is considered the most important issue. After a hard disk has been used for a long time, various problems may occur, and "bad blocks" on the hard disk are the most common problem. In addition to the quality and aging of the hard disk itself, the main reason for the bad blocks on the hard disk is that the hard disk is not treated well in normal use, such as too little memory so that the application software frequently accesses the hard disk, too frequent defragmentation of the hard disk, inappropriate overclocking, poor power quality, high temperature, poor dust protection, and vibration. The existing technology is not accurate in detecting hard disk anomalies.

[0003] With respect to the above technical problems, no effective solutions have been proposed in the relevant technologies. Summary of the invention

[0004] Embodiments of the present invention provide a method and device for determining an abnormality of a storage device, a storage medium, and an electronic device, so as to at least solve the problem of inaccurate abnormality detection of a hard disk in the related art.

[0005] According to one embodiment of the present invention, a method for determining an abnormality of a storage device is provided, comprising: when storing data in a current storage block of a storage device, if an abnormality occurs in the current storage block, obtaining the number of abnormal storage blocks that occur in each storage cycle of the storage device where the current storage block is located, wherein the abnormal storage blocks are used to represent storage blocks in the storage device that cannot store data; and determining the abnormal situation of the storage device based on the distribution trend of the number of abnormal storage blocks that occur in each storage cycle.

[0006] According to another embodiment of the present invention, there is provided an abnormality determination device for a storage device, comprising: a first acquisition module, for, when storing data in a current storage block of the storage device, if an abnormality occurs in the current storage block, obtaining the number of abnormal storage blocks occurring in each storage cycle of the storage device where the current storage block is located, wherein the abnormal storage blocks are used to represent storage blocks in the storage device that cannot store data; and a first determination module, for determining the abnormality of the storage device based on the distribution trend of the number of abnormal storage blocks occurring in each storage cycle.

[0007] In an exemplary embodiment, the above-mentioned first determination module includes: a first determination unit, used to determine whether the above-mentioned distribution trend is a linear distribution or an exponential distribution; a second determination unit, used to determine the linear slope of the above-mentioned linear distribution and the exponential power of the above-mentioned exponential distribution; and a third determination unit, used to determine the abnormal situation of the above-mentioned storage device based on the above-mentioned linear slope or the above-mentioned exponential power.

[0008] In an exemplary embodiment, the third determination unit includes: a first determination subunit, used to determine that the storage device is in an abnormal state when the linear slope is greater than a first preset threshold; or a second determination subunit, used to determine that the storage device is in an abnormal state when the exponential power is greater than a second preset threshold.

[0009] In an exemplary embodiment, the apparatus further comprises one of the following: the abnormality level of the storage device is proportional to the value of the linear slope; the value of the linear slope is proportional to the value of the exponential power.

[0010] In an exemplary embodiment, the above-mentioned device also includes: a first early warning module, which is used to determine the abnormal situation of the above-mentioned storage device based on the distribution trend between the number of abnormal storage blocks that appear in each storage cycle, and when it is determined that the above-mentioned storage device is abnormal, warn the storage performance of other storage devices according to the above-mentioned distribution trend.

[0011] In an exemplary embodiment, the above-mentioned device also includes: a first calculation module, which is used to calculate the ratio between the storage capacity and the write speed of the above-mentioned storage device before obtaining the number of abnormal storage blocks that appear in each storage cycle of the storage device where the above-mentioned current storage block is located when storing data in the current storage block in the storage device, if the above-mentioned current storage block appears abnormal; and a second determination module, which is used to determine the above-mentioned storage cycle based on the above-mentioned ratio.

[0012] In an exemplary embodiment, the apparatus further includes: a first correction module, configured to add the current storage block to the number of abnormal storage blocks when an abnormality occurs in the storage device, so as to correct the distribution trend.

[0013] According to yet another embodiment of the present invention, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any one of the above method embodiments when run.

[0014] According to yet another embodiment of the present invention, there is provided an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0015] Through the present invention, when storing data in the current storage block of the storage device, if the current storage block is abnormal, the number of abnormal storage blocks that appear in each storage cycle of the storage device where the current storage block is located is obtained, wherein the abnormal storage block is used to represent the storage block that cannot store data in the storage device; the abnormal situation of the storage device is determined based on the distribution trend of the number of abnormal storage blocks that appear in each storage cycle. The purpose of detecting the abnormality of the storage device is achieved. Therefore, the problem of inaccurate abnormality detection of the hard disk in the related art can be solved, and the effect of accurately detecting the abnormality of the hard disk can be achieved. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 It is a hardware structure block diagram of a mobile terminal for determining abnormality of a storage device according to an embodiment of the present invention;

[0017] Figure 2 is a flowchart of a method for determining an abnormality of a storage device according to an embodiment of the present invention;

[0018] Figure 3 is a flow chart of comparing bad block data input analysis models in each cycle according to a specific embodiment of the present invention;

[0019] Figure 4 is a structural block diagram of an abnormality determination apparatus for a storage device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0020] Hereinafter, embodiments of the present invention will be described in detail with reference to the accompanying drawings and in combination with the embodiments.

[0021] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0022] The method embodiments provided in the embodiments of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a mobile terminal as an example, Figure 1 FIG. 1 is a hardware structure block diagram of a mobile terminal for determining abnormal storage device according to an embodiment of the present invention. Figure 1 As shown, the mobile terminal may include one or more ( Figure 1Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, wherein the mobile terminal may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is for illustration only and does not limit the structure of the mobile terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown.

[0023] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the abnormality determination method of the storage device in the embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the mobile terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0024] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0025] In this embodiment, a method for determining an abnormality of a storage device is provided. Figure 2 is a flowchart of a method for determining an abnormality of a storage device according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:

[0026] Step S202, when storing data in a current storage block of a storage device, if the current storage block is abnormal, obtain the number of abnormal storage blocks that appear in each storage cycle of the storage device where the current storage block is located, wherein the abnormal storage block is used to indicate a storage block in the storage device that cannot store data;

[0027] Step S204: determining the abnormality of the storage device based on the distribution trend of the number of abnormal storage blocks appearing in each storage cycle.

[0028] The execution subject of the above steps may be a terminal, etc., but is not limited thereto.

[0029] This embodiment includes but is not limited to a scenario of detecting anomalies of a storage device, for example, a scenario of detecting anomalies of a hard disk.

[0030] In this embodiment, the storage cycle can be determined by a cycle in which the storage device is fully covered. The abnormal storage block is determined when data is written to a storage block in the storage device during the storage cycle.

[0031] In this embodiment, the distribution trend includes but is not limited to a linear trend of abnormal storage blocks appearing within N storage cycles.

[0032] Through the above steps, when storing data in the current storage block of the storage device, if the current storage block is abnormal, the number of abnormal storage blocks that appear in each storage cycle of the storage device where the current storage block is located is obtained, wherein the abnormal storage block is used to represent a storage block in the storage device that cannot store data; the abnormal situation of the storage device is determined based on the distribution trend of the number of abnormal storage blocks that appear in each storage cycle. The purpose of detecting the abnormality of the storage device is achieved. Therefore, the problem of inaccurate abnormality detection of the hard disk in the related art can be solved, and the effect of accurately detecting the abnormality of the hard disk can be achieved.

[0033] In an exemplary embodiment, determining the abnormal condition of the storage device based on the distribution trend of the number of abnormal storage blocks occurring in each storage cycle includes:

[0034] S1, determine whether the distribution trend is linear or exponential;

[0035] S2, determines the linear slope of the linear distribution and the exponential power of the exponential distribution;

[0036] S3, determining an abnormality of the storage device based on the linear slope or the exponential power.

[0037] In this embodiment, the distribution trend is used to indicate the growth trend of the number of abnormal storage blocks, and can be distributed in chronological order.

[0038] In an exemplary embodiment, determining an abnormal condition of the storage device based on the linear slope or the exponential power includes:

[0039] S1, when the linear slope is greater than a first preset threshold, determining that the storage device is in an abnormal state;

[0040] or,

[0041] S2: When the exponential power is greater than a second preset threshold, determine that the storage device is in an abnormal state.

[0042] In this embodiment, the first preset threshold and the second preset threshold can be adjusted based on different device types.

[0043] In an exemplary embodiment, the method further comprises one of the following:

[0044] S1, when the linear slope is greater than a first preset threshold, determining that the storage device is in an abnormal state;

[0045] S2: When the growth rate of the linear index is greater than a second preset threshold, determine that the storage device is in an abnormal state.

[0046] In this embodiment, the abnormal situation includes two states: the storage device is in an alarm state, and the number of abnormal storage blocks in each storage cycle increases linearly, and the higher the linear slope, the higher the alarm level; the storage device is in a state of being damaged, and the number of abnormal storage blocks in each storage cycle increases exponentially, and the faster the exponential growth, the worse the health condition.

[0047] In an exemplary embodiment, after determining the abnormal condition of the storage device based on the distribution trend between the number of abnormal storage blocks occurring in each storage cycle, the method further includes:

[0048] S1, when it is determined that a storage device is abnormal, a warning is issued on the storage performance of other storage devices according to the distribution trend.

[0049] In this embodiment, when it is determined that the storage device is damaged, the data of the historical abnormal storage blocks of the storage device can be read, the growth curve of the abnormal storage blocks and the number of abnormal storage blocks can be analyzed, and an output warning of the data trend fitting of the abnormal storage blocks can be provided for the existing undamaged storage.

[0050] In an exemplary embodiment, when storing data in a current storage block in a storage device, if an abnormality occurs in the current storage block, before obtaining the number of abnormal storage blocks that occur in each storage cycle of the storage device where the current storage block is located, the method further includes:

[0051] S1, calculating the ratio between the storage capacity and the writing speed of the storage device;

[0052] S2, determining a storage period based on the ratio.

[0053] In this embodiment, the storage cycle calculation formula is: storage capacity / write speed.

[0054] The present invention will be described below in conjunction with specific embodiments:

[0055] This embodiment takes the abnormality detection of a hard disk as an example for explanation:

[0056] In the case of periodic full overwriting of the hard disk, this embodiment can detect all bad blocks of the hard disk within one cycle, record the hard disk bad block data in each cycle to a document, analyze the bad block quantity trend chart, and judge the health status of the hard disk by comparing the analysis model.

[0057] In this embodiment, the scenario of periodic full overwriting of the hard disk exists. For example, video data storage in the security industry adopts this method. New video data overwrites the oldest data on the hard disk. At the same time, all blocks on the hard disk are written once in a cycle. When a bad block is generated in a sector on the hard disk, it will be discovered in time.

[0058] The bad blocks of the hard disk are recorded periodically by the method described above. The cycle time calculation formula is: hard disk capacity / write speed. According to the number of bad blocks of the hard disk recorded in each cycle time, the bad block data of each cycle is input into the analysis model for comparison. Figure 3 shown.

[0059] In this embodiment, the analysis model determines that the hard disk is damaged in two situations:

[0060] Hard disk alarm status: The number of bad blocks increases linearly per cycle. The higher the slope, the higher the alarm level.

[0061] The hard drive is about to fail: The number of bad blocks increases exponentially per cycle. The faster the exponential growth, the worse the health condition.

[0062] In this embodiment, if the system finds that the hard disk is damaged during operation, the historical bad block data of the hard disk is read, the growth curve and the number of bad blocks are analyzed through a probability analysis model, and an output warning is output for fitting the bad block data trend of the existing undamaged hard disk. At the same time, the insufficient analysis model parameters are corrected, such as: 1. If the bad block distribution is a linear distribution, then the slope size is obtained for correction; 2. If the bad block distribution is an exponential distribution, then the power of the exponent is calculated to correct the analysis model.

[0063] To sum up, this embodiment assumes a scenario in which the hard disk is periodically fully covered, and can more accurately detect the bad block condition of the hard disk within a cycle; in addition, the bad block is an important indicator reflecting the current health status of the hard disk. From this perspective, this embodiment analyzes historical bad disk data to improve the analysis model parameters, thereby improving the analysis accuracy.

[0064] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.

[0065] In this embodiment, a storage device abnormality determination device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0066] Figure 4 is a structural block diagram of an abnormality determination device for a storage device according to an embodiment of the present invention. Figure 4 As shown, the device comprises:

[0067] A first acquisition module 42 is used for acquiring the number of abnormal storage blocks that appear in each storage cycle of the storage device where the current storage block is located when storing data in the current storage block of the storage device, if the current storage block appears abnormal, wherein the abnormal storage block is used to indicate a storage block in the storage device that cannot store data;

[0068] The first determination module 44 is configured to determine an abnormal situation of the storage device based on a distribution trend of the number of abnormal storage blocks that appear in each storage cycle.

[0069] In an exemplary embodiment, the first determining module includes:

[0070] A first determining unit, used to determine whether the distribution trend is a linear distribution or an exponential distribution;

[0071] A second determining unit, used to determine the linear slope of the linear distribution and the exponential power of the exponential distribution;

[0072] The third determining unit is used to determine the abnormal situation of the storage device based on the linear slope or the exponential power.

[0073] In an exemplary embodiment, the third determining unit includes:

[0074] A first determining subunit, configured to determine that the storage device is in an abnormal state when the linear slope is greater than a first preset threshold;

[0075] or,

[0076] The second determining subunit is configured to determine that the storage device is in an abnormal state when the exponential power is greater than a second preset threshold.

[0077] In an exemplary embodiment, the apparatus further comprises one of the following:

[0078] The abnormality level of the storage device is proportional to the value of the linear slope;

[0079] The value of the linear slope is proportional to the value of the exponential power.

[0080] In an exemplary embodiment, the above device further comprises:

[0081] The first early warning module is used to determine the abnormal situation of the above-mentioned storage device based on the distribution trend between the number of abnormal storage blocks appearing in each storage cycle. When it is determined that the above-mentioned storage device is abnormal, the storage performance of other storage devices is warned according to the above-mentioned distribution trend.

[0082] In an exemplary embodiment, the above device further comprises:

[0083] A first calculation module is used for calculating the ratio between the storage capacity and the write speed of the storage device before obtaining the number of abnormal storage blocks that appear in each storage cycle of the storage device where the current storage block is located when storing data in the current storage block in the storage device if the current storage block appears abnormal;

[0084] The second determining module is used to determine the storage period based on the ratio.

[0085] In an exemplary embodiment, the above device further comprises:

[0086] The first correction module is used to add the current storage block to the number of abnormal storage blocks in order to correct the distribution trend when the storage device is abnormal.

[0087] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.

[0088] An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.

[0089] In this embodiment, the computer-readable storage medium may be configured to store a computer program for executing the above steps.

[0090] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.

[0091] An embodiment of the present invention further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0092] In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0093] In an exemplary embodiment, the processor may be configured to execute the above steps through a computer program.

[0094] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail herein.

[0095] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order than here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.

[0096] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for determining an abnormality of a storage device, characterized in that: include: When storing data in a current storage block of a storage device, if the current storage block is abnormal, obtaining the number of abnormal storage blocks that appear in each storage cycle of the storage device where the current storage block is located, wherein the abnormal storage block is used to represent a storage block in the storage device that cannot store data; Determining an abnormal situation of the storage device based on a distribution trend of the number of abnormal storage blocks occurring in each storage cycle; Among them, determining the abnormal situation of the storage device based on the distribution trend of the number of abnormal storage blocks appearing in each storage cycle includes: determining that the distribution trend is a linear distribution or an exponential distribution; determining the linear slope of the linear distribution and the exponential power of the exponential distribution; and determining the abnormal situation of the storage device based on the linear slope or the exponential power.

2. The method according to claim 1, characterized in that Determining an abnormal condition of the storage device based on the linear slope or the exponential power includes: When the linear slope is greater than a first preset threshold, determining that the storage device is in an abnormal state; or, When the exponential power is greater than a second preset threshold, it is determined that the storage device is in an abnormal state.

3. The method according to claim 2, characterized in that The method further comprises one of the following: The abnormality level of the storage device is proportional to the value of the linear slope; The value of the linear slope is proportional to the value of the exponential power.

4. The method according to claim 1, characterized in that: After determining the abnormal situation of the storage device based on the distribution trend between the number of abnormal storage blocks appearing in each storage cycle, the method further includes: When it is determined that the storage device is abnormal, a warning is issued on the storage performance of other storage devices according to the distribution trend.

5. The method according to claim 1, characterized in that When storing data in a current storage block in a storage device, if an abnormality occurs in the current storage block, before obtaining the number of abnormal storage blocks that occur in each storage cycle of the storage device where the current storage block is located, the method further includes: Calculating a ratio between a storage capacity and a write speed of the storage device; The storage period is determined based on the ratio.

6. The method according to claim 1, characterized in that The method further comprises: In the case that the storage device is abnormal, the current storage block is added to the number of abnormal storage blocks to correct the distribution trend.

7. A storage device abnormality determination device, characterized in that: include: A first acquisition module is used for acquiring the number of abnormal storage blocks that appear in each storage cycle of the storage device where the current storage block is located when storing data in the current storage block of the storage device, if the current storage block appears abnormal, wherein the abnormal storage block is used to indicate a storage block in the storage device that cannot store data; A first determination module, configured to determine an abnormality of the storage device based on a distribution trend of the number of abnormal storage blocks occurring in each storage cycle; Among them, the first determination module is also used to determine whether the distribution trend is linear distribution or exponential distribution; determine the linear slope of the linear distribution and the exponential power of the exponential distribution; and determine the abnormal situation of the storage device based on the linear slope or the exponential power.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program implements the method described in any one of claims 1 to 6 when executed by a processor.

9. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to perform the method according to any one of claims 1 to 6.