Data reconstruction method and device, storage medium and program product

By restructuring the initial independent disk redundant array in the distributed RAID and the establishment of a mapping relationship, the problem of low reconstruction efficiency after distributed RAID failure is solved, and efficient data recovery and simplified reconstruction process is achieved.

CN119336536AActive Publication Date: 2025-01-21INSPUR SUZHOU INTELLIGENT TECH CO LTD

Patent Information

Application Number
CN202411876269.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-19
Publication Date
2025-01-21
Estimated Expiration
2044-12-19

AI Technical Summary

Technical Problem

Existing distributed RAIDs are inefficient in refactoring after failure, resulting in increased risk of business downtime and data loss, especially in the absence of hot spare space.

Method used

By determining the fault hard disk and normal hard disk in the initial independent disk redundant array, write the fault hard disk data to the normal hard disk, thereby reconstruct the initial independent disk redundant array, and establish the mapping relationship between the initial and target independent disk redundant arrays. The mapping relationship is saved based on metadata in order to restore the initial independent disk redundant array.

Benefits of technology

After a distributed RAID failure occurs, the parity block can be recalculated without changing the stripe width, simplifying the RAID data reconstruction process, improving data recovery speed, and reducing the calculation amount and risk of failure recovery.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119336536A_ABST
    Figure CN119336536A_ABST
Patent Text Reader

Abstract

The invention discloses a data reconstruction method and device, a storage medium and a program product, and relates to the technical field of data storage, and the method comprises the following steps: reconstructing an initial redundant array of independent disks according to a hard disk state of the initial redundant array of independent disks to obtain a target redundant array of independent disks; after the reconstruction of the initial redundant array of independent disks is completed, establishing a mapping relation between the initial redundant array of independent disks and the target redundant array of independent disks, and storing the mapping relation based on metadata to obtain corresponding target metadata, and recovering the target redundant array of independent disks to the initial redundant array of independent disks according to the target metadata. When the disk fails or restores to normal for data reconstruction, the corresponding data can be directly written back according to the mapping condition between the blocks, additional check block calculation is not needed, and the data recovery speed is increased.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data storage, and in particular to a data reconstruction method, device, storage medium and program product. Background Art

[0002] For the currently commonly used distributed RAID (Redundant Array of Independent Disks), the hard disk can be divided into multiple blocks of the same size through virtualization technology. One block on each hard disk is used to form a stripe. Each stripe can be regarded as a small traditional RAID. Distributed RAID is composed of these large number of stripes. For a stripe, there are data blocks for storing data and check blocks for storing verification data. The total number of these two types of blocks is called the stripe width. If the hard disk has a lot of data, there are other blocks in the stripe. These blocks can be used as hot spare blocks. That is, when a hard disk failure that does not exceed the RAID redundancy level occurs, the lost data or check blocks can be reconstructed and calculated through the reconstruction task and written into the check blocks. After the reconstruction is completed, the RAID can restore its redundancy level; but if there are no hot spare blocks available in the stripe, the RAID will lose its redundancy until a new hard disk is inserted to provide a hot spare block and complete the reconstruction task. For the currently commonly used RAID configuration, in order to increase the utilization rate of the hard disk, not too many additional hard disks will be provided as hot spares. The above failure scenario often occurs. If a hard disk failure occurs again in this scenario, it is easy to cause business downtime and data loss.

[0003] At present, in order to solve the problem of hard disk failure in the scenario where there is no hot spare space, the lost data can be reconstructed into unused blocks to form some new stripes, that is, by reducing the number of data blocks in the stripe, the number of check blocks in the stripe is guaranteed not to decrease, and the redundancy capacity of RAID is not reduced, that is, the shrinking reconstruction. However, after the shrinking reconstruction is completed, it is equivalent to that the stripe width of all stripes has been reduced, and for the original stripe, after one data block is reduced, all the existing check blocks are invalid. In addition, the newly generated stripe has no check blocks, so the entire RAID needs to recalculate the full amount of check blocks. This process is time-consuming and the RAID does not have redundancy in this process. In addition, when the new hard disk is reinserted for recovery, the data in the newly generated stripe needs to be rewritten into the original stripe, so that the stripe width of the original stripe changes again, and the full amount of check blocks still needs to be recalculated. If multiple shrinking reconstructions have occurred before, multiple full amount of check blocks need to be recalculated, which is a huge task and takes a long time. Moreover, if the reconstructed block in the stripe that is reconstructed by shrinking is a check block, additional processing is required, that is, a block needs to be selected from the remaining blocks as a new check block, and the data of the block is used as the target block for shrinking and reconstruction. The above scheme also results in that the interface for accessing the reconstructed area is no longer accessible through the original path, and a new path needs to be provided to the upper layer, which increases the coupling between different modules and the risk of data errors.

[0004] It can be seen that how to improve the efficiency of reconstruction after a distributed RAID failure occurs is a problem that those skilled in the art need to solve. Summary of the invention

[0005] The purpose of the embodiments of the present invention is to provide a data reconstruction method, device, storage medium and program product, which can solve the problem of low reconstruction efficiency after a distributed RAID fails.

[0006] In order to solve the above technical problems, in a first aspect, an embodiment of the present invention provides a data reconstruction method, comprising:

[0007] Reconstruct the initial redundant array of independent disks according to the hard disk state of the initial redundant array of independent disks to obtain a target redundant array of independent disks;

[0008] After the reconstruction of the initial redundant array of independent disks is completed, a mapping relationship between the initial redundant array of independent disks and the target redundant array of independent disks is established, and the mapping relationship is saved based on metadata to obtain corresponding target metadata, so as to restore the target redundant array of independent disks to the initial redundant array of independent disks according to the target metadata.

[0009] In some embodiments, the reconstructing the initial redundant array of independent disks according to the hard disk status of the initial redundant array of independent disks includes:

[0010] Determine the faulty hard disk and normal hard disk in the current initial independent redundant array of disks according to the hard disk status;

[0011] The data stored in the failed hard disk is written into the normal hard disk to reconstruct the initial redundant array of independent disks.

[0012] In some embodiments, writing the data stored in the failed hard disk to the normal hard disk to reconstruct the initial redundant array of independent disks includes:

[0013] Determine each faulty data block in the faulty hard disk;

[0014] A new initial data block is constructed in the normal hard disk, and the data in the faulty data block is stored in the initial data block to reconstruct the initial redundant array of independent disks.

[0015] In some embodiments, after constructing a new initial data block in the normal hard disk, the method further includes:

[0016] A normal data block having stored data in the normal hard disk is determined, and during the process of storing the data in the faulty data block into the initial data block, the data in the normal data block is kept unchanged.

[0017] In some embodiments, storing the data in the fault data block to the initial data block includes:

[0018] Determine the stripe width of the stripe corresponding to the current normal hard disk;

[0019] A data storage rule is constructed according to the stripe width, and the data in the faulty data block is stored in the initial data block based on the data storage rule; the data storage rule states that the number of initial data blocks in each stripe for storing the data in the faulty data block is equal to the stripe width minus one.

[0020] In some embodiments, after storing the data in the fault data block to the initial data block, the method further includes:

[0021] Using the initial data blocks that do not store data in each stripe as initial check blocks;

[0022] New check data is generated according to the data stored in the initial data block in each stripe, and the check data is stored in the initial check block.

[0023] In some embodiments, the process of storing the data in the fault data block into the initial data block includes:

[0024] If the number of the initial data blocks used to store the data in the faulty data blocks is greater than the number of the faulty data blocks, after completing the operation of storing the data in the faulty data blocks into the initial data blocks, determining the corresponding remaining initial data blocks;

[0025] The data in the remaining initial data blocks are set to zero.

[0026] In some embodiments, generating new check data according to the data stored in each stripe to the initial data block includes:

[0027] An XOR operation is performed on the data stored in the initial data block in each stripe to generate new verification data according to the obtained operation result.

[0028] In some embodiments, the data reconstruction method further includes:

[0029] Determining a first stripe width of the initial redundant array of independent disks and a second stripe width of the target redundant array of independent disks;

[0030] Total storage pools corresponding to each stripe in the initial redundant array of independent disks are constructed according to the first stripe width, and sub-storage pools corresponding to each stripe in the target redundant array of independent disks are constructed in each total storage pool according to the second stripe width.

[0031] In some embodiments, the storing the mapping relationship based on metadata to obtain corresponding target metadata includes:

[0032] Corresponding metadata is generated according to the mapping relationship to obtain corresponding target metadata, and the target metadata is stored in a preset power-saving memory.

[0033] In some embodiments, the establishing of the mapping relationship between the initial redundant array of independent disks and the target redundant array of independent disks, and saving the mapping relationship based on metadata, after obtaining the corresponding target metadata, further includes:

[0034] If the failed hard disk recovers to normal, the data in the initial data block is restored to the failed data block corresponding to the failed hard disk according to the target metadata, so as to restore the target redundant array of independent disks to the initial redundant array of independent disks.

[0035] In some embodiments, after restoring the data in the initial data block to the failed data block corresponding to the failed hard disk according to the target metadata, the method further includes:

[0036] Verifying the data restored to the faulty data block based on the data in the normal data block;

[0037] The data restored to the faulty data block is adjusted according to the obtained verification result.

[0038] In a second aspect, the present invention discloses an electronic device, comprising:

[0039] Memory for storing computer programs;

[0040] A processor is used to execute the computer program to implement the steps of the aforementioned data reconstruction method.

[0041] In a third aspect, the present invention discloses a computer-readable storage medium having a computer program stored thereon, and the computer program implements the steps of the aforementioned data reconstruction method when executed by a processor.

[0042] In a fourth aspect, the present invention discloses a computer program product, comprising a computer program / instruction, which implements the steps of the aforementioned data reconstruction method when executed by a processor.

[0043] It can be seen from the above technical scheme that the present invention can reconstruct the initial independent redundant disk array according to the hard disk state of the initial independent redundant disk array to obtain the target independent redundant disk array; after the reconstruction of the initial independent redundant disk array is completed, a mapping relationship between the initial independent redundant disk array and the target independent redundant disk array is established, and the mapping relationship is saved based on metadata to obtain corresponding target metadata, so as to restore the target independent redundant disk array to the initial independent redundant disk array according to the target metadata.

[0044] The beneficial effects of the present invention are as follows: a mapping relationship between a block after shrinking and reconstruction and an original block can be established, so that the original stripe can maintain the original stripe width, and there is no need to change the stripe width and recalculate the check block, and when a new hard disk is inserted for data recovery, since metadata is used to store and maintain these mapping relationships, the recovery can be completed by directly writing back the corresponding data according to the mapping situation between the blocks, without the need for additional check block calculation, which simplifies the RAID data reconstruction process, improves the data recovery speed, and can realize a shrinking and reconstruction method with a faster fault recovery rate, a small reconstruction calculation amount, and high stability. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] In order to more clearly illustrate the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only 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.

[0046] Figure 1 A flow chart of a data reconstruction method provided by an embodiment of the present invention;

[0047] Figure 2 A schematic diagram of a distributed RAID5 with a stripe width of 4 provided in an embodiment of the present invention;

[0048] Figure 3 A schematic diagram of RAID5 data changes after row shrinking and reconstruction provided by an embodiment of the present invention;

[0049] Figure 4 A schematic diagram of RAID5 data changes after existing shrinking and reconstruction;

[0050] Figure 5 A specific data reconstruction method flow chart provided by an embodiment of the present invention;

[0051] Figure 6 A schematic diagram of RAID5 data recovery after column shrinking and reconstruction provided by an embodiment of the present invention;

[0052] Figure 7 A structural diagram of an electronic device provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0053] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only 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 ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0054] The terms "including" and "having" in the specification of the present invention and the above-mentioned drawings, as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device including a series of steps or units is not limited to the listed steps or units, but may include steps or units that are not listed.

[0055] In order to enable those skilled in the art to better understand the solution of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0056] At present, in order to solve the problem of hard disk failure in the scenario where there is no hot spare space, the lost data can be reconstructed into unused blocks, that is, column-shrinking reconstruction. However, after the column-shrinking reconstruction is completed, the entire RAID needs to undergo a process of recalculating the check block, and the check block also needs to be recalculated during recovery, resulting in the need to recalculate the complete check area multiple times during the column-shrinking reconstruction and recovery process, causing the task to be time-consuming. The present invention can establish a mapping relationship between the block after column-shrinking reconstruction and the original block, so that the original stripe can maintain the original stripe width, without changing the stripe width and recalculating the check block, and when a new hard disk is inserted for data recovery, the corresponding data can be directly written back according to the mapping between the blocks to complete the recovery, which can effectively improve the speed of data recovery.

[0057] Next, the data reconstruction method provided by the embodiment of the present invention is described in detail. Figure 1 A data reconstruction method provided by an embodiment of the present invention includes:

[0058] Step S11, reconstructing the initial redundant array of independent disks according to the hard disk status of the initial redundant array of independent disks to obtain a target redundant array of independent disks.

[0059] In this embodiment, the faulty hard disk and the normal hard disk in the initial independent redundant array of disks can be determined according to the hard disk status of each hard disk in the current initial independent redundant array of disks, and the data stored in the faulty hard disk is written into the normal hard disk to reconstruct the initial independent redundant array of disks. It should be noted that the technical solution in this embodiment mainly takes RAID5 as an example. Figure 2 In a specific distributed RAID5 shown in FIG. 1 , the working status of the four hard disks can be determined first to determine whether each hard disk can work normally, so as to reconstruct the data distribution in the hard disk according to the working status of the hard disk. Specifically, each failed data block in the failed hard disk can be determined first, and a new initial data block can be constructed in the normal hard disk, and the data in the failed data block can be stored in the initial data block to reconstruct the initial independent disk redundant array. In a specific embodiment, as Figure 2 In the RAID5 shown, the data stored in hard disk 1 are data blocks A1, B2, and C3; the data stored in hard disk 2 are data blocks B1, C2, and check block P3; the data stored in hard disk 3 are data blocks C1, A3, and check block P2; the data stored in hard disk 4 are data blocks A2, B3, and check block P1, and Figure 2 In the RAID5 shown in FIG. 1 , each hard disk may have storage space without storing data, so a blank initial data block for storing data in a failed data block in a failed hard disk during data reconstruction may be constructed based on the above space. In a specific embodiment, as shown in FIG. Figure 3As shown, the storage space corresponding to the data blocks C1 and A3 in hard disk 1, the check block P2 in hard disk 2, and the check blocks P1'' and P2'' in hard disk 3 is the initial data block constructed in the normal disk, and the data blocks C1, A3 and the check block P2 stored in the failed hard disk 3 can be stored in hard disk 1, hard disk 2 and hard disk 4 respectively. It can be understood that the storage method of the data in the above-mentioned failed data blocks in other hard disks is not limited to Figure 3 As shown, that is, when the data in the faulty data block is stored in a normal hard disk, there is no strict one-to-one correspondence with the initial data block in the normal hard disk, and the data can be stored accordingly.

[0060] It should be noted that after constructing a new initial data block in the normal hard disk, the normal data block that has stored data in the normal hard disk can be determined, and in the process of storing the data in the faulty data block into the initial data block, the data in the normal data block remains unchanged. Figure 4 The existing shrinking and reconstruction scheme shown, in this embodiment, when the data in the faulty hard disk is stored in the normal hard disk, the data stored in the original hard disk 1 are data blocks A1, B2, C3; the data stored in the hard disk 2 are data blocks B1, C2, and the check block P3; the data stored in the hard disk 4 are data blocks A2, B3, and the check block P1 does not change. And when the data in the faulty data block is stored in the initial data block, the specific storage process is: first determine the stripe width of the stripe corresponding to the current normal hard disk, then build a data storage rule based on the stripe width, and store the data in the faulty data block in the initial data block based on the data storage rule; the above data storage rule stores that the number of initial data blocks used to store data in the faulty data block in each stripe is equal to the stripe width minus one. And in the process of storing the data in the faulty data block in the initial data block, if the number of initial data blocks used to store data in the faulty data block is greater than the number of faulty data blocks, then after completing the operation of storing the data in the faulty data block in the initial data block, determine the corresponding remaining initial data blocks, and set the data in the remaining initial data blocks to zero. In a specific embodiment, Figure 2 In the RAID5 shown in the figure, the stripe width is 4. After the shrinking column reconstruction, the following is generated: Figure 3 The five stripes with a strip width of 3 are shown in the figure. In this process, since only one column shrinking reconstruction is performed, the strip width is changed from 4 to 3. Therefore, when the data in the failed hard disk is stored in the normal hard disk, each stripe can store the data in two normal data blocks, that is, Figure 3In the fourth stripe from top to bottom shown in FIG. 1 , only the initial data blocks of two hard disks among hard disk 1, hard disk 2 and hard disk 4 can be used to store the data in the failed data block. If there are still blank initial data blocks without data stored in them, such as Figure 3 As shown in the figure, for the last data block in the hard disk 2, the data in the data block is set to 0, and then the extra data block in each stripe is used to store the generated verification data.

[0061] In a specific embodiment, when new check data is generated according to the data stored in the initial data block in each stripe, it can be understood that in common RAID implementation schemes, the calculation method of the check block is diverse, such as XOR algorithm or erasure code algorithm, and other algorithms evolved on this basis; the data reconstruction method introduced in this embodiment is applicable to most check algorithms, and this embodiment takes RAID5 as an example, using the most basic XOR algorithm, that is, by XORing data blocks with each other, the check block is calculated. The specific process is:

[0062] D1 xor D2 xor … xor Dn = P;

[0063] Correspondingly, it is easy to obtain the calculation method of reconstructing data blocks by checking blocks:

[0064] P xor D2 xor … xor Dn = D1;

[0065] That is to say, in this embodiment, an XOR operation is performed on the data stored in the initial data block in each stripe, and the new verification data can be generated according to the obtained operation result. Correspondingly, based on the above technical solution, after the data in the faulty data block is stored in the initial data block, the initial data block that does not store data in each stripe can be used as the initial verification block, and new verification data can be generated according to the data stored in the initial data block in each stripe, and the verification data is stored in the initial verification block. Figure 3 As shown, in a specific embodiment, a new check block P1'' is generated in hard disk 4 by using data block C1 in hard disk 1 and check block P2 in hard disk 2, and a new check block P2'' is generated in hard disk 4 by using data block A3 in hard disk 1 and data block 0 in hard disk 2.

[0066] Based on the above technical solution, in this embodiment Figure 2 , 3For example, before the disk goes offline, the attached figure shows a RAID5 with 3 data blocks and 1 check block; after the disk failure, the three blocks C1, P2, and A3 need to be restored through reconstruction; for RAID without the shrinking reconstruction function, since the RAID has no hot spare space or hot spare disk for reconstruction, reconstruction cannot be performed and redundancy cannot be restored; based on the technical solution in this embodiment, two RAID5 stripes with 2 data blocks and 1 check block can be generated in the remaining disks 1, 2, and 4, and the reconstructed three blocks C1, P2, and A3 are filled into the data blocks of the newly generated stripe, and the redundant blocks are filled with 0, and the check blocks P1'' and P2'' of the new stripe are calculated. In this way, compared with the existing scheme, since the original stripe is changed into a new stripe with a stripe width minus 1 after each shrinking and reconstruction, the data block corresponding to the check block is changed, so it needs to be regenerated, and therefore the check block recalculation of the entire RAID needs to be performed multiple times. In this embodiment, considering that the reduced blocks of the original stripe have not disappeared but have been reconstructed into the new stripe, a mapping relationship between the target blocks of the shrinking and reconstruction and the original blocks can be established, so that the original stripe can maintain the original stripe width, and there is no need to change the stripe width and recalculate the check blocks. The reconstructed blocks can form some stripes with a stripe width minus 1, and the amount of calculation is greatly reduced.

[0067] Step S12: after the reconstruction of the initial redundant array of independent disks is completed, a mapping relationship between the initial redundant array of independent disks and the target redundant array of independent disks is established, and the mapping relationship is saved based on metadata to obtain corresponding target metadata, so as to restore the target redundant array of independent disks to the initial redundant array of independent disks according to the target metadata.

[0068] In this embodiment, after the reconstruction of the initial redundant array of independent disks is completed, a mapping relationship between the initial redundant array of independent disks and the target redundant array of independent disks can be established, and the mapping relationship can be saved based on metadata to obtain corresponding target metadata, so as to restore the target redundant array of independent disks to the initial redundant array of independent disks according to the target metadata. That is, in this embodiment, since the mapping relationship of the upper module RAID will not change, after the shrinking reconstruction occurs, the newly generated stripes need to be arranged according to the shrinking reconstruction rules, that is, a block in the stripe cannot be saved in the original stripe, and a mapping relationship needs to be created to write the block into a target block. Figure 3 As shown, the specific mapping situation is that the upper layer converts the read IO of the original data block C1 into the read IO of C1 in the new stripe; the write IO of C1 is converted into the write IO of the block where C1 is located in the new stripe, that is, the two blocks of new C1 and P1'' need to be modified at the same time.

[0069] That is to say, when RAID5 is reconstructed by shrinking columns based on this embodiment, its impact is limited to the inside of the RAID module, and has no impact on other modules that interact with the RAID module, because RAID does not change the original stripe structure, but only adds a layer of mapping relationship inside the RAID module on this basis, reducing the possibility of data problems caused by cross-module interaction. And by creating a mapping relationship from the original block of the stripe to the new block in the shrinking column reconstruction scenario, and using metadata to store and maintain these mapping relationships, this mapping relationship can be used to achieve shrinking column reconstruction with small reconstruction calculation amount and high stability.

[0070] It can be seen from the above technical solution that the present embodiment can reconstruct the initial independent disk redundant array according to the hard disk state of the initial independent disk redundant array to obtain the target independent disk redundant array, and after the reconstruction of the initial independent disk redundant array is completed, a mapping relationship between the initial independent disk redundant array and the target independent disk redundant array is established, and then the mapping relationship is saved based on metadata to obtain the corresponding target metadata, so as to restore the target independent disk redundant array to the initial independent disk redundant array according to the target metadata. In this way, a mapping relationship between the blocks after the column shrinkage reconstruction and the original blocks can be established, so that the original stripe can maintain the original stripe width, and there is no need to change the stripe width and recalculate the check block, and when a new hard disk is inserted for data recovery, since the metadata is used to store and maintain these mapping relationships, the corresponding data can be directly written back according to the mapping between the blocks to complete the recovery, and no additional check block calculation is required, which simplifies the RAID data reconstruction process, improves the data recovery speed, provides a data reconstruction that can achieve no reduction in the RAID redundancy level, and improves the data redundancy capability of RAID in extreme fault scenarios, and compared with the current column shrinkage reconstruction scheme, it improves the fault recovery speed and data risk protection capability, simplifies the process, and reduces the difficulty of code implementation.

[0071] Based on the previous embodiment, the present invention can establish a mapping relationship between the blocks after shrinking and reconstruction and the original blocks, so as to directly write back the data to complete the recovery according to the mapping between the blocks. Next, the data recovery process will be described in detail in this embodiment. Figure 5 A specific data reconstruction method provided by an embodiment of the present invention includes:

[0072] Step S21, reconstructing the initial redundant array of independent disks according to the hard disk status of the initial redundant array of independent disks to obtain a target redundant array of independent disks.

[0073] In this embodiment, based on the technical solution of the previous embodiment, Figure 3In the data reconstruction process shown, the first stripe width of the initial redundant array of independent disks and the second stripe width of the target redundant array of independent disks can be determined, and the total storage pools corresponding to each stripe in the initial redundant array of independent disks are constructed according to the first stripe width, and the sub-storage pools corresponding to each stripe in the target redundant array of independent disks are constructed in each total storage pool according to the second stripe width. It can be understood that in this embodiment, for a RAID that only undergoes one shrinking column reconstruction, there are stripes with the original stripe width and sub-stripes with a stripe width reduced by 1 in the RAID, and this embodiment can manage these stripes separately through a storage pool mechanism; each time a shrinking column reconstruction occurs, each pool in the current system will generate a sub-pool with a stripe width reduced by 1. That is to say, in the shrinking column reconstruction scenario, since the original stripe width is different from the generated stripe width, this embodiment introduces a storage pool to manage the original stripe and the stripe generated by the shrinking column reconstruction through the pool separately, and each time a shrinking column reconstruction occurs, all storage pools in the current environment will generate a sub-pool with a stripe width reduced by 1. Based on the above technical solution, in this embodiment, when managing RAID data reconstruction through a storage pool, a corresponding sub-pool can be established in each storage pool at each data reconstruction. If multiple data reconstructions are performed, stripes of different stripe widths generated at each RAID shrink reconstruction are established in the initial storage pool. For example, Figure 2 The RAID shown first establishes a storage pool with a stripe width of 4. After a shrinking reconstruction, a corresponding sub-pool is generated in the original storage pool to manage the newly generated stripes with a stripe width of 3. If a failed hard disk appears again, a newly generated stripe with a stripe width of 2 is constructed again in the corresponding storage pool. In this way, the accuracy and efficiency in handling multiple shrinking reconstruction and recovery scenarios can be significantly improved. In this process, the user can more conveniently and quickly determine the detailed process of RAID shrinking reconstruction through the relevant information of the storage stripes in the storage pool, which is more convenient for manual management.

[0074] Step S22: after the reconstruction of the initial redundant array of independent disks is completed, a mapping relationship between the initial redundant array of independent disks and the target redundant array of independent disks is established, and corresponding metadata is generated according to the mapping relationship to obtain corresponding target metadata, and the target metadata is stored in a preset power-saving memory to restore the target redundant array of independent disks to the initial redundant array of independent disks according to the target metadata.

[0075] In this embodiment, after the reconstruction of the initial independent disk redundant array is completed, a mapping relationship between the initial independent disk redundant array and the target independent disk redundant array can be established, and corresponding metadata is generated according to the mapping relationship to obtain corresponding target metadata, and the target metadata is stored in the preset power-saving memory, so that the target independent disk redundant array can be restored to the initial independent disk redundant array according to the target metadata. If the faulty hard disk is restored to normal afterwards, the data in the initial data block is restored to the corresponding faulty data block of the faulty hard disk according to the target metadata, so as to restore the target independent disk redundant array to the initial independent disk redundant array. In this way, the mapping relationship between the blocks in this embodiment is maintained by the RAID metadata, and the metadata can record the original stripe block and the new stripe block and their corresponding relationship, and keep it in the power-saving memory. Even if a controller failure occurs, the content will not be lost, which can effectively improve the security of data reconstruction. And when a new hard disk is inserted for data recovery, according to the mapping between the blocks, the data in the block can be directly written back to the inserted hard disk to complete the recovery, without the need for additional check block calculation, which can reduce the amount of calculation during data reconstruction, and solve the problem of complex changes in the mapping relationship between each data block and the upper layer during column shrinking reconstruction.

[0076] It can also be understood that after the data in the initial data block is restored to the corresponding faulty data block of the faulty hard disk according to the target metadata, the data restored to the faulty data block can also be verified based on the data in the normal data block, and the data restored to the faulty data block can be adjusted according to the obtained verification result. In other words, after the data is recovered, corresponding operations can be performed based on the unchanged data in the normal hard disk to verify the recovered data, thereby further ensuring the security of the data. It can also be understood that the embodiment of the present invention takes distributed RAID5 as an example. In fact, the technical solution in the embodiment of the present invention can also be applied to other verification RAIDs, such as distributed RAID6; and for traditional verification RAIDs, such as traditional RAID5 and RAID6, the technical solution in this embodiment can also be applied to the corresponding RAID type after corresponding adjustments.

[0077] Based on the above technical solution, in this embodiment, the original stripes and new stripes of the shrinking and reconstruction can be managed by dividing the blocks into storage pools. Each time the shrinking and reconstruction occurs, all storage pools in the current environment will generate a sub-pool with a stripe width minus 1, which can improve accuracy and efficiency when processing multiple shrinking and reconstruction and recovery scenarios. In addition, in this embodiment, the RAID IO processing capacity after the shrinking and reconstruction occurs is greatly improved compared to the basic method of shrinking and reconstruction. It does not need to change the external data block mapping relationship of the RAID module, reducing the possibility of data errors.

[0078] Furthermore, an embodiment of the present invention also discloses an electronic device, Figure 7 : This is a structural diagram of an electronic device according to an exemplary embodiment, and the content in the figure cannot be regarded as any limitation on the scope of use of the present invention. The electronic device may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the data reconstruction method disclosed in any of the above embodiments. In addition, the electronic device in this embodiment may specifically be an electronic computer.

[0079] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device; the communication interface 24 can create a data transmission channel between the electronic device and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present invention, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.

[0080] In addition, the memory 22, as a carrier for storing resources, can be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon can include an operating system 221, a computer program 222, etc., and the storage method can be temporary storage or permanent storage.

[0081] The operating system 221 is used to manage and control various hardware devices on the electronic device and the computer program 222, which can be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program that can be used to complete the data reconstruction method performed by the electronic device disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program that can be used to complete other specific tasks.

[0082] Furthermore, the present invention also discloses a computer-readable storage medium for storing a computer program; wherein the computer program, when executed by a processor, implements the aforementioned disclosed data reconstruction method. For the specific steps of the method, reference may be made to the corresponding contents disclosed in the aforementioned embodiments, and no further description will be given here.

[0083] Furthermore, the present invention also discloses a computer program product, including a computer program / instruction, wherein the computer program / instruction implements the aforementioned disclosed method when executed by a processor. The specific steps of the method can refer to the corresponding contents disclosed in the aforementioned embodiment, and will not be repeated here.

[0084] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0085] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0086] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0087] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0088] The technical solution provided by the present invention is introduced in detail above. Specific examples are used in this article to illustrate the principle and implementation mode of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation mode and application scope. In summary, the content of this specification should not be understood as limiting the present invention.

Claims

1. A data reconstruction method, characterized in that: include: Reconstruct the initial redundant array of independent disks according to the hard disk state of the initial redundant array of independent disks to obtain a target redundant array of independent disks; After the reconstruction of the initial redundant array of independent disks is completed, a mapping relationship between the initial redundant array of independent disks and the target redundant array of independent disks is established, and the mapping relationship is saved based on metadata to obtain corresponding target metadata, so as to restore the target redundant array of independent disks to the initial redundant array of independent disks according to the target metadata.

2. The data reconstruction method according to claim 1, characterized in that: The step of reconstructing the initial redundant array of independent disks according to the hard disk status of the initial redundant array of independent disks comprises: Determine the faulty hard disk and normal hard disk in the current initial independent redundant array of disks according to the hard disk status; The data stored in the failed hard disk is written into the normal hard disk to reconstruct the initial redundant array of independent disks.

3. The data reconstruction method according to claim 2, characterized in that: The step of writing the data stored in the failed hard disk into the normal hard disk to reconstruct the initial redundant array of independent disks includes: Determine each faulty data block in the faulty hard disk; A new initial data block is constructed in the normal hard disk, and the data in the faulty data block is stored in the initial data block to reconstruct the initial redundant array of independent disks.

4. The data reconstruction method according to claim 3, characterized in that: After constructing a new initial data block in the normal hard disk, the method further includes: A normal data block having stored data in the normal hard disk is determined, and during the process of storing the data in the faulty data block into the initial data block, the data in the normal data block is kept unchanged.

5. The data reconstruction method according to claim 4, characterized in that: The storing the data in the fault data block to the initial data block comprises: Determine the stripe width of the stripe corresponding to the current normal hard disk; A data storage rule is constructed according to the stripe width, and the data in the faulty data block is stored in the initial data block based on the data storage rule; the data storage rule states that the number of initial data blocks in each stripe for storing the data in the faulty data block is equal to the stripe width minus one.

6. The data reconstruction method according to claim 5, characterized in that: After storing the data in the fault data block into the initial data block, the method further includes: Using the initial data blocks that do not store data in each stripe as initial check blocks; New check data is generated according to the data stored in the initial data block in each stripe, and the check data is stored in the initial check block.

7. The data reconstruction method according to claim 6, characterized in that: The process of storing the data in the fault data block into the initial data block includes: If the number of the initial data blocks used to store the data in the faulty data blocks is greater than the number of the faulty data blocks, after completing the operation of storing the data in the faulty data blocks into the initial data blocks, determining the corresponding remaining initial data blocks; The data in the remaining initial data blocks are set to zero.

8. The data reconstruction method according to claim 7, characterized in that: The generating new check data according to the data stored in the initial data block in each stripe includes: An XOR operation is performed on the data stored in the initial data block in each stripe to generate new verification data according to the obtained operation result.

9. The data reconstruction method according to claim 6, characterized in that: Also includes: Determining a first stripe width of the initial redundant array of independent disks and a second stripe width of the target redundant array of independent disks; Total storage pools corresponding to each stripe in the initial redundant array of independent disks are constructed according to the first stripe width, and sub-storage pools corresponding to each stripe in the target redundant array of independent disks are constructed in each total storage pool according to the second stripe width.

10. The data reconstruction method according to claim 1, characterized in that: The step of saving the mapping relationship based on metadata to obtain corresponding target metadata includes: Corresponding metadata is generated according to the mapping relationship to obtain corresponding target metadata, and the target metadata is stored in a preset power-saving memory.

11. The data reconstruction method according to any one of claims 4 to 9, characterized in that: The step of establishing a mapping relationship between the initial redundant array of independent disks and the target redundant array of independent disks, and storing the mapping relationship based on metadata to obtain corresponding target metadata further includes: If the failed hard disk recovers to normal, the data in the initial data block is restored to the failed data block corresponding to the failed hard disk according to the target metadata, so as to restore the target redundant array of independent disks to the initial redundant array of independent disks.

12. The data reconstruction method according to claim 11, characterized in that: After the data in the initial data block is restored to the failed data block corresponding to the failed hard disk according to the target metadata, the method further includes: Verifying the data restored to the faulty data block based on the data in the normal data block; The data restored to the faulty data block is adjusted according to the obtained verification result.

13. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to execute the computer program to implement the steps of the data reconstruction method according to any one of claims 1 to 12.

14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the data reconstruction method according to any one of claims 1 to 12 are implemented.

15. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instruction is executed by a processor, the steps of the data reconstruction method according to any one of claims 1 to 12 are implemented.

Citation Information

Patent Citations

  • Magnetic disc fault processing and data restructuring method in magnetic disc array system

    CN101276302A

  • Method and device for processing bad blocks of redundant array of independent disk (RAID)

    CN105468479A

  • Reconstruction method and device of redundant arrays of independent disks (RAID)

    CN108874314A

  • Data recovery method and device, equipment and storage medium

    CN113918388A

  • Method and apparatus for accelerating data reconstruction for a disk array

    US20160092326A1

Cited By

  • Data reconstruction method, device, equipment, medium and product

    CN119883713A

  • A data reconstruction method, apparatus, device, medium, and product

    CN119883713B

  • Data encoding and decoding method, circuit, equipment, program product and storage medium

    CN120216255A

  • Abnormal data positioning method and device, equipment, program product and storage medium

    CN120469849A

  • Server and hard disk medium error processing method

    CN120560591A