A method, system, device and medium for RAID foreground IO and copyback parallel data protection

By identifying RAID stripe status and fault recovery mechanisms, the problem of data loss caused by foreground IO data writing and new disk failure during RAID copying is solved, achieving a balance between data security and performance.

CN119292837BActive Publication Date: 2025-11-21SHANDONG YUNHAI GUOCHUANG CLOUD COMPUTING EQUIP IND INNOVATION CENT CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411286232.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-13
Publication Date
2025-11-21
Estimated Expiration
2044-09-13

AI Technical Summary

Technical Problem

During RAID copying, data loss can occur if there is a failure in the foreground I/O data writing or the copying of the new disk, thus compromising data security.

Method used

By identifying the RAID stripe status and taking corresponding processing strategies in different states, including writing additional data to the copy disk and the disk to be copied back, and combining the RAID type and the number of failed disks for fault recovery, we ensure that the data is backed up on the copy disk.

Benefits of technology

In scenarios where foreground I/O and copy-back are performed in parallel, even if the copy-back disk fails, the data is still backed up, ensuring data security and reducing additional performance overhead.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119292837B_ABST
    Figure CN119292837B_ABST
Patent Text Reader

Abstract

The application provides a RAID foreground IO and copyback parallel data protection method, system, device and medium, and belongs to the technical field of storage data security. The method comprises the following steps: when the current foreground IO and RAID copyback are parallel, identifying the RAID stripe to which the foreground IO belongs; when it is a copied area, determining the additional writing disk and the position and size of the writing data according to the starting position and size of the writing data, the number of disks during copyback and the position in the RAID, and executing copyback parallel data writing; when it is a copyback area, suspending the foreground IO until the RAID stripe enters the copied area; when it is a to-be-copied area, using the original foreground IO disk-falling process; when a fault disk appears in the RAID, starting fault recovery according to the RAID type, the number of fault disks and whether the fault disk is a copied disk. The application guarantees the safety of data through additional writing of the data of the copied disk.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the technical field of storage data security, and particularly relates to a RAID foreground IO and copyback parallel data protection method, system, device and medium. BACKGROUND

[0002] RAID is the abbreviation of Redundant Array of Independent Disks, which is an array composed of independent disks with redundancy. RAID is a large-capacity disk group composed of many fast independent disks, and the storage performance and reliability of the entire disk system are improved by using the check redundancy capability provided by individual disks.

[0003] RAID array uses striping, mirroring and checking to ensure data security, wherein RAID5 can recover one block of failed data through P check blocks in the disk array, and RAID6 can recover two failed disk data through P check blocks and Q check blocks in the disk array. When a block of member disk in the RAID group fails, if the system is configured with a hot spare disk, the hot spare disk will automatically replace the failed data disk and start synchronizing data. When the failed data disk is replaced by a new data disk, the data in the hot spare disk will be copied back to the newly added data disk, and this process is called RAID copyback. When the RAID copyback process needs to write foreground IO data, it needs to be performed through the new disk for copyback in the RAID, but if the new disk for copyback suddenly fails, data loss will occur, and the safety of data cannot be guaranteed.

[0004] Therefore, it is necessary to provide a RAID foreground IO and copyback parallel data protection method, system, device and medium to solve the above-mentioned defects. SUMMARY

[0005] In view of the defect that when the foreground IO data writing and the failure of the new disk for copyback occur simultaneously during the RAID copyback process, data loss occurs and the safety of data cannot be guaranteed, the application provides a RAID foreground IO and copyback parallel data protection method, system, device and medium to solve the above-mentioned technical problems.

[0006] In a first aspect, the application provides a RAID foreground IO and copyback parallel data protection method, comprising the following steps:

[0007] S1. When the foreground IO and the RAID copyback are parallel, the RAID stripe to which the foreground IO belongs is identified;

[0008] When the RAID stripe belongs to the copied area, step S2 is entered;

[0009] When the RAID stripe to which it belongs is a copy-back area, proceed to step S3;

[0010] When the RAID stripe to which it belongs is a copy-back area, proceed to step S4;

[0011] S2. Determine the additional write disk and the location and size of the write data based on the starting position and size of the write data, the number of disks during copying, and their positions in the RAID. Perform copying parallel data writing and proceed to step S5.

[0012] S3. Suspend the foreground I / O until the RAID stripe enters the copied area, then return to step S2;

[0013] S4. Use the existing front-end IO disk write process;

[0014] S5. When a faulty disk occurs in the RAID, fault recovery is initiated based on the RAID type, the number of faulty disks, and whether the faulty disk was a copy disk.

[0015] Furthermore, the specific steps of step S1 are as follows:

[0016] S11. Obtain the RAID status of the RAID stripe to which the foreground IO belongs;

[0017] When the RAID status is copy-back status, proceed to step S12;

[0018] When the RAID status is non-copyback status, proceed to step S4;

[0019] S12. Identify the RAID stripe to which the foreground I / O belongs;

[0020] When the RAID stripe to which it belongs is a copied area, proceed to step S2;

[0021] If the RAID stripe to which the data belongs is a copy-back area, proceed to step S3;

[0022] If the RAID stripe to which it belongs is a copy-back area, proceed to step S4.

[0023] Furthermore, the specific steps of step S2 are as follows:

[0024] S21. Calculate the number of disk writes n required based on the data that needs to be written by the front-end I / O;

[0025] S22. Locate the i-th disk that needs to be written data, calculate the write parameters of the i-th disk, and initialize the i-th disk to 0;

[0026] S23. Write data to the corresponding position of the copied area of ​​the i-th disk according to the calculated disk writing parameters;

[0027] S24. Identify whether the i-th disk is a copy disk;

[0028] If so, proceed to step S25;

[0029] If not, proceed to step S26;

[0030] S25. Point the stripe of the i-th disk to the area to be copied back, and use the calculated write parameters to write the same data to the corresponding position in the area to be copied back;

[0031] S26. Determine if i is less than the number of disk writes n;

[0032] If so, let i = i + 1 and return to step S22;

[0033] If not, complete the parallel writing of foreground IO data to the copy disk and the data to be copied disk, and then end.

[0034] Furthermore, the disk writing parameters in step S22 include the location of the data to be written in memory, the starting position of the i-th disk to which the data needs to be written, and the length.

[0035] Furthermore, the specific steps of step S3 are as follows:

[0036] S31. Suspend the foreground I / O that needs to write data;

[0037] S32. Determine whether the RAID stripe to which the foreground I / O belongs has entered the copied area;

[0038] If so, return to step S2;

[0039] If not, return to step S31.

[0040] Furthermore, the specific steps of step S4 are as follows:

[0041] S41. Calculate the number of disk writes n required based on the data that needs to be written by the front-end I / O;

[0042] S42. Locate the i-th disk that needs to be written data, calculate the write parameters of the i-th disk, and initialize the i-th disk to 0;

[0043] S43. Write data to the corresponding position of the copy-back area of ​​the RAID stripe of the i-th disk according to the calculated write parameters;

[0044] S44. Determine if i is less than the number of disk writes n;

[0045] If so, let i = i + 1 and return to step S42;

[0046] If not, complete the foreground IO data writing.

[0047] Furthermore, the specific steps of step S5 are as follows:

[0048] S51. When a failed disk occurs in a RAID, identify the RAID type and the number of failed disks;

[0049] If the RAID type is RAID5, proceed to step S52;

[0050] When the RAID type is RAID6, proceed to step S54;

[0051] If the RAID type is RAID TP, proceed to step S56;

[0052] S52. Determine if the number of faulty disks is greater than or equal to 2;

[0053] If so, proceed to step S58;

[0054] If not, proceed to step S53;

[0055] S53. Determine if a copy disk is faulty;

[0056] If so, use the data in the area to be copied back to restore the copy back disk, and then use the restored copy back disk, the normal disk, and the P checksum data block to restore the remaining faulty disk, and then the process ends;

[0057] If not, proceed to step S58;

[0058] S54. Determine if the number of faulty disks is greater than 4;

[0059] If so, proceed to step S58;

[0060] If not, proceed to step S55;

[0061] S55. Determine if there is a fault involving two or fewer copy disks;

[0062] If yes, use the data in the area to be copied back to restore the copy back disk, and then use the restored copy back disk, the normal disk, and the P check data block and Q check data block to restore the remaining faulty disks, and end; if no, proceed to step S58.

[0063] S56. Determine if the number of faulty disks is greater than 6;

[0064] If so, proceed to step S58;

[0065] If not, proceed to step S57;

[0066] S57. Determine if there is a fault involving three or fewer copy disks;

[0067] If so, use the data in the copy area of ​​the copied disk to restore the copy disk, and then use the restored copy disk, the normal disk, and the P check data block, Q check data block and R check data block to restore the remaining faulty disk, and then the process ends;

[0068] If not, proceed to step S58;

[0069] S58. The number of faults has exceeded the limit, and the faulty disk cannot be recovered via RAID.

[0070] Secondly, the present invention provides a data protection system for parallel RAID front-end I / O and copy-back, comprising: a RAID stripe identification module, used to identify the RAID stripe to which the front-end I / O belongs when the front-end I / O and RAID copy-back are performed in parallel;

[0071] The parallel IO data writing module is used when the RAID stripe is a copied area. It determines the additional write disk and the location and size of the write data based on the starting position and size of the write data, the number of disks during copying, and their positions in the RAID, and performs parallel data writing for copying.

[0072] The copy-back waiting module is used to suspend the foreground I / O when the RAID stripe is in the copy-back area, until the RAID stripe enters the copy-back area;

[0073] The IO data normal write module is used when the RAID stripe is a copy-back area, and the original front-end IO disk write process is used.

[0074] The fault data recovery module initiates fault recovery based on the RAID type, the number of faulty disks, and whether the faulty disk was the one being copied back when a faulty disk appears in the RAID.

[0075] Furthermore, the RAID stripe identification module includes:

[0076] The RAID status identification unit of the IO is used to obtain the RAID status of the RAID stripe to which the foreground IO belongs; the RAID stripe area identification unit is used to identify the RAID stripe to which the foreground IO belongs when the RAID status is copy back.

[0077] Furthermore, the parallel IO data writing module includes:

[0078] The first disk write quantity calculation unit is used to calculate the number of disks n to be written based on the data to be written by the foreground IO; the disk write parameter calculation unit is used to locate the i-th disk that needs to be written data, calculate the disk write parameters of the i-th disk, and initialize the i-th disk to 0.

[0079] The data writing unit for the copied area is used to write data to the corresponding position of the copied area of ​​the i-th disk according to the calculated disk writing parameters;

[0080] The copy disk identification unit is used to identify whether the i-th disk is a copy disk;

[0081] The parallel data writing unit is used when the i-th disk is a copy-back disk. It points the stripe of the i-th disk to the copy-back area and uses the calculated write parameters to write the same data to the corresponding position in the copy-back area.

[0082] The first judgment unit for locating the disk is used to determine whether i is less than the number of disk writes n;

[0083] The next disk positioning unit is used when i is less than the number of disks to write to n, and i = i + 1 is set.

[0084] The data writing is completed in the first completion determination unit. When i equals the number of disks written to n, the parallel writing of foreground IO data to the back-copy disk and the data to be copied back to the disk is completed.

[0085] Furthermore, the copy-back waiting module includes:

[0086] The foreground I / O suspension unit is used to suspend foreground I / O that requires writing data;

[0087] The "Copyback Area Entry Judgment Unit" is used to determine whether the RAID stripe to which the foreground I / O belongs has entered the "Copyback Area". Further, the normal I / O data write module includes:

[0088] The second disk write quantity calculation unit is used to calculate the required disk write quantity n based on the data to be written by the foreground IO; the second disk write parameter calculation unit locates the i-th disk that needs to be written data, calculates the disk write parameters of the i-th disk, and initializes the i-th disk to 0;

[0089] The data writing unit for the copy-back area is used to write data to the corresponding position of the copy-back area of ​​the RAID stripe of the i-th disk according to the calculated disk writing parameters;

[0090] The second judgment unit for locating the disk is used to determine whether i is less than the number of disks to write to n;

[0091] The next disk second positioning unit is used when i is less than the number of disks to write to n, so that i = i + 1;

[0092] The data writing completion determination unit is used to complete the foreground IO data writing when i equals the number of disk writes n. Furthermore, the fault data recovery module includes:

[0093] The RAID type and number of failed disks identification unit is used to identify the RAID type and the number of failed disks when a failed disk occurs in the RAID.

[0094] The RAID5 fault disk number determination unit is used to determine whether the number of fault disks is greater than or equal to 2 when the RAID type is RAID5.

[0095] The RAID5 copy disk failure count determination unit is used to determine whether there is a copy disk failure when the number of failure disks is less than 2.

[0096] The RAID5 fault disk recovery unit uses data from the copied disk in the copy area to recover the copied disk when one copy disk fails. Then, it uses the recovered copied disk, the normal disk, and the P parity data block to recover the remaining faulty disk, and then the process ends.

[0097] The RAID6 fault disk number determination unit is used to determine whether the number of fault disks is greater than 4 when the RAID type is RAID5.

[0098] The RAID6 copy disk failure count determination unit is used to determine whether there are two or fewer copy disk failures when the failure count is less than or equal to 4.

[0099] The RAID6 fault disk recovery unit is used to recover the copy disks when there are two or fewer copy disks that have failed. It uses the data in the copy area of ​​the copy disk to recover the copy disks, and then uses the recovered copy disks, normal disks, and P and Q parity data blocks to recover the remaining fault disks.

[0100] The RAID TP fault disk number determination unit is used to determine whether the number of fault disks is greater than 6 when the RAID type is RAID TP.

[0101] The RAID TP copy disk failure number determination unit is used to determine whether there are three or fewer copy disk failures when the number of failure disks is less than or equal to 6.

[0102] The RAID TP fault disk recovery unit is used to recover the copy disks when there are three or more failures. It uses the data in the copy area of ​​the copy disk to recover the copy disks. Then, it uses the recovered copy disk, the normal disk, and the P parity data blocks, Q parity data blocks, and R parity data blocks to recover the remaining fault disks, and then ends. The fault disk exceeding the limit and cannot be recovered judgment unit is used to determine that the number of faults exceeds the limit and the fault disks cannot be recovered by RAID.

[0103] Thirdly, the present invention provides an electronic device, including a processor and a memory;

[0104] The memory is used to store a computer program, and the processor is used to retrieve and run the computer program from the memory, causing the electronic device to perform the method described in the first aspect above.

[0105] Fourthly, the present invention provides a storage medium,

[0106] The storage medium stores instructions that, when run on a computer, cause the computer to perform the method described in the first aspect above.

[0107] The beneficial effects of this invention are as follows:

[0108] The data protection method, system, device, and medium for parallel RAID front-end I / O and copy-back provided by this invention, in the scenario of parallel front-end I / O and copy-back, ensures data security by additionally writing data to the copy-back disk, so that even if the copy-back disk suddenly fails in this scenario, the data is still backed up on the copy-back disk. In this invention, when writing to the copy-back disk, the writing parameters of the normal writing process are reused, reducing the amount of calculation, and only the copy-back disk involved in the front-end I / O is written, which improves data security while minimizing the performance consumption of additional copy-back writing.

[0109] Furthermore, the design principle of this invention is reliable, the structure is simple, and it has a very wide range of application prospects.

[0110] Therefore, it is evident that the present invention has outstanding substantive features and significant progress compared with the prior art, and the beneficial effects of its implementation are also obvious. Attached Figure Description

[0111] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0112] Figure 1 This is a flowchart illustrating the data protection method of parallel RAID front-end I / O and copy-back in this invention.

[0113] Figure 2 This is a schematic diagram of the data protection system of the present invention, which combines RAID front-end I / O and copy-back in parallel.

[0114] Figure 3 This is a schematic diagram illustrating concurrent copy-back and foreground I / O in traditional RAID5.

[0115] Figure 4 This is a diagram illustrating a data loss scenario in traditional RAID5 methods.

[0116] Figure 5 This is a schematic diagram of the RAID5 structure in the done area.

[0117] Figure 6 This is a schematic diagram of the RAID5 structure in the pending area.

[0118] Figure 7This is a schematic diagram of the traditional RAID5 disk writing result.

[0119] Figure 8 This is a schematic diagram of the RAID5 disk writing structure of the present invention.

[0120] Figure 9 This is a schematic diagram of the RAID6 replication method of this invention, showing two failed disks and one failed disk in the other disks.

[0121] Figure 10 This is a schematic diagram of the RAID6 copy disk of the present invention, where one disk fails and two other disks fail.

[0122] Figure 11 This is a schematic diagram of the RAID6 replication disk of this invention failing 2 times, and the other disks failing 2 times. Detailed Implementation

[0123] The RAID front-end I / O and copy-back parallel data protection method can be applied to one or more devices. The device is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions. Its hardware includes, but is not limited to, microprocessors, application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.

[0124] Electronic devices can be any electronic product capable of human-computer interaction, such as personal computers, tablets, smartphones, personal digital assistants (PDAs), and interactive network television (IPTV). The networks on which electronic devices operate include, but are not limited to, the Internet, wide area networks (WANs), metropolitan area networks (MANs), local area networks (LANs), and virtual private networks (VPNs).

[0125] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention. Please refer to... Figure 1 The diagram illustrates a data protection method that combines RAID front-end I / O with copy-back in a specific implementation, including the following steps:

[0126] S1. When front-end I / O and RAID copy-back are performed in parallel, identify the RAID stripe to which the front-end I / O belongs;

[0127] When the RAID stripe to which it belongs is a copied area, proceed to step S2;

[0128] When the RAID stripe to which it belongs is a copy-back area, proceed to step S3;

[0129] When the RAID stripe to which it belongs is a copy-back area, proceed to step S4;

[0130] S2. Determine the additional write disk and the location and size of the write data based on the starting position and size of the write data, the number of disks during copying, and their positions in the RAID. Perform copying parallel data writing and proceed to step S5.

[0131] S3. Suspend the foreground I / O until the RAID stripe enters the copied area, then return to step S2;

[0132] S4. Use the existing front-end IO disk write process;

[0133] S5. When a faulty disk occurs in the RAID, fault recovery is initiated based on the RAID type, the number of faulty disks, and whether the faulty disk was a copy disk.

[0134] This invention intelligently identifies the RAID stripe status (copy-back area, copy-back area, and pending copy-back area) of the foreground I / O and adopts different processing strategies accordingly, effectively avoiding data write conflicts and ensuring data consistency and security. Furthermore, when a RAID disk fails, this method can quickly initiate the corresponding fault recovery mechanism based on the RAID type, the number of failed disks, and whether it is a copy-back disk, further enhancing the system's reliability and fault tolerance.

[0135] In this embodiment, step S1 is specifically as follows:

[0136] S11. Obtain the RAID status of the RAID stripe to which the foreground IO belongs;

[0137] When the RAID status is copy-back status, proceed to step S12;

[0138] When the RAID status is non-copyback status, proceed to step S4;

[0139] S12. Identify the RAID stripe to which the foreground I / O belongs;

[0140] When the RAID stripe to which it belongs is a copied area, proceed to step S2;

[0141] If the RAID stripe to which the data belongs is a copy-back area, proceed to step S3;

[0142] If the RAID stripe to which the data belongs is a copy-back area, proceed to step S4;

[0143] The specific steps of step S2 are as follows:

[0144] S21. Calculate the number of disk writes n required based on the data that needs to be written by the front-end I / O;

[0145] S22. Locate the i-th disk where data needs to be written, calculate the write parameters for the i-th disk, and initialize the i-th disk to 0; the write parameters include the location of the data to be written in memory, the starting position of the i-th disk where the data needs to be written, and the length;

[0146] S23. Write data to the corresponding position of the copied area of ​​the i-th disk according to the calculated disk writing parameters;

[0147] S24. Identify whether the i-th disk is a copy disk;

[0148] If so, proceed to step S25;

[0149] If not, proceed to step S26;

[0150] S25. Point the stripe of the i-th disk to the area to be copied back, and use the calculated write parameters to write the same data to the corresponding position in the area to be copied back;

[0151] S26. Determine if i is less than the number of disk writes n;

[0152] If so, let i = i + 1 and return to step S22;

[0153] If not, complete the parallel writing of foreground IO data to the copy disk and the data to be copied disk back, and then end;

[0154] The specific steps of step S3 are as follows:

[0155] S31. Suspend the foreground I / O that needs to write data;

[0156] S32. Determine whether the RAID stripe to which the foreground I / O belongs has entered the copied area;

[0157] If so, return to step S2;

[0158] If not, return to step S31;

[0159] The specific steps of step S4 are as follows:

[0160] S41. Calculate the number of disk writes n required based on the data that needs to be written by the front-end I / O;

[0161] S42. Locate the i-th disk that needs to be written data, calculate the write parameters of the i-th disk, and initialize the i-th disk to 0;

[0162] S43. Write data to the corresponding position of the copy-back area of ​​the RAID stripe of the i-th disk according to the calculated write parameters;

[0163] S44. Determine if i is less than the number of disk writes n;

[0164] If so, let i = i + 1 and return to step S42;

[0165] If not, complete the foreground IO data writing;

[0166] The specific steps of step S5 are as follows:

[0167] S51. When a failed disk occurs in a RAID, identify the RAID type and the number of failed disks;

[0168] If the RAID type is RAID5, proceed to step S52;

[0169] When the RAID type is RAID6, proceed to step S54;

[0170] If the RAID type is RAID TP, proceed to step S56;

[0171] S52. Determine if the number of faulty disks is greater than or equal to 2;

[0172] If so, proceed to step S58;

[0173] If not, proceed to step S53;

[0174] S53. Determine if a copy disk is faulty;

[0175] If so, use the data in the area to be copied back to restore the copy back disk, and then use the restored copy back disk, the normal disk, and the P checksum data block to restore the remaining faulty disk, and then the process ends;

[0176] If not, proceed to step S58;

[0177] S54. Determine if the number of faulty disks is greater than 4;

[0178] If so, proceed to step S58;

[0179] If not, proceed to step S55;

[0180] S55. Determine if there is a fault involving two or fewer copy disks;

[0181] If yes, use the data in the area to be copied back to restore the copy back disk, and then use the restored copy back disk, the normal disk, and the P check data block and Q check data block to restore the remaining faulty disks, and end; if no, proceed to step S58.

[0182] S56. Determine if the number of faulty disks is greater than 6;

[0183] If so, proceed to step S58;

[0184] If not, proceed to step S57;

[0185] S57. Determine if there is a fault involving three or fewer copy disks;

[0186] If so, use the data in the copy area of ​​the copied disk to restore the copy disk, and then use the restored copy disk, the normal disk, and the P check data block, Q check data block and R check data block to restore the remaining faulty disk, and then the process ends;

[0187] If not, proceed to step S58;

[0188] S58. The number of faults has exceeded the limit, and the faulty disk cannot be recovered via RAID.

[0189] Let's take a RAID5 configuration with 8 disks as an example. Figure 3 As shown, during the copy-back process, the area that has been copied back is called the copied-back area (done area), the area that is being copied back is called the copy-back area (transform area), and the area that has not yet been copied back is called the pending area (pending area). Figure 3 The dark part represents the data block to be written, P is the check data block, disk B is the copy disk, and disk B' is the copy disk. While writing the dark data block, the data in disk B is copied to disk B'.

[0190] In this RAID configuration, for the done area, since the copy-back is complete, disk B in the RAID has been replaced by disk B'; for the transform area, if an I / O operation falls in the transform area, the I / O will be suspended until the transform area is converted into the done area, at which point the I / O will be woken up; for the pending area, since the copy-back has not yet been performed, disk B in the RAID has not yet been replaced.

[0191] If, during the copy process, the copied disk B' and any other disk in the RAID (let's say disk C) fail simultaneously, then in the done area, since disk B has been replaced by disk B', there will be two failed disks in the RAID 5 array. Figure 4 As shown; Figure 4 The darker part represents the data block where new data is written, and P represents the parity data block. RAID 5 only has data recovery capabilities when one disk fails. Therefore, if disks B' and C fail, data cannot be written, and the data in disks B' and C cannot be recovered from other disks, resulting in the permanent loss of data in disks B' and C.

[0192] To ensure data security, this invention writes the same data to disk B as to disk B'. ​​In this scenario, only the data on the faulty disk C is unknown. Based on RAID 5 characteristics, the data on disk C can be calculated using the data from disks A, B, D, E, F, G, and H. Specifically, in scenarios with concurrent copy-back and foreground I / O, if the I / O occurs in the "done" area, the data is simultaneously written to the areas on both the copy-back disk and the copied disk where the I / O occurred.

[0193] Taking an 8-disk RAID 5 array as an example, if disks B' and C fail, and the stripes were originally in the done area, then the copy disk B in the RAID array has been replaced by the free copy disk B'. ​​The RAID structure is as follows: Figure 5 As shown, when writing to the i-th disk (let the i-th disk be the location of disk B), the disk being copied back, B', is being written to; the stripe is designated as the pending area. At this time, the copy disk B in the RAID has not yet been replaced by the free copy disk B'. ​​The RAID structure is as follows. Figure 6 As shown, when writing to the i-th disk, the copy disk B is written; this also writes data to disk B, which is outside the RAID group in the done area, so that data is written to both the copy disk B and the copied disk B'. ​​Even if the copied disk B' fails, the newly written data is still retained in the copy disk B.

[0194] Taking an 8-disk RAID6 as an example, in the done area, there are two parity disks, P and Q. When one or two disks being copied fail, if the number of failed disks in the RAID array (excluding those involved in the copy) is less than or equal to two, the method of this invention can still ensure data security. And as... Figure 7 The traditional RAID 6 method shown can only tolerate a maximum of two disk failures, while... Figure 8 The invention shown can tolerate up to four disk failures in a scenario where foreground I / O and copy-back are parallel, thus greatly improving data security in this scenario. Figure 9 , Figure 10 , Figure 11 In the three scenarios shown, traditional methods would result in permanent data loss, while the method of this invention can still ensure data security.

[0195] For the done area of ​​RAID TP, which has three parity disks (P, Q, and R), when 1 to 3 disks being copied back fail, and the number of other disks in the RAID array that fail (excluding those involved in the copy process) is less than or equal to 3, the method of this invention can still ensure data security. Traditional RAID TP methods can only tolerate a maximum of 3 disk failures, while this invention, in a scenario where foreground I / O and copy-back are parallel, can tolerate a maximum of 6 disk failures. Therefore, data security is greatly improved in this scenario. In the following six scenarios:

[0196] ① One copy disk failed, and three other disks failed;

[0197] ② Two copy disks failed, and two other disks failed;

[0198] ③ Two copy disks failed, and three other disks failed;

[0199] ④ Three copy disks failed, and one other disk failed;

[0200] ⑤ Three copy disks failed, and two other disks failed;

[0201] ⑥ Three copy disks failed, and three other disks failed.

[0202] Traditional methods can lead to permanent data loss, but the method of this invention can still ensure data security.

[0203] For a RAID 1 done area, there are two disks: a data disk and a mirror disk. Traditional RAID 1 can only allow one disk to fail at most. However, in a scenario where foreground I / O and copy-back are performed in parallel, this invention can still ensure data security even if both disks in the RAID 1 fail, thus greatly improving data security in this scenario.

[0204] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

[0205] The following are embodiments of a data protection system for parallel RAID front-end I / O and copy-back provided in this disclosure. This system and the data protection methods for parallel RAID front-end I / O and copy-back in the above embodiments belong to the same inventive concept. For details not described in detail in the embodiments of the data protection system for parallel RAID front-end I / O and copy-back, please refer to the embodiments of the data protection methods for parallel RAID front-end I / O and copy-back described above.

[0206] like Figure 2 As shown, the system includes:

[0207] The RAID stripe identification module is used to identify the RAID stripe to which the foreground I / O belongs when foreground I / O and RAID copy-back are performed in parallel.

[0208] The parallel IO data writing module is used when the RAID stripe is a copied area. It determines the additional write disk and the location and size of the write data based on the starting position and size of the write data, the number of disks during copying, and their positions in the RAID, and performs parallel data writing for copying.

[0209] The copy-back waiting module is used to suspend the foreground I / O when the RAID stripe is in the copy-back area, until the RAID stripe enters the copy-back area;

[0210] The IO data normal write module is used when the RAID stripe is a copy-back area, and the original front-end IO disk write process is used.

[0211] The fault data recovery module initiates fault recovery based on the RAID type, the number of faulty disks, and whether the faulty disk was the one being copied back when a faulty disk appears in the RAID.

[0212] In this embodiment, the RAID stripe identification module includes:

[0213] The RAID status identification unit for IO is used to obtain the RAID status of the RAID stripe to which the foreground IO belongs; the RAID stripe area identification unit is used to identify the RAID stripe to which the foreground IO belongs when the RAID status is copy-back.

[0214] The parallel IO data writing module includes:

[0215] The first disk write quantity calculation unit is used to calculate the number of disks n to be written based on the data to be written by the foreground IO; the disk write parameter calculation unit is used to locate the i-th disk that needs to be written data, calculate the disk write parameters of the i-th disk, and initialize the i-th disk to 0.

[0216] The data writing unit for the copied area is used to write data to the corresponding position of the copied area of ​​the i-th disk according to the calculated disk writing parameters;

[0217] The copy disk identification unit is used to identify whether the i-th disk is a copy disk;

[0218] The parallel data writing unit is used when the i-th disk is a copy-back disk. It points the stripe of the i-th disk to the copy-back area and uses the calculated write parameters to write the same data to the corresponding position in the copy-back area.

[0219] The first judgment unit for locating the disk is used to determine whether i is less than the number of disk writes n;

[0220] The next disk positioning unit is used when i is less than the number of disks to write to n, and i = i + 1 is set.

[0221] The data writing is completed in the first completion determination unit, which is used when i equals the number of disks written to n to complete the parallel writing of foreground IO data to the back-copy disk and the data to be back-copy disk;

[0222] The copy-back waiting module includes:

[0223] The foreground I / O suspension unit is used to suspend foreground I / O that requires writing data;

[0224] The "Copyback Area Entry Judgment Unit" is used to determine whether the RAID stripe to which the foreground IO belongs has entered the "Copyback Area"; the IO data normal write module includes:

[0225] The second disk write quantity calculation unit is used to calculate the required disk write quantity n based on the data to be written by the foreground IO; the second disk write parameter calculation unit locates the i-th disk that needs to be written data, calculates the disk write parameters of the i-th disk, and initializes the i-th disk to 0;

[0226] The data writing unit for the copy-back area is used to write data to the corresponding position of the copy-back area of ​​the RAID stripe of the i-th disk according to the calculated disk writing parameters;

[0227] The second judgment unit for locating the disk is used to determine whether i is less than the number of disks to write to n;

[0228] The next disk second positioning unit is used when i is less than the number of disks to write to n, so that i = i + 1;

[0229] The data writing completion determination unit is used to complete the foreground IO data writing when i equals the number of disk writes n; the fault data recovery module includes:

[0230] The RAID type and number of failed disks identification unit is used to identify the RAID type and the number of failed disks when a failed disk occurs in the RAID.

[0231] The RAID5 fault disk number determination unit is used to determine whether the number of fault disks is greater than or equal to 2 when the RAID type is RAID5.

[0232] The RAID5 copy disk failure count determination unit is used to determine whether there is a copy disk failure when the number of failure disks is less than 2.

[0233] The RAID5 fault disk recovery unit uses data from the copied disk in the copy area to recover the copied disk when one copy disk fails. Then, it uses the recovered copied disk, the normal disk, and the P parity data block to recover the remaining faulty disk, and then the process ends.

[0234] The RAID6 fault disk number determination unit is used to determine whether the number of fault disks is greater than 4 when the RAID type is RAID5.

[0235] The RAID6 copy disk failure count determination unit is used to determine whether there are two or fewer copy disk failures when the failure count is less than or equal to 4.

[0236] The RAID6 fault disk recovery unit is used to recover the copy disks when there are two or fewer copy disks that have failed. It uses the data in the copy area of ​​the copy disk to recover the copy disks, and then uses the recovered copy disks, normal disks, and P and Q parity data blocks to recover the remaining fault disks.

[0237] The RAID TP fault disk number determination unit is used to determine whether the number of fault disks is greater than 6 when the RAID type is RAID TP.

[0238] The RAID TP copy disk failure number determination unit is used to determine whether there are three or fewer copy disk failures when the number of failure disks is less than or equal to 6.

[0239] The RAID TP fault disk recovery unit is used to recover the copy disks when there are three or more failures. It uses the data in the copy area of ​​the copy disk to recover the copy disks. Then, it uses the recovered copy disk, the normal disk, and the P parity data blocks, Q parity data blocks, and R parity data blocks to recover the remaining fault disks, and then ends. The fault disk exceeding the limit and cannot be recovered judgment unit is used to determine that the number of faults exceeds the limit and the fault disks cannot be recovered by RAID.

[0240] The RAID front-end I / O and copy-back parallel data protection method provided by this invention, in conjunction with the modules and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein, can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of each example have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

[0241] Those skilled in the art will understand that the various aspects of the RAID front-end I / O and copy-back parallel data protection method provided by this invention can be implemented as a system, method, or program product. Therefore, the various aspects of this disclosure can be specifically implemented in the following forms: a completely hardware implementation, a completely software implementation (including firmware, microcode, etc.), or a combination of hardware and software aspects, collectively referred to herein as a "circuit," "module," or "system."

[0242] In a non-transitory computer-readable storage medium that stores a data protection method for RAID front-end I / O and copy-back in parallel, it may be, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of readable storage media include: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0243] Although the present invention has been described in detail with reference to the accompanying drawings and preferred embodiments, the present invention is not limited thereto. Various equivalent modifications or substitutions can be made to the embodiments of the present invention by those skilled in the art without departing from the spirit and essence of the invention, and such modifications or substitutions should all be within the scope of the present invention. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should also be covered within the protection scope of the present invention.

Claims

1. A data protection method for parallel front-end I / O and copy-back of RAID, characterized in that, Includes the following steps: S1. When front-end I / O and RAID copy-back are performed in parallel, identify the RAID stripe to which the front-end I / O belongs; When the RAID stripe to which it belongs is a copied area, proceed to step S2; When the RAID stripe to which it belongs is a copy-back area, proceed to step S3; When the RAID stripe to which it belongs is a copy-back area, proceed to step S4; S2. Determine the additional write disk and the location and size of the write data based on the starting position and size of the write data, the number of disks during copying, and their positions in the RAID. Perform copying parallel data writing and proceed to step S5. The specific steps of step S2 are as follows: S21. Calculate the number of disk writes n required based on the data that needs to be written by the front-end I / O; S22. Locate the i-th disk that needs to be written data, calculate the write parameters of the i-th disk, and initialize the i-th disk to 0; S23. Write data to the corresponding position of the copied area of ​​the i-th disk according to the calculated disk writing parameters; S24. Identify whether the i-th disk is a copy disk; If so, proceed to step S25; If not, proceed to step S26; S25. Point the stripe of the i-th disk to the area to be copied back, and use the calculated write parameters to write the same data to the corresponding position in the area to be copied back; S26. Determine if i is less than the number of disk writes n; If so, let i = i + 1 and return to step S22; If not, complete the parallel writing of foreground IO data to the copy disk and the data to be copied disk back, and then end; S3. Suspend the foreground I / O until the RAID stripe enters the copied area, then return to step S2; S4. Use the existing front-end IO disk write process; S5. When a faulty disk occurs in the RAID, fault recovery is initiated based on the RAID type, the number of faulty disks, and whether the faulty disk was a copy disk.

2. The data protection method for parallel RAID front-end I / O and copy-back as described in claim 1, characterized in that, The specific steps of step S1 are as follows: S11. Obtain the RAID status of the RAID stripe to which the foreground IO belongs; When the RAID status is copy-back status, proceed to step S12; When the RAID status is non-copyback status, proceed to step S4; S12. Identify the RAID stripe to which the foreground I / O belongs; When the RAID stripe to which it belongs is a copied area, proceed to step S2; If the RAID stripe to which the data belongs is a copy-back area, proceed to step S3; If the RAID stripe to which it belongs is a copy-back area, proceed to step S4.

3. The data protection method for parallel RAID front-end I / O and copy-back as described in claim 1, characterized in that, The disk writing parameters in step S22 include the location of the data to be written in memory, the starting position of the i-th disk to which the data needs to be written, and the length.

4. The data protection method for parallel RAID front-end I / O and copy-back as described in claim 1, characterized in that, The specific steps of step S3 are as follows: S31. Suspend the foreground I / O that needs to write data; S32. Determine whether the RAID stripe to which the foreground I / O belongs has entered the copied area; If so, return to step S2; If not, return to step S31.

5. The data protection method for parallel RAID front-end I / O and copy-back as described in claim 1, characterized in that, The specific steps of step S4 are as follows: S41. Calculate the number of disk writes n required based on the data that needs to be written by the front-end I / O; S42. Locate the i-th disk that needs to be written data, calculate the write parameters of the i-th disk, and initialize the i-th disk to 0; S43. Write data to the corresponding position of the copy-back area of ​​the RAID stripe of the i-th disk according to the calculated write parameters; S44. Determine if i is less than the number of disk writes n; If so, let i = i + 1 and return to step S42; If not, complete the foreground IO data writing.

6. The data protection method for parallel RAID front-end I / O and copy-back as described in claim 1, characterized in that, The specific steps of step S5 are as follows: S51. When a failed disk occurs in a RAID, identify the RAID type and the number of failed disks; If the RAID type is RAID5, proceed to step S52; When the RAID type is RAID6, proceed to step S54; If the RAID type is RAID TP, proceed to step S56; S52. Determine if the number of faulty disks is greater than or equal to 2; If so, proceed to step S58; If not, proceed to step S53; S53. Determine if a copy disk is faulty; If so, use the data in the area to be copied back to restore the copy back disk, and then use the restored copy back disk, the normal disk, and the P checksum data block to restore the remaining faulty disk, and then the process ends; If not, proceed to step S58; S54. Determine if the number of faulty disks is greater than 4; If so, proceed to step S58; If not, proceed to step S55; S55. Determine if there is a fault involving two or fewer copy disks; If so, use the data in the area to be copied back to restore the copy back disk, and then use the restored copy back disk, normal disks, and P and Q check data blocks to restore the remaining faulty disks, and then the process ends. If not, proceed to step S58; S56. Determine if the number of faulty disks is greater than 6; If so, proceed to step S58; If not, proceed to step S57; S57. Determine if there is a fault involving three or fewer copy disks; If so, use the data in the copy area of ​​the copied disk to restore the copy disk, and then use the restored copy disk, the normal disk, and the P check data block, Q check data block and R check data block to restore the remaining faulty disk, and then the process ends; If not, proceed to step S58; S58. The number of faults has exceeded the limit, and the faulty disk cannot be recovered via RAID.

7. A data protection system for RAID front-end I / O and copy-back in parallel, characterized in that, include: The RAID stripe identification module is used to identify the RAID stripe to which the foreground I / O belongs when foreground I / O and RAID copy-back are performed in parallel. The parallel IO data writing module is used when the RAID stripe is a copied area. It determines the additional write disk and the location and size of the write data based on the starting position and size of the write data, the number of disks during copying, and their positions in the RAID, and performs parallel data writing for copying. The specific workflow of the parallel IO data writing module is as follows: Calculate the number of disk writes required, n, based on the data that needs to be written by the front-end I / O; Locate the i-th disk that needs to be written data, calculate the write parameters for the i-th disk, and initialize the i-th disk to 0; Data is written to the corresponding location of the copied area of ​​the i-th disk according to the calculated write parameters; Identify whether the i-th disk is a copy disk; If so, point the stripe of the i-th disk to the area to be copied back, and use the calculated write parameters to write the same data to the corresponding position in the area to be copied back; If not, check if i is less than the number of disk writes n; If so, let i = i + 1, and return the disk location where the data needs to be written; If not, complete the parallel writing of foreground IO data to the copy disk and the data to be copied disk back; The copy-back waiting module is used to suspend the foreground I / O when the RAID stripe is in the copy-back area, until the RAID stripe enters the copy-back area; The IO data normal write module is used when the RAID stripe is a copy-back area, and the original front-end IO disk write process is used. The fault data recovery module initiates fault recovery based on the RAID type, the number of faulty disks, and whether the faulty disk was the one being copied back when a faulty disk appears in the RAID.

8. An electronic device, characterized in that, Including processor and memory; The memory is used to store a computer program, and the processor is used to retrieve and run the computer program from the memory, causing the electronic device to perform the method described in any one of claims 1-6.

9. A storage medium, characterized in that, The storage medium stores instructions that, when run on a computer, cause the computer to perform the method described in any one of claims 1-6.

Citation Information

Patent Citations

  • Data processing method and device

    CN104571959A

  • Multi-fault disk data recovery method for RAID (Redundant Arrays of Independent Disks) and system thereof

    CN106371947A