Hard disk fault repairing method and device, computer equipment and storage medium

By obtaining the hard disk status parameters and preset repair strategies, the fault area is shielded, the risk of data loss when the hard disk fails is solved, and efficient repair of hard disk failures and data security are achieved.

CN118550765APending Publication Date: 2024-08-27INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202410725253.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-05
Publication Date
2024-08-27

AI Technical Summary

Technical Problem

When a hard drive fails, the existing technology requires taking out the hard drive alone for repair. The repair method is simple and there is a risk of data loss.

Method used

By obtaining the status parameters of the hard disk, the fault area is determined and repaired according to the preset repair strategy. If the repair fails, the fault area is shielded and the data to be migrated is copied to other areas of the hard disk to avoid data loss caused by frequently taking out the hard disk for repair. .

Benefits of technology

Accurately determine the hard drive failure area, reduce detection resource usage, avoid data loss, ensure that data is stored in a normal area, and solve the risk of data loss when repairing hard drive failure.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118550765A
    Figure CN118550765A
Patent Text Reader

Abstract

The invention relates to the technical field of computers, and discloses a hard disk fault repairing method and device, computer equipment and a storage medium. Under the condition that the state parameter exceeds a first preset threshold value, performing read-write operation on data in the hard disk, and determining a fault area with read-write failure in the hard disk according to an operation result; repairing the fault area according to a preset repairing strategy, and judging whether the fault area which fails to be repaired exists or not; if the hard disk backup data exists, the fault area which fails to be repaired is shielded, data to be migrated in the fault area which fails to be repaired are determined according to the hard disk backup data, the data to be migrated are copied to other areas of the hard disk, and the hard disk backup data are generated after data of the hard disk are backed up at the first preset moment. The problems that when the hard disk breaks down, a single hard disk needs to be taken out to be repaired, the repairing means is single, and the data loss risk exists are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] With the rapid development of information technology, hard disks have become an important carrier for data storage. During the use of hard disks, data may be lost due to various reasons such as physical damage and software errors, causing huge losses to individuals and enterprises. Currently, when it is determined that a hard disk failure has caused some data on the hard disk to be unable to read or write, it is necessary to take out the faulty hard disk from the server and repair it individually. However, the repair process may cause bad sectors on the hard disk, resulting in data loss, causing huge time and economic losses to users.

[0003] Therefore, the related technology has the problem that when a hard disk fails, the hard disk needs to be taken out for repair, the repair method is single and there is a risk of data loss. Summary of the invention

[0004] In view of this, the present invention provides a hard disk failure repair method, device, computer equipment and storage medium to solve the problem that when a hard disk fails, the hard disk needs to be taken out for repair, the repair method is single and there is a risk of data loss.

[0005] In a first aspect, the present invention provides a hard disk failure repair method, comprising:

[0006] Get the status parameters of the hard disk;

[0007] When the state parameter exceeds the first preset threshold, performing a read and write operation on the data in the hard disk, and determining a fault area in the hard disk where the read and write fails according to the operation result;

[0008] Repair the faulty area according to the preset repair strategy, and determine whether there is a faulty area where repair fails;

[0009] If it exists, the faulty area where the repair failed is shielded, and the data to be migrated in the faulty area where the repair failed is determined based on the hard disk backup data, and the data to be migrated is copied to other areas of the hard disk, wherein the hard disk backup data is generated after backing up the data of the hard disk at a first preset time.

[0010] The hard disk fault repair method provided in this embodiment performs read and write operations on the hard disk data when the state parameter exceeds the first preset threshold value, and determines the faulty area of ​​the hard disk based on the operation result, so as to accurately determine whether the hard disk has failed and reduce the resource usage of the detection process. If there is a faulty area that fails to be repaired by the preset repair strategy, it is shielded to ensure that the data can be stored in the normal hard disk area, avoiding frequent removal of the hard disk for repair and causing data loss. This solves the problem that when a hard disk fails, the hard disk needs to be taken out for repair, and the repair method is single and there is a risk of data loss.

[0011] In some optional implementations, repairing the faulty area according to a preset repair strategy and determining whether there is a faulty area where repair fails include:

[0012] Repair the faulty area using preset repair software;

[0013] Performing read and write operations on the data in the fault area to determine whether there is a first unrepaired fault area where the read and write fails;

[0014] If there is no first unrepaired fault area, the repair is completed;

[0015] If there is a first unrepaired fault area, clearing the master boot record corresponding to the first unrepaired fault area, repartitioning the hard disk, and reloading the hard disk driver;

[0016] Performing read and write operations on data in the first unrepaired fault area to determine whether there is a second unrepaired fault area where reading and writing fails;

[0017] If there is no second unrepaired fault area, the repair is complete;

[0018] If there is a second unrepaired fault area, the second unrepaired fault area is used as a fault area where repair fails;

[0019] After shielding the fault area where the repair fails, the method further includes:

[0020] Get the capacity of the shielded area in the hard disk and the total capacity of the hard disk;

[0021] It is determined whether the ratio of the capacity to the total capacity is greater than a third preset threshold value. If so, the backup hard disk is enabled and the hard disk is disabled, wherein the backup hard disk is a hard disk for storing hard disk backup data.

[0022] In this embodiment, the faulty area is first repaired using a preset repair software, and then the faulty area is repaired by clearing the master boot record, repartitioning, and reloading the driver. If all repairs fail, the faulty area will be shielded. There are a variety of repair methods to avoid frequent removal of the hard disk for repair, which may lead to data loss.

[0023] In some optional implementations, shielding the faulty area where the repair fails, determining the data to be migrated in the faulty area where the repair fails according to the hard disk backup data, and copying the data to be migrated to other areas of the hard disk includes:

[0024] Determine readable and writable data adjacent to the fault area that failed to be repaired, and use the readable and writable data as a location identifier;

[0025] Locate the faulty area that failed to be repaired in the hard disk according to the position mark, and shield the faulty area that failed to be repaired;

[0026] According to the location identifier, the data to be migrated is searched in the hard disk backup data, and the data to be migrated is copied to other areas of the hard disk.

[0027] In some optional implementations, obtaining the status parameters of the hard disk includes:

[0028] Obtain a configuration command, determine a second preset time according to the configuration command, and obtain a state parameter at the second preset time;

[0029] And / or, upon receiving a status parameter acquisition instruction, acquiring the status parameter.

[0030] In this embodiment, the state parameters are obtained at the second preset time and / or when an instruction is received, so that unnecessary resource occupation caused by continuous acquisition of the state parameters is avoided, thereby improving the flexibility of the method.

[0031] In some optional embodiments, the method further comprises:

[0032] Obtaining power parameters of the power supply for the hard disk;

[0033] When the electric energy parameter is not within a preset range, determining the unbacked-up data in the hard disk and backing up the unbacked-up data;

[0034] Disconnect the power supply circuit between the power supply and the hard disk, and use the energy storage component to power the hard disk.

[0035] In this embodiment, whether the power supply fails is determined by judging whether the power parameters are within a preset range. In the event of a power failure, the hard disk is backed up first to ensure the data integrity of the hard disk, and the energy storage component is used to power the hard disk so that the hard disk can continue to work.

[0036] In some optional implementations, after obtaining the power parameters of the power supply providing power to the hard disk, the method further includes:

[0037] When the electric energy parameters are within a preset range, connecting the power conversion circuit;

[0038] The power conversion circuit is used to input the electric energy provided by the power supply into the energy storage component.

[0039] In some optional implementations, before determining the data to be migrated in the faulty area that failed to be repaired according to the hard disk backup data, the method further includes:

[0040] At a first preset time, adjusting the backup hard disk to a working state, wherein the backup hard disk is a hard disk storing hard disk backup data;

[0041] Determine the changed data of the hard disk, and write the changed data into the backup hard disk, wherein the changed data is included in the hard disk backup data;

[0042] Set the backup hard disk to hibernation mode.

[0043] In this embodiment, when backing up the hard disk, the backup hard disk is adjusted to a working state, and the changed data is written to the backup hard disk to avoid data loss and ensure the integrity of the hard disk data. After the backup is completed, the backup hard disk is adjusted to a dormant state to ensure the service life of the backup hard disk.

[0044] In a second aspect, the present invention provides a hard disk failure repair device, comprising:

[0045] A first acquisition module, used to acquire the status parameters of the hard disk;

[0046] A determination module, configured to perform a read and write operation on data in the hard disk when the state parameter exceeds a first preset threshold value, and determine a fault area in the hard disk where the read and write fails according to the operation result;

[0047] A judgment module is used to repair the fault area according to a preset repair strategy and determine whether there is a fault area that fails to be repaired;

[0048] The shielding module is used to shield the fault area where the repair fails, if any, and determine the data to be migrated in the fault area where the repair fails based on the hard disk backup data, and copy the data to be migrated to other areas of the hard disk, wherein the hard disk backup data is generated after backing up the data of the hard disk at a first preset time.

[0049] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the hard disk failure repair method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.

[0050] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the hard disk failure repair method of the first aspect or any corresponding embodiment thereof.

[0051] In a fifth aspect, the present invention provides a computer program product, including computer instructions, which are used to enable a computer to execute the hard disk failure repair method of the above-mentioned first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the related technologies, the drawings required for use in the specific embodiments or the related technical descriptions will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0053] Figure 1 is a flowchart of a hard disk failure repair method according to an embodiment of the present invention;

[0054] Figure 2 is a flowchart of processing a hard disk failure according to an embodiment of the present invention;

[0055] Figure 3 is a flow chart of repairing a hard disk and shielding a faulty area by using a preset repair logic according to an embodiment of the present invention;

[0056] Figure 4 is a schematic diagram of shielding a fault area according to an embodiment of the present invention;

[0057] Figure 5 is a flowchart of processing a power failure according to an embodiment of the present invention;

[0058] Figure 6 is a flow chart of charging an energy storage component according to an embodiment of the present invention;

[0059] Figure 7 is a flow chart of backing up a hard disk according to an embodiment of the present invention;

[0060] Figure 8 is a flow chart of a hard disk data protection method according to an embodiment of the present invention;

[0061] Fig. 9 is a structural block diagram of a hard disk failure repair device according to an embodiment of the present invention;

[0062] Fig.10 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0063] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0064] At present, the strategy for repairing hard disk failure is as follows: when receiving a repair request for a target logical disk, for any object to be repaired, the same storage data is sharded; for any storage node, according to the data size of each associated object in the storage node, each associated object is pre-read into the target storage medium of the storage node; for any object to be repaired, each associated object of the object to be repaired is obtained from the corresponding target storage medium in each storage node, and the object to be repaired is repaired according to each associated object of the object to be repaired. When the data size of the associated object is greater than the data threshold, the solid state drive is used as the target storage medium corresponding to the associated object. When the associated object is non-cross-block group data, the associated object is read into the memory, and the non-cross-block group data is data stored using one data block group. A clearing module is used to clear the metadata and associated objects pre-read into the memory of each storage node after the object to be repaired is repaired. However, the above repair strategy does not involve multi-level protection of disk data, and the above repair strategy cannot shield the hard disk fault area. If the repair fails, the hard disk needs to be unplugged for repair, which may cause the hard disk to have bad sectors, resulting in data loss.

[0065] Based on the above content, an embodiment of the present invention provides a hard disk fault repair method, which uses a data backup module to back up data on the main hard disk at regular intervals, and stores the hard disk backup data in a spare hard disk. At regular intervals, the hard disk status monitoring module is used to capture the hard disk's temperature, vibration, read error rate and other status parameters. If the status parameters are abnormal, the hard disk data is read and written to determine the fault area. The hard disk fault repair module is used to repair the fault area. If the fault area cannot be repaired, the fault area is shielded without unplugging the hard disk for repair. This ensures that data can be stored in normal disk space and ensures the normal use of the hard disk.

[0066] According to an embodiment of the present invention, a hard disk failure repair embodiment is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer device with data processing capabilities, such as a computer, a server, etc., and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0067] In this embodiment, a hard disk failure repair method is provided, which can be used for the above-mentioned computer device. Figure 1 FIG. 1 is a flow chart of a hard disk failure repair method according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:

[0068] Step S101, obtaining status parameters of the hard disk.

[0069] Specifically, hard disks include: mechanical hard disks (Hard Disk Drive, HDD), solid state disks (Solid State Disk, SSD), etc. The present application utilizes a hard disk fault repair system to execute a hard disk fault repair method. The system includes a hardware device for energy storage and a set of software setting programs. The program has multiple modules embedded in it to detect hard disk faults and detect repair packages and repair operation procedures after the faults are detected. The modules include: data backup module ①, hardware health monitoring module ②, software error protection / hard disk fault automatic repair module ③ and power supply fault protection module ④. The above modules can be referred to as module ①, module ②, module ③ and module ④, respectively.

[0070] Use the hardware health monitoring module② to obtain real-time or scheduled hard disk status parameters, such as temperature, vibration, read error rate, and SMART (Self-Monitoring Analysis and Reporting Technology) warning information and other hardware health indicators.

[0071] In addition, the time for the hardware health monitoring module ② to obtain the status parameters can be set in advance, or an instruction can be issued to control the hardware health monitoring module ② to obtain the status parameters.

[0072] Step S102, when the state parameter exceeds the first preset threshold, performing a read and write operation on the data in the hard disk, and determining a fault area in the hard disk where the read and write fails according to the operation result.

[0073] Specifically, if the state parameter exceeds the first preset threshold, the hard disk may be faulty. For example, if the first preset threshold corresponding to the temperature is 55°C, if the temperature of the hard disk is greater than 55°C, the hard disk may be faulty; if the first preset threshold corresponding to the vibration is 0.5G, G is the acceleration of gravity, if the vibration is greater than 0.5G, the hard disk may be faulty. Alternatively, if the hardware health monitoring module ② directly obtains the alarm information, the hard disk may be faulty.

[0074] The hardware health monitoring module ② also exists in the overall data protection system. If it is determined that the hard disk may have a fault, the system will issue a warning in time. The hardware health monitoring module ② has an analysis function, performs read and write operations on all the data in the hard disk, and determines the fault area in the hard disk where the read and write failed based on the operation results. When there is an abnormality in the hard disk data, that is, there is a fault area, the hardware health monitoring module ② triggers and starts the hard disk repair function of the software error protection / hard disk fault automatic repair module ③. The above process is as follows Figure 2 As shown, the hard disk data is monitored and read in real time; abnormal data is analyzed after being captured; and the hard disk fault automatic repair module is called.

[0075] Step S103: repair the faulty area according to a preset repair strategy, and determine whether there is a faulty area that fails to be repaired.

[0076] Specifically, the software error protection / hard disk fault automatic repair module ③ repairs the faulty area according to a preset repair strategy. The preset repair strategy is, for example, using repair software to repair the faulty area in the hard disk. The repair software is, for example, DiskGenius software.

[0077] After the repair is completed, the software error protection / hard disk fault automatic repair module③ re-reads and writes the data in the repaired fault area. If all data is read and written successfully, it means that the repair is successful and there is no fault area that failed to be repaired. If there is still data that failed to be read or written, it means that there is still a fault area that failed to be repaired.

[0078] Step S104, if it exists, shield the faulty area where the repair fails, and determine the data to be migrated in the faulty area where the repair fails according to the hard disk backup data, and copy the data to be migrated to other areas of the hard disk, wherein the hard disk backup data is generated after backing up the data of the hard disk at a first preset time.

[0079] Specifically, if the software error protection / hard disk fault automatic repair module ③ determines that there is a fault area that has failed to be repaired, the fault area that has failed to be repaired will be shielded, and the system cannot read or write data in the shielded area. In addition, in order to ensure the integrity of the hard disk data, the fault area that has failed to be repaired needs to be restored and saved in other areas of the hard disk. The steps include: querying the hard disk backup data for the data corresponding to the fault area that has failed to be repaired, that is, the data to be migrated; and copying the data to be migrated to other areas of the hard disk.

[0080] In addition, the hard disk backup data is generated after the data backup module ① backs up the hard disk data at the first preset time, and the hard disk backup data can be stored in a storage device such as a backup hard disk and a memory.

[0081] The hard disk fault repair method provided in this embodiment performs read and write operations on the hard disk data when the state parameter exceeds the first preset threshold value, and determines the faulty area of ​​the hard disk based on the operation result, so as to accurately determine whether the hard disk has failed and reduce the resource usage of the detection process. If there is a faulty area that fails to be repaired by the preset repair strategy, it is shielded to ensure that the data can be stored in the normal hard disk area, avoiding frequent removal of the hard disk for repair and causing data loss. This solves the problem that when a hard disk fails, the hard disk needs to be taken out for repair, and the repair method is single and there is a risk of data loss.

[0082] In some optional implementations, repairing the faulty area according to a preset repair strategy and determining whether there is a faulty area where repair fails include:

[0083] Repair the faulty area using preset repair software;

[0084] Performing read and write operations on the data in the fault area to determine whether there is a first unrepaired fault area where the read and write fails;

[0085] If there is no first unrepaired fault area, the repair is completed;

[0086] If there is a first unrepaired fault area, clearing the master boot record corresponding to the first unrepaired fault area, repartitioning the hard disk, and reloading the hard disk driver;

[0087] Performing read and write operations on data in the first unrepaired fault area to determine whether there is a second unrepaired fault area where reading and writing fails;

[0088] If there is no second unrepaired fault area, the repair is complete;

[0089] If there is a second unrepaired fault area, the second unrepaired fault area is used as a fault area where repair fails;

[0090] After shielding the fault area where the repair fails, the method further includes:

[0091] Get the capacity of the shielded area in the hard disk and the total capacity of the hard disk;

[0092] It is determined whether the ratio of the capacity to the total capacity is greater than a third preset threshold value. If so, the backup hard disk is enabled and the hard disk is disabled, wherein the backup hard disk is a hard disk for storing hard disk backup data.

[0093] Specifically, module ② is a hardware health monitoring module, and module ③ is a software error protection / hard disk failure automatic repair module.

[0094] Combination Figure 3This embodiment is described below: Module ② detects that data cannot be accessed, that is, there is a faulty area in the hard disk, and module ③ is activated to repair the faulty area.

[0095] The preset repair software is, for example, DiskGenius software. Module ③ uses the preset repair software to repair the faulty area, for example, Module ③ starts to automatically use DiskGenius software for repair.

[0096] After the repair is completed, module ③ performs read and write operations on the data in the fault area to determine whether the data in all fault areas can be accessed normally, and then determines whether there is a first unrepaired fault area where the read and write failed, including: if the data in all original fault areas can be accessed normally, there is no first unrepaired fault area, and the repair is successful, and the main disk, i.e., the hard disk, continues to be used normally. If there is still data in the original fault area that is currently inaccessible, the repair fails, and the area where these inaccessible data are located is the first unrepaired fault area, which needs to be further repaired.

[0097] Module ③ clears the Master Boot Record (MBR) corresponding to the first unrepaired fault area, repartitions the hard disk, and reloads the hard disk driver. For example, module ③ continues to try to clear the MBR, repartition, and reload the driver. After the repair is completed, module ③ reads and writes the data in the original first unrepaired fault area. If the data can be accessed normally, it means that there is no second unrepaired fault area, then the repair is successful, and the main disk, i.e., the hard disk, continues to be used normally. If there is still data in the original first unrepaired fault area that is currently not normally accessible, then the repair fails. The area where these inaccessible data are located is the second unrepaired fault area, which needs to be shielded.

[0098] If there is a second unrepaired fault area, module ③ uses the second unrepaired fault area as a fault area that failed to be repaired, and shields the fault area that failed to be repaired, for example: identifying the data before and after the fault area that failed to be repaired, and shielding the faulty sector, that is, the fault area that failed to be repaired.

[0099] After shielding the faulty area where the repair failed, module ③ will also obtain the capacity of the shielded area in the hard disk and the total capacity of the hard disk. The third preset threshold is, for example, 10%, 15% or other. Taking the third preset threshold of 10% as an example, module ③ determines whether the capacity of the shielded area, that is, the ratio of the cumulative shielding amount to the total capacity of the hard disk is greater than 10%. If it is greater, the main disk and the backup disk will swap logical positions, that is, the backup hard disk will be enabled and the hard disk will be disabled. When backing up hard disk data, data backup module ① will store the hard disk backup data to the backup hard disk. If the ratio is less than 10%, that is, the cumulative shielding amount is less than 10% of the total capacity, the main disk, that is, the hard disk, will continue to be used normally.

[0100] In this embodiment, the faulty area is first repaired using a preset repair software, and then the faulty area is repaired by clearing the master boot record, repartitioning, and reloading the driver. If all repairs fail, the faulty area will be shielded. There are a variety of repair methods to avoid frequent removal of the hard disk for repair, which may lead to data loss.

[0101] In some optional implementations, shielding the faulty area where the repair fails, determining the data to be migrated in the faulty area where the repair fails according to the hard disk backup data, and copying the data to be migrated to other areas of the hard disk includes:

[0102] Determine readable and writable data adjacent to the fault area that failed to be repaired, and use the readable and writable data as a location identifier;

[0103] Locate the faulty area that failed to be repaired in the hard disk according to the position mark, and shield the faulty area that failed to be repaired;

[0104] According to the location identifier, the data to be migrated is searched in the hard disk backup data, and the data to be migrated is copied to other areas of the hard disk.

[0105] Specifically, the software error protection / hard disk fault automatic repair module ③, hereinafter referred to as module ③. Module ③ determines the readable and writable data adjacent to the fault area where the repair failed, and uses the readable and writable data as a position identifier, for example: Figure 4 As shown, the faulty sector is the faulty area that fails to be repaired, and the readable and writable data adjacent to the faulty area that fails to be repaired is determined, that is, normal data, and the readable and writable data is used as a position identifier.

[0106] Module ③ can locate the failed repair area in the hard disk through these location identifiers, and shield the failed repair area. According to the location identifier, the data to be migrated is searched in the hard disk backup data, and the data to be migrated is copied to other areas of the hard disk, which are areas in the hard disk where data can be read and written normally.

[0107] In some optional implementations, obtaining the status parameters of the hard disk includes:

[0108] Obtain a configuration command, determine a second preset time according to the configuration command, and obtain a state parameter at the second preset time;

[0109] And / or, upon receiving a status parameter acquisition instruction, acquiring the status parameter.

[0110] Specifically, the hardware health monitoring module ② is referred to as module ② for short. Module ② can detect the hard disk in real time and obtain the status parameters of the hard disk in real time.

[0111] In order to reduce the resource occupation caused by obtaining the status parameters of the hard disk, the present embodiment can set the interval time or time for obtaining the status parameters according to customer needs, for example: obtain the status parameters once every 5 minutes; set the second preset time to x hours and y minutes, x and y can be set according to actual needs, the second preset time is not unique, and the status parameters are obtained once at each second preset time. In addition, the present embodiment sets a human-computer interaction interface, through which the user can issue configuration instructions, use the configuration instructions to set the second preset time, and adjust the time for module ② to obtain the status parameters. The user can issue the status parameter acquisition instruction through the human-computer interaction interface, and after receiving the status parameter acquisition instruction, module ② will immediately obtain the status parameters. In addition, through the human-computer interaction interface, the user can also adjust the specific information of data capture and monitoring at any time, so as to make the system suitable for various server environments.

[0112] In this embodiment, the state parameters are obtained at the second preset time and / or when an instruction is received, so that unnecessary resource occupation caused by continuous acquisition of the state parameters is avoided, thereby improving the flexibility of the method.

[0113] In some optional embodiments, the method further comprises:

[0114] Obtaining power parameters of the power supply for the hard disk;

[0115] When the electric energy parameter is not within a preset range, determining the unbacked-up data in the hard disk and backing up the unbacked-up data;

[0116] Disconnect the power supply circuit between the power supply and the hard disk, and use the energy storage component to power the hard disk.

[0117] Specifically, the hard disk fault repair system includes a hardware health monitoring module ② and a power fault protection module ④. Among them, the power fault protection module ④ is used to provide a stable power supply for the hard disk. After starting, the module can detect the circuit status in real time. When the voltage is unstable, the data backup function of the module ① will be triggered first, and all new data in the main disk up to the last backup will be backed up to the backup disk in time. In order to prevent the hard disk from being damaged due to voltage fluctuations or current shocks, the module is configured with an intelligent circuit to control the physical device, including an input interface, an output interface, a power conversion circuit, a control circuit and an energy storage component. The input interface is used to connect an external power supply device; the output interface is used to connect a hard disk; the power conversion circuit is used to convert the electric energy received by the input interface into the electric energy required by the hard disk; the control circuit is used to monitor the electric signal of the input interface, and control the working state of the power conversion circuit and the energy storage circuit according to the change of the electric signal; the energy storage circuit is used to provide stable electric energy to the hard disk when the power supply is unstable.

[0118] The hardware health monitoring module ② acquires the power parameters of the power supply for the hard disk in real time or periodically, such as the status, voltage, current, etc. of the power supply unit (PSU).

[0119] When the power parameters are not within the preset range, it means that there is a problem with the current hard disk power supply, and the power failure protection module ④ is enabled. For example, the preset range for voltage is 5V to 12V. If the voltage is 13V, the voltage is too high and the power supply is faulty; the preset range for current is 0.5A to 1.5A. If the current is 0.3A, the current is too low and the power supply is faulty. In order to avoid data loss caused by hard disk power failure, hard disk damage, etc., the power failure protection module ④ will automatically trigger the data backup module ① to determine the unbacked up data in the hard disk and back up the unbacked up data.

[0120] The power failure protection module ④ disconnects the power supply circuit between the power supply and the hard disk, and uses the energy storage component to power the hard disk. Figure 5 As shown, module ② detects power anomaly, enables power failure protection module ④, and immediately starts the backup function of module ①. The energy storage component in power failure protection module ④ distributes stable voltage to the hard disk.

[0121] In this embodiment, whether the power supply fails is determined by judging whether the power parameters are within a preset range. In the event of a power failure, the hard disk is backed up first to ensure the data integrity of the hard disk, and the energy storage component is used to power the hard disk so that the hard disk can continue to work.

[0122] In some optional implementations, after obtaining the power parameters of the power supply providing power to the hard disk, the method further includes:

[0123] When the electric energy parameters are within a preset range, connecting the power conversion circuit;

[0124] The power conversion circuit is used to input the electric energy provided by the power supply into the energy storage component.

[0125] Specifically, when the power parameters are within the preset range, it means that the power supply is not faulty and is in normal working state. At this time, the power supply fault protection module ④ will connect to the power conversion circuit, and input the power provided by the power supply into the energy storage component through the power conversion circuit to charge the energy storage component. Figure 6 As shown, the power supply is in normal working state, the power conversion circuit is charging, and the energy storage circuit is used to store energy.

[0126] In some optional implementations, before determining the data to be migrated in the faulty area that failed to be repaired according to the hard disk backup data, the method further includes:

[0127] At a first preset time, adjusting the backup hard disk to a working state, wherein the backup hard disk is a hard disk storing hard disk backup data;

[0128] Determine the changed data of the hard disk, and write the changed data into the backup hard disk, wherein the changed data is included in the hard disk backup data;

[0129] Set the backup hard disk to hibernation mode.

[0130] Specifically, the data backup module ① can back up the data in the hard disk periodically or in real time. Periodic backup means backing up the hard disk at the first preset time. The backup data can be stored in a backup hard disk set in the server. Through data backup, even if the original data in the hard disk is lost, it can be restored from the backup. Figure 7 As shown, the primary data disk is responsible for all data read and write needs during the client's data use process, and the backup data disk will back up the data in the primary data disk in real time or periodically. After backing up the data, the disk is in a dormant state until the next backup, during which no read and write actions will occur to ensure the service life of the backup disk. Based on the above content, the process of regular hard disk backup by the data backup module ① includes: at the first preset time, adjusting the backup hard disk to the working state; determining the changed data of the hard disk, and writing the changed data to the backup hard disk, such as: the data changed in the hard disk since the last backup; after the backup is completed, adjusting the backup hard disk to the dormant state.

[0131] In addition, the step of backing up the hard disk data by the data backup module ① may also include steps A1 to A3.

[0132] Step A1, the data backup module ① determines the data to be backed up.

[0133] In this embodiment, when the data backup module ① receives a data backup instruction, the data backup module ① determines the unbacked up data based on the writing time of the data in the hard disk, treats it as the data to be backed up, and determines the attribute information of the backup data. The attribute information may be the file number of the data to be backed up, etc.

[0134] Step A2, the data backup module ① stores the data to be backed up into at least one empty backup package of a set length to obtain at least one target backup package.

[0135] Among them, backup data of a set size in the data to be backed up is obtained according to the storage order, the backup data of the set size is stored in the package body of the current empty backup package, and description information is generated according to the effective length of the backup data and the position of the backup data in the data file to be backed up, the description information is stored in the package header of the current empty backup package, a target backup package is obtained, and the next backup data of a set size in the data to be backed up is continuously obtained until all the data to be backed up are encapsulated as a backup package.

[0136] Step A3, the data backup module ① stores at least one target backup package to the backup hard disk.

[0137] Specifically, after the package to be backed up is encapsulated into at least one target backup package, a backup file is created in the backup hard disk according to the at least one target backup package, and the at least one target backup package is written into the backup file. The storage space of the backup file can accommodate at least one target backup package. In this embodiment, after obtaining a target backup package, the target backup package is stored in the backup hard disk, and there is no need to wait until all the data to be backed up are encapsulated into at least one target backup package before storing the at least one target backup package. By encapsulating the data to be backed up into at least one target backup package, multiple target backup packages can be backed up at the same time, without considering the order of the data pages stored in the backup package, and without considering the storage order between the backup packages, thereby improving the efficiency of data backup.

[0138] In this embodiment, after all the data to be backed up are backed up, the data to be backed up can be backed up as at least one backup file, and the backup result is a backup set. The backup set consists of a META file and at least one backup file. The META file stores the description information of the backup set, including the backup file information, the information of the database corresponding to the backup set, the name of the backup set, etc.

[0139] The implementation process of storing at least one target backup package to the backup hard disk may be to send the obtained target backup package to the storage thread task queue, where the server obtains the encapsulated target backup package and then stores the target backup package to the backup hard disk.

[0140] In this embodiment, the data backup module ① creates a reading thread task queue, a processing thread task queue and a storage thread task queue when performing data backup. The three thread task queues are independent of each other. The processing speed of the next thread task queue will not affect the processing speed of the previous thread task queue, thereby improving the data backup rate.

[0141] In this embodiment, when backing up the hard disk, the backup hard disk is adjusted to a working state, and the changed data is written to the backup hard disk to avoid data loss and ensure the integrity of the hard disk data. After the backup is completed, the backup hard disk is adjusted to a dormant state to ensure the service life of the backup hard disk.

[0142] In some optional implementations, this embodiment provides a hard disk data protection method, such as Figure 8As shown, the method comprises the following steps: the data protection system monitors data in real time; the data of the primary and backup disks are automatically backed up at regular intervals; module ② detects a power data failure; the backup function of module ① is started; the intelligent circuit protection function of module ④ is called; module ② detects that the data cannot be accessed; module ③ automatically repairs the failure with software, if the data can be accessed normally, the primary disk continues to be used normally, if the data is still inaccessible, continue to try to clear the MBR, repartition, and reload the driver; if the data is still inaccessible, identify the previous and next data, and shield the faulty sector; if the cumulative shielding amount is greater than 10% of the total capacity, the primary disk and the backup disk are electrically ring logically located; if the cumulative shielding amount is less than 10% of the total capacity, the primary disk continues to be used.

[0143] In this embodiment, the present invention can protect the data in the hard disk at multiple levels. First, the data is backed up at intervals, and the backup frequency of the data is automatically increased or decreased through real-time monitoring of the health status of the hard disk. When it is detected that a certain segment of data in the hard disk cannot be accessed, the data will be restored to another location by sector copying or direct backup according to the location of the original data segment, and the faulty sector will be shielded through sector identification to ensure that subsequent data storage can be stored in normal disk space. Multi-level protection of disk data increases the reliability of server data storage; sectors are identified, faulty areas are shielded, and normal use of the disk is guaranteed.

[0144] In this embodiment, a hard disk fault repair device is also provided, which is used to implement the above embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can be a combination of software and / or hardware that implements 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.

[0145] This embodiment provides a hard disk failure repair device, such as Fig. 9 As shown, including:

[0146] The first acquisition module 901 is used to acquire the status parameters of the hard disk;

[0147] The determination module 902 is used to perform a read and write operation on the data in the hard disk when the state parameter exceeds the first preset threshold value, and determine the fault area in the hard disk where the read and write fails according to the operation result;

[0148] The judgment module 903 is used to repair the fault area according to the preset repair strategy and determine whether there is a fault area that fails to be repaired;

[0149] The shielding module 904 is used to shield the faulty area where the repair fails, if any, and determine the data to be migrated in the faulty area where the repair fails based on the hard disk backup data, and copy the data to be migrated to other areas of the hard disk, wherein the hard disk backup data is generated after backing up the data of the hard disk at a first preset time.

[0150] In some optional implementations, the determination module 903 repairs the faulty area according to a preset repair strategy, and determines whether there is a faulty area that fails to be repaired, including:

[0151] Repair the faulty area using preset repair software;

[0152] Performing read and write operations on the data in the fault area to determine whether there is a first unrepaired fault area where the read and write fails;

[0153] If there is no first unrepaired fault area, the repair is completed;

[0154] If there is a first unrepaired fault area, clearing the master boot record corresponding to the first unrepaired fault area, repartitioning the hard disk, and reloading the hard disk driver;

[0155] Performing read and write operations on data in the first unrepaired fault area to determine whether there is a second unrepaired fault area where reading and writing fails;

[0156] If there is no second unrepaired fault area, the repair is complete;

[0157] If there is a second unrepaired fault area, the second unrepaired fault area is used as a fault area where repair fails;

[0158] In some optional embodiments, the device further comprises:

[0159] The second acquisition module is used to acquire the capacity of the shielded area in the hard disk and the total capacity of the hard disk;

[0160] The hard disk switching module is used to determine whether the ratio of the capacity to the total capacity is greater than a third preset threshold. If so, the backup hard disk is enabled and the hard disk is disabled, wherein the backup hard disk is a hard disk for storing hard disk backup data.

[0161] In some optional implementations, the shielding module 904 shields the faulty area that failed to be repaired, determines the data to be migrated in the faulty area that failed to be repaired according to the hard disk backup data, and copies the data to be migrated to other areas of the hard disk, including:

[0162] Determine readable and writable data adjacent to the fault area that failed to be repaired, and use the readable and writable data as a location identifier;

[0163] Locate the faulty area that failed to be repaired in the hard disk according to the position mark, and shield the faulty area that failed to be repaired;

[0164] According to the location identifier, the data to be migrated is searched in the hard disk backup data, and the data to be migrated is copied to other areas of the hard disk.

[0165] In some optional implementations, the first acquisition module 901 acquires the status parameters of the hard disk, including:

[0166] Obtain a configuration command, determine a second preset time according to the configuration command, and obtain a state parameter at the second preset time;

[0167] And / or, upon receiving a status parameter acquisition instruction, acquiring the status parameter.

[0168] In some optional embodiments, the device further comprises:

[0169] A third acquisition module is used to obtain power parameters of the power supply to the hard disk;

[0170] A backup module, used for determining the unbacked-up data in the hard disk and backing up the unbacked-up data when the electric energy parameter is not within a preset range;

[0171] The first circuit control module is used to disconnect the power supply circuit between the power source and the hard disk, and use the energy storage component to supply power to the hard disk.

[0172] In some optional embodiments, the device further comprises:

[0173] A second circuit control module is used to connect the power conversion circuit when the electric energy parameter is within a preset range;

[0174] The third circuit control module is used to input the electric energy provided by the power supply into the energy storage component by using the power conversion circuit.

[0175] In some optional embodiments, the device further comprises:

[0176] An adjustment module, used for adjusting the backup hard disk to a working state at a first preset time, wherein the backup hard disk is a hard disk storing hard disk backup data;

[0177] A writing module, used for determining the changed data of the hard disk and writing the changed data into the backup hard disk, wherein the changed data is included in the hard disk backup data;

[0178] The adjustment module is used to adjust the backup hard disk to a dormant state.

[0179] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.

[0180] The hard disk fault repair device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.

[0181] The embodiment of the present invention also provides a computer device having the above Fig. 9 The hard disk failure recovery device shown.

[0182] See also Fig.10 , Fig.10 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Fig.10 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Fig.10 A processor 10 is taken as an example.

[0183] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.

[0184] The memory 20 stores instructions executable by at least one processor 10, so that at least one processor 10 executes the method shown in the above embodiment.

[0185] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device 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.

[0186] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.

[0187] The computer device further comprises a communication interface 30 for the computer device to communicate with other devices or a communication network.

[0188] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.

[0189] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc., and accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.

[0190] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.

Claims

1. A hard disk failure repair method, characterized in that: The method comprises: Get the status parameters of the hard disk; When the state parameter exceeds a first preset threshold, performing a read and write operation on the data in the hard disk, and determining a fault area in the hard disk where the read and write fails according to the operation result; Repair the faulty area according to a preset repair strategy, and determine whether there is a faulty area where repair fails; If it exists, the faulty area where the repair failed is shielded, and the data to be migrated in the faulty area where the repair failed is determined based on the hard disk backup data, and the data to be migrated is copied to other areas of the hard disk, wherein the hard disk backup data is generated after backing up the data of the hard disk at a first preset time.

2. The method according to claim 1, characterized in that The repairing the faulty area according to the preset repair strategy and determining whether there is a faulty area where repair fails includes: Repairing the fault area using preset repair software; Performing read and write operations on the data in the fault area to determine whether there is a first unrepaired fault area where the read and write fails; If the first unrepaired fault area does not exist, the repair is completed; If the first unrepaired fault area exists, clearing the master boot record corresponding to the first unrepaired fault area, repartitioning the hard disk, and reloading the driver of the hard disk; Performing read and write operations on the data in the first unrepaired fault area to determine whether there is a second unrepaired fault area where reading and writing fails; If the second unrepaired fault area does not exist, the repair is completed; If the second unrepaired fault area exists, taking the second unrepaired fault area as the fault area where repair fails; After shielding the fault area where the repair fails, the method further includes: Obtaining the capacity of the shielded area in the hard disk and the total capacity of the hard disk; Determine whether the ratio of the capacity to the total capacity is greater than a third preset threshold; if so, enable the backup hard disk and disable the hard disk, wherein the backup hard disk is a hard disk that stores the hard disk backup data.

3. The method according to claim 1, characterized in that The shielding of the failed repair area, determining the data to be migrated in the failed repair area according to the hard disk backup data, and copying the data to be migrated to other areas of the hard disk includes: Determine readable and writable data adjacent to the faulty area where repair fails, and use the readable and writable data as a position identifier; Locating the faulty area where the repair fails according to the position identifier in the hard disk, and shielding the faulty area where the repair fails; According to the location identifier, the hard disk backup data is searched for the data to be migrated, and the data to be migrated is copied to other areas of the hard disk.

4. The method according to claim 1, characterized in that: The step of obtaining the status parameters of the hard disk includes: Obtain a configuration command, determine a second preset time according to the configuration command, and obtain the state parameter at the second preset time; And / or, upon receiving a status parameter acquisition instruction, acquiring the status parameter.

5. The method according to claim 1, characterized in that The method further comprises: Acquiring power parameters of a power source providing power to the hard disk; When the electric energy parameter is not within a preset range, determining the unbacked-up data in the hard disk, and backing up the unbacked-up data; The power supply circuit between the power supply and the hard disk is disconnected, and the hard disk is powered by an energy storage component.

6. The method according to claim 5, characterized in that After acquiring the power parameters of the power supply providing power to the hard disk, the method further includes: When the electric energy parameter is within the preset range, connecting the power conversion circuit; The power conversion circuit is used to input the electric energy provided by the power supply into the energy storage component.

7. The method according to claim 1, characterized in that Before determining the data to be migrated in the failed repair area according to the hard disk backup data, the method further includes: At the first preset time, adjusting the backup hard disk to a working state, wherein the backup hard disk is a hard disk storing the hard disk backup data; Determine the changed data of the hard disk, and write the changed data into the backup hard disk, wherein the changed data is included in the hard disk backup data; The backup hard disk is adjusted to a dormant state.

8. A hard disk failure repair device, characterized in that: The device comprises: A first acquisition module, used to acquire the status parameters of the hard disk; a determination module, configured to perform a read and write operation on the data in the hard disk when the state parameter exceeds a first preset threshold value, and determine a fault area in the hard disk where the reading and writing fails according to the operation result; A judgment module, used to repair the fault area according to a preset repair strategy, and to judge whether there is a fault area where repair fails; A shielding module is used to shield the faulty area where the repair fails, if any, and determine the data to be migrated in the faulty area where the repair fails based on the hard disk backup data, and copy the data to be migrated to other areas of the hard disk, wherein the hard disk backup data is generated after backing up the data of the hard disk at a first preset time.

9. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the hard disk failure repair method according to any one of claims 1 to 7 by executing the computer instructions.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the hard disk failure repair method according to any one of claims 1 to 7.

Citation Information

Cited By

  • Information viewing method of storage device, electronic device and storage medium

    CN120429153A

  • Information viewing method of storage device, electronic device, and storage medium

    CN120429153B