Hard disk service life early warning method and device, computer equipment and storage medium

By obtaining the hard disk information and write volume of SSD, combined with the warning rules in the processor configuration file, flexible early warning of the SSD life is achieved, and the problem of insufficient algorithm update and early warning information in the existing technology is solved, and the reliability and automation level of the system are improved.

CN119961121APending Publication Date: 2025-05-09INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411971873.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-30
Publication Date
2025-05-09

AI Technical Summary

Technical Problem

In the life management and early warning of SSDs, there is a risk of business interruption caused by algorithm updates requiring firmware version upgrades, and the BMC can only warn by setting percentage thresholds and cannot provide sufficient warning information.

Method used

By obtaining the hard disk information of the hard disk, filtering the hard disk that supports the life warning function, obtaining its current write volume and historical write volume, and obtaining the preset hard disk life warning rules through the processor configuration file to determine whether a hard disk life warning is required.

Benefits of technology

It realizes the life of hard disk without affecting business stability. By flexibly configuring the life of the early warning algorithm and inspection cycle, the data confusion caused by hard disk replacement or movement is solved, and the reliability of the system is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119961121A_ABST
    Figure CN119961121A_ABST
Patent Text Reader

Abstract

The invention relates to a hard disk life early warning method and device, computer equipment and a storage medium. The method comprises the following steps: acquiring hard disk information of each hard disk, and screening out a hard disk supporting a life early warning function as a target hard disk according to the hard disk information; obtaining a first identifier of the target hard disk and position information of the target hard disk, and judging whether the target hard disk is matched with the position information or not according to the first identifier; according to a matching result, obtaining a current write-in amount and a historical write-in amount of the target hard disk, sending the current write-in amount and the historical write-in amount to a processor, enabling the processor to obtain a preset hard disk life early warning rule through a configuration file, and substituting the current write-in amount and the historical write-in amount into the hard disk life early warning algorithm, and judging whether hard disk service life early warning needs to be performed on the target hard disk or not. By adopting the method, the hard disk service life early warning algorithm can be configured in a file configuration mode, and when the algorithm is upgraded, the configuration can be modified at a processor end to modify the used algorithm.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of storage technology, and in particular to a hard disk life warning method, device, computer equipment and storage medium. Background Art

[0002] In modern data centers and high-performance computing environments, NVMe (Non-Volatile Memory Express) is a protocol for SSDs (Solid State Disks) that has become the first choice for server storage due to its high bandwidth, low latency, and high performance. In server environments, the life of SSDs is mainly affected by factors such as write amplification, erase and write cycles, and temperature. In addition, each NAND cell has a limited erase and write cycle, and excessive use can cause cell failure, thus affecting the overall performance and reliability of the SSD. Therefore, effective life management and early warning of SSDs are particularly important.

[0003] In the existing solution, the BMC (Baseboard Manager Controller) regularly reads the PLDU (Percentage Drive Life Used) value of the SSD through the I2C interface to indicate the hard disk life. However, this value is calculated by the SSD internal firmware based on a complex algorithm. If the PLDU algorithm needs to be updated, the SSD firmware version must be upgraded, which may cause business interruption and risk. In addition, the BMC can only achieve early warning of the SSD life by setting a percentage threshold, which may not provide sufficient warning information in some cases. Summary of the invention

[0004] Based on this, it is necessary to provide a hard disk life warning method, device, computer equipment and storage medium that can be configured through the processor end to address the above technical problems.

[0005] On the one hand, a hard disk life warning method is provided, the method comprising:

[0006] Obtaining hard disk information of each hard disk, and selecting hard disks supporting life warning function as target hard disks according to the hard disk information;

[0007] Acquire a first identifier of the target hard disk and location information of the target hard disk, and determine whether the target hard disk matches the location information according to the first identifier;

[0008] Acquire the current write amount and the historical write amount of the target hard disk according to the matching result;

[0009] The current write amount and the historical write amount are sent to a processor, so that the processor obtains a preset hard disk life warning rule through a configuration file, and determines whether a hard disk life warning is required for the target hard disk according to the current write amount, the historical write amount and the hard disk life warning rule.

[0010] In one embodiment, the obtaining of hard disk information of each hard disk and selecting hard disks supporting the life warning function as target hard disks according to the hard disk information includes:

[0011] Setting a timer, periodically traversing multiple hard disks in the server through the timer to obtain hard disk information of the hard disks, and saving the hard disk information to a first memory data structure, wherein the hard disk information includes a current write amount, a total write amount, and an early warning function flag;

[0012] According to the warning function flag, hard disks supporting the life warning function are selected as target hard disks.

[0013] In one embodiment, the step of selecting a hard disk that supports the life warning function as a target hard disk according to the warning function flag includes:

[0014] Read historical hard disk data, and obtain historical update time from the historical hard disk data;

[0015] Comparing the historical update time with the current system time;

[0016] In response to the historical update time being consistent with the current system time, starting a new round of checking on the multiple hard disks in the server through the timer;

[0017] In response to the historical update time being inconsistent with the current system time, traversing the hard disk information in the first memory data structure, and selecting a hard disk supporting the early warning function as a target hard disk according to the early warning function flag;

[0018] After traversing the multiple hard disks, the historical update time in the historical hard disk data is updated based on the current system time.

[0019] In one embodiment, obtaining the first identifier of the target hard disk and the location information of the target hard disk, and determining whether the target hard disk matches the location information according to the first identifier, includes:

[0020] Acquire a first identifier and corresponding location information of the target hard disk from the first memory data structure;

[0021] According to the location information of the target hard disk, a second identifier corresponding to the location information at the time of the last update is obtained from the historical hard disk data;

[0022] Determine whether the first identifier of the target hard disk is the same as the second identifier.

[0023] In one embodiment, obtaining the current write amount and the historical write amount of the target hard disk according to the matching result includes:

[0024] In response to the first identifier of the target hard disk being different from the second identifier, determining that the target hard disk does not match the location information;

[0025] Deleting the second identifier and the historical write amount corresponding to the location information from the historical hard disk data, and updating the corresponding relationship between the location information and the first identifier of the target hard disk into the historical hard disk data;

[0026] In response to the first identifier of the target hard disk being the same as the second identifier, determining that the target hard disk matches the location information;

[0027] Acquire the historical write amount of the target hard disk from the historical hard disk data according to the location information of the target hard disk and the first identifier, and acquire the current write amount of the target hard disk from the first memory data structure;

[0028] Comparing the historical write volume of the target hard disk with the data volume corresponding to a preset inspection period;

[0029] In response to the historical write amount not exceeding the data amount corresponding to the preset check period, updating the current write amount into the historical write amount;

[0030] In response to the historical write amount exceeding the data amount corresponding to the preset check period, the earliest data in the historical write amount is deleted in chronological order until the historical write amount is a data amount that satisfies the check period.

[0031] In one embodiment, the sending of the current write amount and the historical write amount to a processor, so that the processor obtains a preset hard disk life warning algorithm through a configuration file, and substitutes the current write amount and the historical write amount into the hard disk life warning algorithm to determine whether a hard disk life warning is required for the target hard disk, includes:

[0032] Obtaining a preset hard disk life warning rule from a configuration file, and storing the hard disk life warning rule in a second memory data structure;

[0033] In response to the processor receiving the current write amount and the historical write amount, obtaining the hard disk life warning rule through the second memory data structure, and calculating the life prediction value of the target hard disk according to the current write amount and the historical write amount based on the hard disk life warning rule;

[0034] In response to the life prediction value being less than the preset life warning threshold, warning information is generated and sent to a user.

[0035] In one of the embodiments, in response to the need to issue a hard disk life warning for the target hard disk, the location information, the first identifier and the current write amount of the target hard disk are recorded in a log, and the current write amount is updated to the historical write amount.

[0036] On the other hand, a hard disk life warning device is provided, the device comprising:

[0037] A screening module, used to obtain hard disk information of each hard disk, and screen out hard disks supporting life warning function as target hard disks according to the hard disk information;

[0038] A judgment module, used for obtaining a first identifier of the target hard disk and location information of the target hard disk, and judging whether the target hard disk matches the location information according to the first identifier;

[0039] An acquisition module, used for acquiring the current write amount and the historical write amount of the target hard disk according to the matching result;

[0040] The warning module is used to send the current write amount and the historical write amount to the processor, so that the processor obtains the preset hard disk life warning rules through the configuration file, and determines whether it is necessary to issue a hard disk life warning for the target hard disk according to the current write amount, the historical write amount and the hard disk life warning rules.

[0041] In another aspect, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the following steps are implemented:

[0042] Obtaining hard disk information of each hard disk, and selecting hard disks supporting life warning function as target hard disks according to the hard disk information;

[0043] Acquire a first identifier of the target hard disk and location information of the target hard disk, and determine whether the target hard disk matches the location information according to the first identifier;

[0044] Acquire the current write amount and the historical write amount of the target hard disk according to the matching result;

[0045] The current write amount and the historical write amount are sent to a processor, so that the processor obtains a preset hard disk life warning rule through a configuration file, and determines whether a hard disk life warning is required for the target hard disk according to the current write amount, the historical write amount and the hard disk life warning rule.

[0046] In another aspect, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0047] Obtaining hard disk information of each hard disk, and selecting hard disks supporting life warning function as target hard disks according to the hard disk information;

[0048] Acquire a first identifier of the target hard disk and location information of the target hard disk, and determine whether the target hard disk matches the location information according to the first identifier;

[0049] Acquire the current write amount and the historical write amount of the target hard disk according to the matching result;

[0050] The current write amount and the historical write amount are sent to a processor, so that the processor obtains a preset hard disk life warning rule through a configuration file, and determines whether a hard disk life warning is required for the target hard disk according to the current write amount, the historical write amount and the hard disk life warning rule.

[0051] The hard disk life warning method, device, computer equipment and storage medium described above can flexibly configure the life warning algorithm and inspection cycle through the configuration file. When upgrading the algorithm, as long as the format of the information transmitted from the hard disk to the processor remains unchanged, the life warning algorithm used can be modified by modifying the configuration on the processor side. In addition, the hard disk is uniquely identified by using the correspondence between the hard disk location information and the first identifier, solving the data confusion problem caused by the replacement or movement of the hard disk, while retaining multi-cycle historical data, thereby improving the reliability of the system. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] Figure 1 A flowchart of a hard disk life warning method in one embodiment;

[0053] Figure 2 A schematic diagram of a process of hard disk life warning steps in an embodiment;

[0054] Figure 3 A schematic diagram of the nand_data_history.json data file format in one embodiment;

[0055] Figure 4 A structural block diagram of a hard disk life warning device in one embodiment;

[0056] Figure 5 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0057] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0058] In one embodiment, Figure 1-3 As shown, a hard disk life warning method is provided, comprising the following steps:

[0059] Step S1, obtaining hard disk information of each hard disk, and selecting hard disks supporting life warning function as target hard disks according to the hard disk information.

[0060] In an optional implementation, obtaining hard disk information of each hard disk, and selecting hard disks supporting the life warning function as target hard disks according to the hard disk information, includes:

[0061] Setting a timer, periodically traversing multiple hard disks in the server through the timer to obtain hard disk information of the hard disks, and saving the hard disk information to a first memory data structure, wherein the hard disk information includes a current write amount, a total write amount, and an early warning function flag;

[0062] According to the warning function flag, hard disks supporting the life warning function are selected as target hard disks.

[0063] Specifically, a timer is established in the monitoring module. When the timer is triggered, a new round of inspection is performed to traverse all NVMe hard drives inserted in different backplanes in the server, and obtain the subsystem management data structure data (subsystem management data structure) of each NVMe hard drive through I2C, including the current NAND write amount, whether the warning function flag is enabled, the total SSD write amount and other manufacturer-defined information, and save this information to the corresponding field of the first memory data structure.

[0064] Based on the above steps, by setting a timer to automatically traverse all hard disks regularly and collect necessary hard disk information, the target hard disks are screened out for subsequent warning calculations based on whether they support the life warning function, which reduces the need for manual intervention and improves the system's automation level and work efficiency.

[0065] In an optional implementation, selecting a hard disk that supports the life warning function as a target hard disk according to the warning function flag includes:

[0066] Read historical hard disk data and obtain historical update time from the historical hard disk data;

[0067] Compare historical update time with current system time;

[0068] In response to the historical update time being consistent with the current system time, a new round of checking of multiple hard disks in the server is started through a timer;

[0069] In response to the historical update time being inconsistent with the current system time, traversing the hard disk information in the first memory data structure, and selecting a hard disk supporting the early warning function as a target hard disk according to the early warning function flag;

[0070] After traversing multiple hard disks, the historical update time in the historical hard disk data is updated based on the current system time.

[0071] Specifically, after traversing all hard disks and obtaining their hard disk information, obtain the current system time current_time of the BMC, obtain the last saved historical update time updated_time field from the data file nand_data_history.json, and if the current system time current_time and the historical update time updated_time are different, traverse all NVMe hard disks saved in the first memory data structure, and determine whether they support the life warning function through the warning function flag. After all NVMe hard disks are checked, update the updated_time field in nand_data_history.json to ensure that the new historical update time reflects the latest inspection time point, so that the next time you check, you can correctly determine whether you need to re-traverse the hard disk information. Among them, the nand_data_history.json file saves the historical write volume and other related information of each hard disk, which is used to track the changes in the hard disk.

[0072] Based on the above steps, if the current system time is consistent with the historical update time, it means that a round of inspection has been performed in this inspection cycle; if they are inconsistent, it means that no inspection has been performed in this inspection cycle, and the target hard disk needs to be screened for the next step. By comparing the historical update time and the current system time, it is possible to effectively avoid unnecessary repeated inspections of the hard disk in the same inspection cycle, thereby improving the efficiency and resource utilization of the system.

[0073] Step S2, obtaining a first identifier of a target hard disk and location information of the target hard disk, and determining whether the target hard disk matches the location information according to the first identifier.

[0074] In an optional implementation, obtaining a first identifier of a target hard disk and location information of the target hard disk, and determining whether the target hard disk matches the location information according to the first identifier includes:

[0075] Acquire a first identifier and corresponding location information of the target hard disk from the first memory data structure;

[0076] According to the location information of the target hard disk, a second identifier corresponding to the location information at the last update is obtained from the historical hard disk data;

[0077] Determine whether the first identifier and the second identifier of the target hard disk are the same.

[0078] Specifically, the location information L and the first identifier S of the target hard disk are obtained from the first memory data structure, the second identifier S_old corresponding to the location information L at the last update is obtained from the data file nand_data_history.json, and then S_old is compared to see whether they are equal.

[0079] Based on the above steps, the hard disk is uniquely represented based on its position and serial number, which can solve the problem of distinguishing hard disks in the same position when swapping hard disk positions or removing and inserting new hard disks, thereby avoiding data confusion caused by hard disk replacement or movement.

[0080] Step S3, obtaining the current write volume and the historical write volume of the target hard disk according to the matching result.

[0081] In an optional implementation, obtaining the current write amount and the historical write amount of the target hard disk according to the matching result includes:

[0082] In response to the first identifier and the second identifier of the target hard disk being different, determining that the target hard disk does not match the location information;

[0083] Deleting the second identifier and the historical write amount corresponding to the location information from the historical hard disk data, and updating the corresponding relationship between the location information and the first identifier of the target hard disk into the historical hard disk data;

[0084] In response to the first identifier and the second identifier of the target hard disk being the same, determining that the target hard disk matches the location information;

[0085] Acquire the historical write amount of the target hard disk from the historical hard disk data according to the location information of the target hard disk and the first identifier, and acquire the current write amount of the target hard disk from the first memory data structure;

[0086] Compare the historical write volume of the target hard disk with the data volume corresponding to the preset check period;

[0087] In response to the historical write amount not exceeding the data amount corresponding to the preset check period, updating the current write amount into the historical write amount;

[0088] In response to the historical write volume exceeding the data volume corresponding to the preset check period, the earliest data in the historical write volume is deleted in chronological order until the historical write volume is a data volume that satisfies the check period.

[0089] Specifically, if the second identifier S_old is equal to the current first identifier S, it means that the hard disk at the current position has not been replaced, and subsequent processing continues; if they are not equal, it means that a new hard disk has been inserted at this position, and it is necessary to delete the hard disk information and NAND historical write amount information of the first identifier S_old corresponding to the location information L in the nand_data_history.json file, and update the correspondence between the location information L of the new hard disk and the first identifier S to the nand_data_history.json file.

[0090] According to the location information L and the first identifier S of the target hard disk, the NAND historical write volume of the target hard disk is read from the nand_data_history.json file and saved in the array WA. The NAND current write volume of the target hard disk is obtained from the first memory data structure and saved in the array WC. Then the inspection cycle T is read from the second memory structure. If the size of the NAND historical write volume array WA of the hard disk exceeds the inspection cycle T, the earliest data in WA is deleted until the size of the array WA is T; if the size of the array WA does not exceed the inspection cycle T, the NAND current write volume obtained in this inspection is updated to the NAND historical write volume.

[0091] Based on the above steps, when the target hard disk's NAND historical write volume information is saved in a data file, multiple historical data can be retained, and the number of times can be configured through the inspection cycle. For a newly inserted hard disk, a life warning will be issued only after a certain amount of historical write volume data has been accumulated, to prevent the algorithm from being unable to issue a correct warning due to the new hard disk being inserted too short, thus ensuring the accuracy of the prediction. At the same time, when a certain inspection is not performed normally due to an abnormal monitoring module, the historical hard disk data can still be used for life prediction during the next inspection.

[0092] Step S4, sending the current write amount and the historical write amount to the processor, so that the processor obtains the preset hard disk life warning algorithm through the configuration file, and determines whether it is necessary to issue a hard disk life warning for the target hard disk based on the current write amount, the historical write amount and the hard disk life warning rules.

[0093] In an optional implementation, the current write amount and the historical write amount are sent to the processor, so that the processor obtains a preset hard disk life warning algorithm through a configuration file, and determines whether a hard disk life warning is required for the target hard disk according to the current write amount, the historical write amount and the hard disk life warning rule, including:

[0094] Obtaining a preset hard disk life warning rule from a configuration file, and storing the hard disk life warning rule in a second memory data structure;

[0095] In response to the processor receiving the current write amount and the historical write amount, obtaining a hard disk life warning algorithm through a second memory data structure and calculating a life prediction value of the target hard disk;

[0096] In response to the life prediction value being less than a preset life warning threshold, warning information is generated and sent to a user.

[0097] Specifically, the hard disk life warning related parameters read from the project configuration file are stored in the second memory data structure, including the preset hard disk life warning algorithm expression and the inspection cycle. By reading the pre-configured hard disk life warning algorithm AL from the second memory data structure, the NAND historical write volume WA and the NAND current write volume WC obtained this time are substituted into the algorithm AL, and it is determined whether the target hard disk needs to be warned about its life according to the return value of the algorithm.

[0098] Based on the above steps, by providing different algorithms and their parameters in the configuration file, the SSD life warning algorithm and its inspection cycle can be updated on the BMC side, which facilitates the subsequent rapid verification of the new SSD life warning algorithm. As long as the format of the information transmitted from the hard disk to the BMC remains unchanged, the SSD life warning algorithm used in the BMC can be modified by modifying the configuration on the BMC side.

[0099] In an optional implementation, the current write volume and the historical write volume are substituted into the hard disk life warning algorithm to determine whether a hard disk life warning is required for the target hard disk, and also includes: within the inspection period, determining whether the target hard disk has write volume information every day; if so, calculating the differential value of the target hard disk write volume sequence every other day to generate a differential historical time series; if not, using the interpolation method to fill in the empty items in the historical write volume, and performing differential calculations every other day based on the filled write volume sequence to generate a differential historical time series; inputting the differential historical time series into an exponential smoothing model for model training, and obtaining the smoothing coefficient value of the exponential smoothing model through maximum likelihood estimation fitting to obtain a predicted value of the daily change in the user system write volume of the solid-state hard disk to be tested within a preset future time period; continuously accumulating the predicted value of the change based on the current write volume to obtain a predicted value of the write volume for each day in the preset future time period, and calculating the remaining days of the target hard disk's life in combination with the total write volume of the target hard disk; and issuing a warning when the remaining days of the life are less than a preset life threshold.

[0100] In an optional implementation, in response to the need for hard disk life warning for the target hard disk, the location information, the first identifier and the current write amount of the target hard disk are recorded in a log, and the current write amount is updated to the historical write amount.

[0101] It should be understood that although Figure 1-2 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1-2 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.

[0102] In one embodiment, Figure 4 As shown, a hard disk life warning device is provided, including: a screening module, a judgment module, an acquisition module and a warning module, wherein:

[0103] A screening module is used to obtain hard disk information of each hard disk, and screen out hard disks that support life warning function as target hard disks according to the hard disk information;

[0104] A judgment module, used to obtain a first identifier of a target hard disk and location information of the target hard disk, and judge whether the target hard disk matches the location information according to the first identifier;

[0105] An acquisition module is used to acquire the current write amount and the historical write amount of the target hard disk according to the matching result;

[0106] The warning module is used to send the current write volume and historical write volume to the processor, so that the processor obtains the preset hard disk life warning algorithm through the configuration file, and determines whether it is necessary to issue a hard disk life warning for the target hard disk based on the current write volume, historical write volume and hard disk life warning rules.

[0107] In one embodiment, the filtering module is also used to set a timer, which periodically traverses multiple hard disks in the server to obtain hard disk information of the hard disks, and saves the hard disk information to a first memory data structure, wherein the hard disk information includes the current write amount, the total write amount, and a warning function flag; and according to the warning function flag, a hard disk that supports the life warning function is filtered out as the target hard disk.

[0108] In one embodiment, the filtering module is also used to read historical hard disk data and obtain historical update time from the historical hard disk data; compare the historical update time with the current system time; in response to the historical update time being consistent with the current system time, start a new round of inspections on multiple hard disks in the server through a timer; in response to the historical update time being inconsistent with the current system time, traverse the hard disk information in the first memory data structure, and filter out hard disks that support the early warning function as target hard disks according to the early warning function flag; after traversing multiple hard disks, update the historical update time in the historical hard disk data based on the current system time.

[0109] In one embodiment, the judgment module is also used to obtain a first identifier and corresponding location information of the target hard disk from a first memory data structure; obtain a second identifier corresponding to the location information at the last update from historical hard disk data based on the location information of the target hard disk; and determine whether the first identifier and the second identifier of the target hard disk are the same.

[0110] In one embodiment, the acquisition module is also used to determine that the target hard disk does not match the location information in response to the first identifier and the second identifier of the target hard disk being different; delete the second identifier and the historical write amount corresponding to the location information from the historical hard disk data, and update the correspondence between the location information and the first identifier of the target hard disk to the historical hard disk data; in response to the first identifier and the second identifier of the target hard disk being the same, determine that the target hard disk matches the location information; obtain the historical write amount of the target hard disk from the historical hard disk data according to the location information and the first identifier of the target hard disk, and obtain the current write amount of the target hard disk from the first memory data structure; compare the historical write amount of the target hard disk with the data amount corresponding to a preset inspection period; in response to the historical write amount not exceeding the data amount corresponding to the preset inspection period, update the current write amount to the historical write amount; in response to the historical write amount exceeding the data amount corresponding to the preset inspection period, delete the earliest data in the historical write amount in chronological order until the historical write amount is a data amount that satisfies the inspection period.

[0111] In one embodiment, the warning module is also used to obtain preset hard disk life warning rules from a configuration file, and save the hard disk life warning rules in a second memory data structure; in response to the processor receiving the current write amount and the historical write amount, obtain the hard disk life warning algorithm through the second memory data structure and calculate the life prediction value of the target hard disk; in response to the life prediction value being less than a preset life warning threshold, generate warning information, and send the warning information to the user.

[0112] In one embodiment, the warning module is also used to respond to the need for hard disk life warning for the target hard disk, record the location information, first identifier and current write amount of the target hard disk in the log, and update the current write amount to the historical write amount.

[0113] The specific definition of the hard disk life warning device can be found in the definition of the hard disk life warning method mentioned above, which will not be repeated here. Each module in the above hard disk life warning device can be implemented in whole or in part by software, hardware and their combination. Each of the above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.

[0114] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 5As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store historical write volume data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a hard disk life warning method is implemented.

[0115] Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0116] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:

[0117] Obtain hard disk information of each hard disk, and select hard disks that support life warning function as target hard disks according to the hard disk information;

[0118] Obtaining a first identifier of a target hard disk and location information of the target hard disk, and determining whether the target hard disk matches the location information according to the first identifier;

[0119] Obtain the current write volume and historical write volume of the target hard disk according to the matching result;

[0120] The current write amount and the historical write amount are sent to the processor, so that the processor obtains the preset hard disk life warning algorithm through the configuration file, and determines whether it is necessary to issue a hard disk life warning for the target hard disk based on the current write amount, the historical write amount and the hard disk life warning rules.

[0121] In one embodiment, when the processor executes the computer program, the following steps are also implemented: a timer is set, and multiple hard disks in the server are periodically traversed through the timer to obtain hard disk information of the hard disks, and the hard disk information is saved in a first memory data structure, wherein the hard disk information includes the current write amount, the total write amount, and the warning function flag; and a hard disk that supports the life warning function is selected as the target hard disk according to the warning function flag.

[0122] In one embodiment, the processor also implements the following steps when executing the computer program: reading historical hard disk data and obtaining historical update time from the historical hard disk data; comparing the historical update time with the current system time; in response to the historical update time being consistent with the current system time, starting a new round of inspections for multiple hard disks in the server through a timer; in response to the historical update time being inconsistent with the current system time, traversing the hard disk information in the first memory data structure, and filtering out hard disks that support the early warning function as target hard disks according to the early warning function flag; after traversing multiple hard disks, updating the historical update time in the historical hard disk data based on the current system time.

[0123] In one embodiment, when the processor executes the computer program, the following steps are also implemented: obtaining a first identifier and corresponding location information of the target hard disk from a first memory data structure; obtaining a second identifier corresponding to the location information at the time of the last update from historical hard disk data based on the location information of the target hard disk; and determining whether the first identifier and the second identifier of the target hard disk are the same.

[0124] In one embodiment, the processor also implements the following steps when executing the computer program: in response to the first identifier and the second identifier of the target hard disk being different, determining that the target hard disk does not match the location information; deleting the second identifier and the historical write amount corresponding to the location information from the historical hard disk data, and updating the correspondence between the location information and the first identifier of the target hard disk to the historical hard disk data; in response to the first identifier and the second identifier of the target hard disk being the same, determining that the target hard disk matches the location information; obtaining the historical write amount of the target hard disk from the historical hard disk data according to the location information and the first identifier of the target hard disk, and obtaining the current write amount of the target hard disk from the first memory data structure; comparing the historical write amount of the target hard disk with the data amount corresponding to a preset inspection period; in response to the historical write amount not exceeding the data amount corresponding to the preset inspection period, updating the current write amount to the historical write amount; in response to the historical write amount exceeding the data amount corresponding to the preset inspection period, deleting the earliest data in the historical write amount in chronological order until the historical write amount is a data amount that satisfies the inspection period.

[0125] In one embodiment, the processor also implements the following steps when executing the computer program: obtaining preset hard disk life warning rules from a configuration file, and storing the hard disk life warning rules in a second memory data structure; in response to the processor receiving the current write amount and the historical write amount, obtaining the hard disk life warning algorithm through the second memory data structure and calculating the life prediction value of the target hard disk; in response to the life prediction value being less than a preset life warning threshold, generating warning information, and sending the warning information to the user.

[0126] In one embodiment, when the processor executes the computer program, the following steps are also implemented: in response to the need to issue a hard disk life warning for the target hard disk, the location information, the first identifier and the current write amount of the target hard disk are recorded in the log, and the current write amount is updated to the historical write amount.

[0127] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0128] Obtain hard disk information of each hard disk, and select hard disks that support life warning function as target hard disks according to the hard disk information;

[0129] Obtaining a first identifier of a target hard disk and location information of the target hard disk, and determining whether the target hard disk matches the location information according to the first identifier;

[0130] Obtain the current write volume and historical write volume of the target hard disk according to the matching result;

[0131] The current write amount and the historical write amount are sent to the processor, so that the processor obtains the preset hard disk life warning algorithm through the configuration file, and determines whether it is necessary to issue a hard disk life warning for the target hard disk based on the current write amount, the historical write amount and the hard disk life warning rules.

[0132] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: a timer is set, and multiple hard disks in the server are periodically traversed through the timer to obtain hard disk information of the hard disks, and the hard disk information is saved in a first memory data structure, wherein the hard disk information includes the current write amount, the total write amount, and the warning function flag; and a hard disk that supports the life warning function is selected as the target hard disk according to the warning function flag.

[0133] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: reading historical hard disk data and obtaining historical update time from the historical hard disk data; comparing the historical update time with the current system time; in response to the historical update time being consistent with the current system time, starting a new round of inspections for multiple hard disks in the server through a timer; in response to the historical update time being inconsistent with the current system time, traversing the hard disk information in the first memory data structure, and filtering out hard disks that support the early warning function as target hard disks according to the early warning function flag; after traversing multiple hard disks, updating the historical update time in the historical hard disk data based on the current system time.

[0134] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: obtaining a first identifier and corresponding location information of the target hard disk from a first memory data structure; obtaining a second identifier corresponding to the location information at the last update from historical hard disk data based on the location information of the target hard disk; and determining whether the first identifier and the second identifier of the target hard disk are the same.

[0135] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: in response to the first identifier and the second identifier of the target hard disk being different, determining that the target hard disk does not match the location information; deleting the second identifier and the historical write amount corresponding to the location information from the historical hard disk data, and updating the correspondence between the location information and the first identifier of the target hard disk to the historical hard disk data; in response to the first identifier and the second identifier of the target hard disk being the same, determining that the target hard disk matches the location information; obtaining the historical write amount of the target hard disk from the historical hard disk data according to the location information and the first identifier of the target hard disk, and obtaining the current write amount of the target hard disk from the first memory data structure; comparing the historical write amount of the target hard disk with the data amount corresponding to a preset inspection period; in response to the historical write amount not exceeding the data amount corresponding to the preset inspection period, updating the current write amount to the historical write amount; in response to the historical write amount exceeding the data amount corresponding to the preset inspection period, deleting the earliest data in the historical write amount in chronological order until the historical write amount is a data amount that satisfies the inspection period.

[0136] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: obtaining preset hard disk life warning rules from a configuration file, and storing the hard disk life warning rules in a second memory data structure; in response to the processor receiving the current write amount and the historical write amount, obtaining the hard disk life warning algorithm through the second memory data structure and calculating the life prediction value of the target hard disk; in response to the life prediction value being less than a preset life warning threshold, generating warning information, and sending the warning information to the user.

[0137] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: in response to the need to issue a hard disk life warning for the target hard disk, the location information, the first identifier and the current write amount of the target hard disk are recorded in the log, and the current write amount is updated to the historical write amount.

[0138] In one embodiment, a computer product is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0139] Obtain hard disk information of each hard disk, and select hard disks that support life warning function as target hard disks according to the hard disk information;

[0140] Obtaining a first identifier of a target hard disk and location information of the target hard disk, and determining whether the target hard disk matches the location information according to the first identifier;

[0141] Obtain the current write volume and historical write volume of the target hard disk according to the matching result;

[0142] The current write amount and the historical write amount are sent to the processor, so that the processor obtains the preset hard disk life warning algorithm through the configuration file, and determines whether it is necessary to issue a hard disk life warning for the target hard disk based on the current write amount, the historical write amount and the hard disk life warning rules.

[0143] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: a timer is set, and multiple hard disks in the server are periodically traversed through the timer to obtain hard disk information of the hard disks, and the hard disk information is saved in a first memory data structure, wherein the hard disk information includes the current write amount, the total write amount, and the warning function flag; and a hard disk that supports the life warning function is selected as the target hard disk according to the warning function flag.

[0144] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: reading historical hard disk data and obtaining historical update time from the historical hard disk data; comparing the historical update time with the current system time; in response to the historical update time being consistent with the current system time, starting a new round of inspections for multiple hard disks in the server through a timer; in response to the historical update time being inconsistent with the current system time, traversing the hard disk information in the first memory data structure, and filtering out hard disks that support the early warning function as target hard disks according to the early warning function flag; after traversing multiple hard disks, updating the historical update time in the historical hard disk data based on the current system time.

[0145] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: obtaining a first identifier and corresponding location information of the target hard disk from a first memory data structure; obtaining a second identifier corresponding to the location information at the last update from historical hard disk data based on the location information of the target hard disk; and determining whether the first identifier and the second identifier of the target hard disk are the same.

[0146] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: in response to the first identifier and the second identifier of the target hard disk being different, determining that the target hard disk does not match the location information; deleting the second identifier and the historical write amount corresponding to the location information from the historical hard disk data, and updating the correspondence between the location information and the first identifier of the target hard disk to the historical hard disk data; in response to the first identifier and the second identifier of the target hard disk being the same, determining that the target hard disk matches the location information; obtaining the historical write amount of the target hard disk from the historical hard disk data according to the location information and the first identifier of the target hard disk, and obtaining the current write amount of the target hard disk from the first memory data structure; comparing the historical write amount of the target hard disk with the data amount corresponding to a preset inspection period; in response to the historical write amount not exceeding the data amount corresponding to the preset inspection period, updating the current write amount to the historical write amount; in response to the historical write amount exceeding the data amount corresponding to the preset inspection period, deleting the earliest data in the historical write amount in chronological order until the historical write amount is a data amount that satisfies the inspection period.

[0147] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: obtaining preset hard disk life warning rules from a configuration file, and storing the hard disk life warning rules in a second memory data structure; in response to the processor receiving the current write amount and the historical write amount, obtaining the hard disk life warning algorithm through the second memory data structure and calculating the life prediction value of the target hard disk; in response to the life prediction value being less than a preset life warning threshold, generating warning information, and sending the warning information to the user.

[0148] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: in response to the need to issue a hard disk life warning for the target hard disk, the location information, the first identifier and the current write amount of the target hard disk are recorded in the log, and the current write amount is updated to the historical write amount.

[0149] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in the present application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0150] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0151] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. A hard disk life warning method, characterized in that: include: Obtaining hard disk information of each hard disk, and selecting hard disks supporting life warning function as target hard disks according to the hard disk information; Acquire a first identifier of the target hard disk and location information of the target hard disk, and determine whether the target hard disk matches the location information according to the first identifier; Acquire the current write amount and the historical write amount of the target hard disk according to the matching result; The current write amount and the historical write amount are sent to a processor, so that the processor obtains a preset hard disk life warning rule through a configuration file, and determines whether a hard disk life warning is required for the target hard disk according to the current write amount, the historical write amount and the hard disk life warning rule.

2. The hard disk life warning method according to claim 1, characterized in that: The step of obtaining hard disk information of each hard disk and selecting a hard disk supporting the life warning function as a target hard disk according to the hard disk information includes: Setting a timer, periodically traversing multiple hard disks in the server through the timer to obtain hard disk information of the hard disks, and saving the hard disk information to a first memory data structure, wherein the hard disk information includes a current write amount, a total write amount, and an early warning function flag; According to the warning function flag, hard disks supporting the life warning function are selected as target hard disks.

3. The hard disk life warning method according to claim 2, characterized in that: The step of selecting a hard disk supporting the life warning function as a target hard disk according to the warning function flag includes: Read historical hard disk data, and obtain historical update time from the historical hard disk data; Comparing the historical update time with the current system time; In response to the historical update time being consistent with the current system time, starting a new round of checking on the multiple hard disks in the server through the timer; In response to the historical update time being inconsistent with the current system time, traversing the hard disk information in the first memory data structure, and selecting a hard disk supporting the early warning function as a target hard disk according to the early warning function flag; After traversing the multiple hard disks, the historical update time in the historical hard disk data is updated based on the current system time.

4. The hard disk life warning method according to claim 2, characterized in that: The acquiring the first identifier of the target hard disk and the location information of the target hard disk, and judging whether the target hard disk matches the location information according to the first identifier, includes: Acquire a first identifier and corresponding location information of the target hard disk from the first memory data structure; According to the location information of the target hard disk, a second identifier corresponding to the location information at the time of the last update is obtained from the historical hard disk data; Determine whether the first identifier of the target hard disk is the same as the second identifier.

5. The hard disk life warning method according to claim 4, characterized in that: The step of obtaining the current write amount and the historical write amount of the target hard disk according to the matching result includes: In response to the first identifier of the target hard disk being different from the second identifier, determining that the target hard disk does not match the location information; Deleting the second identifier and the historical write amount corresponding to the location information from the historical hard disk data, and updating the corresponding relationship between the location information and the first identifier of the target hard disk into the historical hard disk data; In response to the first identifier of the target hard disk being the same as the second identifier, determining that the target hard disk matches the location information; Acquire the historical write amount of the target hard disk from the historical hard disk data according to the location information of the target hard disk and the first identifier, and acquire the current write amount of the target hard disk from the first memory data structure; Comparing the historical write volume of the target hard disk with the data volume corresponding to a preset inspection period; In response to the historical write amount not exceeding the data amount corresponding to the preset check period, updating the current write amount into the historical write amount; In response to the historical write amount exceeding the data amount corresponding to the preset check period, the earliest data in the historical write amount is deleted in chronological order until the historical write amount is a data amount that satisfies the check period.

6. The hard disk life warning method according to claim 1, characterized in that: The sending of the current write amount and the historical write amount to the processor, so that the processor obtains a preset hard disk life warning rule through a configuration file, and determines whether a hard disk life warning needs to be performed on the target hard disk according to the current write amount, the historical write amount and the hard disk life warning rule, including: Acquire a preset hard disk life warning rule from the configuration file, and store the hard disk life warning rule in a second memory data structure; In response to the processor receiving the current write amount and the historical write amount, obtaining the hard disk life warning rule through the second memory data structure, and calculating the life prediction value of the target hard disk according to the current write amount and the historical write amount based on the hard disk life warning rule; In response to the life prediction value being less than a preset life warning threshold, warning information is generated and sent to a user.

7. The hard disk life warning method according to claim 1, characterized in that: The method further comprises: In response to the need to issue a hard disk life warning for the target hard disk, the location information, the first identifier and the current write amount of the target hard disk are recorded in a log, and the current write amount is updated to the historical write amount.

8. A hard disk life warning device, characterized in that: The device comprises: A screening module, used for obtaining hard disk information of each hard disk, and screening hard disks supporting life warning function as target hard disks according to the hard disk information; A judgment module, used for obtaining a first identifier of the target hard disk and location information of the target hard disk, and judging whether the target hard disk matches the location information according to the first identifier; An acquisition module, used for acquiring the current write amount and the historical write amount of the target hard disk according to the matching result; The warning module is used to send the current write amount and the historical write amount to the processor, so that the processor obtains the preset hard disk life warning rules through the configuration file, and determines whether it is necessary to issue a hard disk life warning for the target hard disk according to the current write amount, the historical write amount and the hard disk life warning rules.

9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.