Data protection method, system, equipment and medium with parallel RAID (redundant array of independent disks) foreground IO (input / output) and copy-back

By identifying the RAID stripe status and determining the additional write disk, data protection of the foreground IO and the back copying parallel during the RAID copying process is solved, and data loss is ensured, data security and performance consumption is reduced. .

CN119292837AActive Publication Date: 2025-01-10SHANDONG YUNHAI GUOCHUANG CLOUD COMPUTING EQUIP IND INNOVATION CENT CO LTD

Patent Information

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

AI Technical Summary

Technical Problem

During the RAID copying process, when the front-end IO data writing and copying fail at the same time, data loss is caused and data security cannot be guaranteed.

Method used

Provide a data protection method in which RAID front desk IO is parallel to copy back. By identifying the RAID stripe status, determining the additional write disk and location, performing copy back parallel data writing, and when a fault occurs, it depends on the RAID type and number of fault disks. Perform failure recovery to ensure that the data is backed up in the copy disk.

Benefits of technology

In the parallel scenario of front-end IO and copy back, ensure that data is backed up in the copy back disk, ensure the security of the data, and reduce the performance consumption of additional write-back copy disk, the design principle is reliable, the structure is simple, and it has a wide range of applications. prospect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119292837A_ABST
    Figure CN119292837A_ABST
Patent Text Reader

Abstract

The invention provides a data protection method, system, equipment and medium with parallel foreground IO and copy-back of RAID (redundant array of independent disks), and belongs to the technical field of storage data security, the method comprises the following steps: when the foreground IO and the RAID copy-back are parallel, identifying an RAID stripe to which the foreground IO belongs; when the write-back area is a copied-back area, determining positions and sizes of an additional write-in disk and the write-in data according to the initial position and size of the write-in data, the number of disks during copying back and the position of the disk in the RAID, and executing copying back parallel data write-in; when the RAID stripe belongs to the copy-back area, the foreground IO is hung until the RAID stripe enters the copy-back area; when the area is the to-be-copied area, using an original foreground IO disk falling process; and when a fault disk occurs in the RAID, starting fault recovery according to the RAID type, the number of the fault disks and whether the fault disk is the copied disk or not. According to the method and the device, the data security is ensured by additionally writing the duplicated disk data.
Need to check novelty before this filing date? Find Prior Art

Description

Background Art

[0002] RAID, short for Redundant Array of Independent Disks, is a redundant array of independent disks. RAID is a large-capacity disk group composed of many fast and independent disks, and uses the verification redundancy provided by individual disks to improve the storage performance and reliability of the entire disk system.

[0003] RAID arrays use striping, mirroring, and parity to ensure data security. RAID5 can recover a piece of failed data through the P parity block in the disk array, and RAID6 can recover data from two failed disks through the P parity block and Q parity block in the disk array. When a 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 with a new data disk, the data in the hot spare disk will be copied back to the newly added data disk. This process is called RAID copyback. During the RAID copyback process, when the foreground IO data needs to be written, it needs to be written through the new disk copied back in the RAID. However, if the new disk copied back suddenly fails, data loss will occur and data security cannot be guaranteed.

[0004] Therefore, in view of the above-mentioned defects, it is very necessary to provide a data protection method, system, device and medium for RAID foreground IO and copyback in parallel. Summary of the invention

[0005] In view of the defect that in the above-mentioned RAID copyback process, when the foreground IO data writing and the new disk for copying back fail at the same time, data loss will occur and the security of data cannot be guaranteed, the present invention provides a RAID foreground IO and copyback parallel data protection method, system, device and medium to solve the above-mentioned technical problem.

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

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

[0008] When the RAID stripe is a copied-back area, go to step S2;

[0009] When the RAID stripe is a copy-back area, go to step S3;

[0010] When the RAID stripe is a to-be-copied area, proceed to step S4;

[0011] S2. Determine the location and size of the additional disk and the data written based on the starting position and size of the written data, the number of disks when copying back, and the location in the RAID, perform copyback parallel data writing, and proceed to step S5;

[0012] S3 suspends the foreground IO until the RAID stripe enters the back-copy area, and returns to step S2;

[0013] S4. Use the original front-end IO disk-storage process;

[0014] S5. When a failed disk appears in the RAID, failure recovery is started according to the RAID type, the number of failed disks, and whether the failed disk is a disk to be copied back.

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

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

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

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

[0019] S12. Identify the RAID stripe to which the foreground IO belongs;

[0020] When the RAID stripe is a copied-back area, go to step S2;

[0021] When the RAID stripe is a copy-back area, go to step S3;

[0022] When the RAID stripe is the area to be copied back, the process goes to step S4.

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

[0024] S21. Calculate the number of disks n that need to be written based on the data that needs to be written by the foreground IO;

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

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

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

[0028] If yes, go to step S25;

[0029] If not, proceed to step S26;

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

[0031] S26. Determine whether i is less than the number of disks to be written n;

[0032] If yes, set i=i+1 and return to step S22;

[0033] If not, the parallel writing of the foreground IO data to the copy-back disk and the data to be copied-back disk is completed, and the process ends.

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

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

[0036] S31. Suspend the foreground IO that needs to write data;

[0037] S32. Determine whether the RAID stripe to which the foreground IO belongs has entered the back-copy area;

[0038] If yes, 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 disks n that need to be written based on the data that needs to be written by the foreground IO;

[0042] S42. Locate the i-th disk to which data needs to be written, 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 to-be-copied area of ​​the RAID stripe of the i-th disk according to the calculated write parameters;

[0044] S44. Determine whether i is less than the number of disks to be written n;

[0045] If yes, set 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 the RAID, identify the RAID type and the number of failed disks;

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

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

[0051] When the RAID type is RAID TP, go to step S56;

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

[0053] If yes, go to step S58;

[0054] If not, proceed to step S53;

[0055] S53. Determine whether there is a failed back-copy disk;

[0056] If yes, use the data in the to-be-copied area of ​​the copied disk to restore the copied disk, and then use the restored copied disk, the normal disk and the P check data block to restore the remaining faulty disk, and then end;

[0057] If not, proceed to step S58;

[0058] S54. Determine whether the number of failed disks is greater than 4;

[0059] If yes, go to step S58;

[0060] If not, proceed to step S55;

[0061] S55. Determine whether there are less than or equal to two copy-back disk failures;

[0062] If yes, use the data in the to-be-copied area of ​​the copied disk to restore the copied disk, and then use the restored copied disk and the normal disk in combination with the P check data block and the Q check data block to restore the remaining faulty disk, and then end; if no, proceed to step S58;

[0063] S56. Determine whether the number of failed disks is greater than 6;

[0064] If yes, go to step S58;

[0065] If not, proceed to step S57;

[0066] S57. Determine whether there are less than or equal to three copy-back disk failures;

[0067] If yes, use the data in the to-be-copied area of ​​the copied disk to restore the copied disk, and then use the restored copied disk and the normal disk in combination with the P check data block, the Q check data block, and the R check data block to restore the remaining faulty disks, and then end;

[0068] If not, proceed to step S58;

[0069] S58. It is determined that the number of failures exceeds the limit and the failed disk cannot be recovered through RAID.

[0070] In a second aspect, the present invention provides a data protection system in which RAID foreground IO and RAID copyback are in parallel, comprising: a RAID stripe identification module, for identifying the RAID stripe to which the foreground IO belongs when the foreground IO and RAID copyback are in parallel;

[0071] The IO data parallel writing module is used to determine the additional writing disk and the location and size of the written data according to the starting location and size of the written data, the number of disks during copyback, and the location in the RAID when the RAID stripe to which it belongs is a copied back area, and perform copyback parallel data writing;

[0072] The copy-back waiting module is used to suspend the foreground IO when the RAID stripe to which it belongs is in the copy-back area, until the RAID stripe to which it belongs enters the copy-back area;

[0073] The IO data is normally written into the module, which is used when the RAID stripe to which it belongs is the area to be copied back, and the original foreground IO disk write process is used;

[0074] The fault data recovery module starts fault recovery when a faulty disk appears in the RAID according to the RAID type, the number of faulty disks, and whether the faulty disk is a disk to be copied back.

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

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

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

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

[0079] A copy-back area data writing unit, used to write data to a corresponding position of the copy-back area of ​​the i-th disk according to the calculated disk writing parameters;

[0080] A copy-back disc identification unit, used to identify whether the i-th disc is a copy-back disc;

[0081] The data parallel writing unit is used for pointing the stripe of the i-th disk to the to-be-copy-back area when the i-th disk is a copy-back disk, and writing the same data to the corresponding position of the to-be-copy-back area using the calculated disk writing parameters;

[0082] A first determination unit for locating the disk is used to determine whether i is less than the number of disks to be written n;

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

[0084] The first data writing completion determination unit is used to complete the parallel writing of the foreground IO data on the copy-back disk and the data on the to-be-copy-back disk when i is equal to the number of write disks n.

[0085] Furthermore, the copyback waiting module includes:

[0086] A foreground IO suspension unit is used to suspend the foreground IO that needs to write data;

[0087] The copy-back area entry judgment unit is used to judge whether the RAID stripe to which the foreground IO belongs has entered the copy-back area. Further, the IO data normal writing module includes:

[0088] The second disk writing quantity calculation unit is used to calculate the number of disks to be written n according to the data to be written by the foreground IO; the second disk writing parameter calculation unit locates the i-th disk to be written, calculates the disk writing parameters of the i-th disk, and initializes the i-th disk to 0;

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

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

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

[0092] The second data writing completion determination unit is used to complete the foreground IO data writing when i is equal to the number of write disks n. Further, the fault data recovery module includes:

[0093] RIAI type and fault disk quantity identification unit, used to identify the RAID type and the number of fault disks when a fault disk appears in the RAID;

[0094] A RAID5 fault disk quantity judgment unit, used to judge whether the number of fault disks is greater than or equal to 2 when the RAID type is RAID5;

[0095] RAID5 copyback disk fault quantity judgment unit, used to judge whether there is a copyback disk fault when the number of faulty disks is less than 2;

[0096] RAID5 fault disk recovery unit, when there is a faulty copy disk, use the data in the to-be-copied area of ​​the copied disk to recover the copy disk, then use the recovered copy disk, normal disk and P check data block to recover the remaining faulty disk, and then end;

[0097] A RAID6 fault disk quantity judgment unit, used to judge whether the number of fault disks is greater than 4 when the RAID type is RAID5;

[0098] A RAID6 copyback disk fault number judgment unit is used to judge whether there are less than or equal to two copyback disk faults when the number of faults is less than or equal to 4;

[0099] RAID6 fault disk recovery unit, used for recovering the copy disk using the data in the waiting copy area of ​​the copied disk when there are two or less copy disks faults, and then recovering the remaining fault disk using the recovered copy disk, normal disk, and P check data block and Q check data block;

[0100] A RAID TP fault disk quantity judgment unit, used to judge whether the number of fault disks is greater than 6 when the RAID type is RAID TP;

[0101] A RAID TP copyback disk fault quantity judgment unit is used to judge whether there are three or fewer copyback disk faults when the number of faulty disks is less than or equal to 6;

[0102] The RAID TP fault disk recovery unit is used to use the data in the waiting-to-copy-back area of ​​the copied disk to recover the copied disk when there are three failed copies of the disk, and then use the recovered copied disk and normal disk in combination with P check data block, Q check data block and R check data block to recover the remaining faulty disks, and then end; the faulty disk exceeds the limit and cannot be recovered judgment unit is used to judge that the number of faults exceeds the limit and the faulty disk cannot be recovered through RAID.

[0103] In a third aspect, 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 call and run the computer program from the memory, so that the electronic device executes the method described in the first aspect above.

[0105] In a fourth aspect, the present invention provides a storage medium,

[0106] The storage medium stores instructions, which, when executed on a computer, enable the computer to execute the method described in the first aspect.

[0107] The beneficial effects of the present invention are:

[0108] The RAID foreground IO and copyback parallel data protection method, system, device and medium provided by the present invention, in the scenario where the foreground IO and copyback are parallel, by additionally writing the copyback disk data, even if the copied back disk suddenly fails in this scenario, the data is still backed up in the copyback disk, thereby ensuring the security of the data; when writing to the copyback disk in the present invention, the write parameters of the normal disk writing process are reused, the amount of calculation is reduced, and only the copyback disk involved in the foreground IO is written, which improves data security while minimizing the performance consumption of the additional writing to the copyback disk.

[0109] In addition, the invention has a reliable design principle, a simple structure and a very broad application prospect.

[0110] It can be seen that compared with the prior art, the present invention has outstanding substantive features and significant progress, and the beneficial effects of its implementation are also obvious. BRIEF DESCRIPTION OF THE DRAWINGS

[0111] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0112] Figure 1 It is a flow chart of the data protection method of RAID foreground IO and copyback in parallel according to the present invention.

[0113] Figure 2 It is a schematic diagram of a data protection system in which RAID foreground IO and copyback are carried out in parallel according to the present invention.

[0114] Figure 3 This is an example diagram of the concurrency of copyback and foreground IO in the traditional RAID5.

[0115] Figure 4 This is a diagram of a traditional RAID5 data loss scenario.

[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 7 This is a diagram showing the results of traditional RAID5 disk writing.

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

[0120] Fig. 9 This is a schematic diagram of a RAID 6 copyback disk of the present invention in which two disks are damaged and one disk of the other disk is damaged.

[0121] Fig.10 This is a schematic diagram of a RAID 6 copyback disk of the present invention in which one disk is damaged and two other disks are damaged.

[0122] Fig.11 This is a schematic diagram of the RAID6 copyback disk of the present invention where two disks are damaged and two other disks are damaged. DETAILED DESCRIPTION

[0123] The RAID foreground IO and copy-back parallel data protection method can be applied to one or more devices, wherein the device is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), programmable gate arrays (Field-Programmable Gate Array, FPGA), digital processors (Digital Signal Processor, DSP), embedded devices, etc.

[0124] An electronic device can be any electronic product that can interact with a user, such as a personal computer, a tablet computer, a smart phone, a personal digital assistant (PDA), an interactive network television (IPTV), etc. The network in which the electronic device is located includes but is not limited to the Internet, a wide area network, a metropolitan area network, a local area network, a virtual private network (VPN), etc.

[0125] 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 should fall within the scope of protection of the present invention. Please refer to Figure 1 The figure shows a data protection method of RAID foreground IO and copyback in parallel in a specific implementation, including the following steps:

[0126] S1. When the foreground IO and RAID copyback are in parallel, identify the RAID stripe to which the foreground IO belongs;

[0127] When the RAID stripe is a copied-back area, go to step S2;

[0128] When the RAID stripe is a copy-back area, go to step S3;

[0129] When the RAID stripe is a to-be-copied area, proceed to step S4;

[0130] S2. Determine the location and size of the additional disk and the data written based on the starting position and size of the written data, the number of disks when copying back, and the location in the RAID, perform copyback parallel data writing, and proceed to step S5;

[0131] S3 suspends the foreground IO until the RAID stripe enters the back-copy area, and returns to step S2;

[0132] S4. Use the original front-end IO disk-storage process;

[0133] S5. When a failed disk appears in the RAID, failure recovery is started according to the RAID type, the number of failed disks, and whether the failed disk is a disk to be copied back.

[0134] The present invention can effectively avoid data writing conflicts and ensure data consistency and security by intelligently identifying the RAID stripe status (copied back area, copy back area, and waiting copy back area) to which the foreground IO belongs, and adopting different processing strategies accordingly. In addition, when a faulty disk appears in the RAID, the method can quickly start a corresponding fault recovery mechanism according to the RAID type, the number of faulty disks, and whether it is a copy back disk, further enhancing the reliability and fault tolerance of the system.

[0135] In this embodiment, the specific steps of step S1 are as follows:

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

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

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

[0139] S12. Identify the RAID stripe to which the foreground IO belongs;

[0140] When the RAID stripe is a copied-back area, go to step S2;

[0141] When the RAID stripe is a copy-back area, go to step S3;

[0142] When the RAID stripe is a to-be-copied area, go to step S4;

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

[0144] S21. Calculate the number of disks n that need to be written based on the data that needs to be written by the foreground IO;

[0145] S22. Locate the i-th disk to which data needs to be written, calculate the write parameters of 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 the memory, the starting position and length of the data to be written to the i-th disk;

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

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

[0148] If yes, go to step S25;

[0149] If not, proceed to step S26;

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

[0151] S26. Determine whether i is less than the number of disks to be written n;

[0152] If yes, set i=i+1 and return to step S22;

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

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

[0155] S31. Suspend the foreground IO that needs to write data;

[0156] S32. Determine whether the RAID stripe to which the foreground IO belongs has entered the back-copy area;

[0157] If yes, 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 disks n that need to be written based on the data that needs to be written by the foreground IO;

[0161] S42. Locate the i-th disk to which data needs to be written, 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 to-be-copied area of ​​the RAID stripe of the i-th disk according to the calculated write parameters;

[0163] S44. Determine whether i is less than the number of disks to be written n;

[0164] If yes, set 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 the RAID, identify the RAID type and the number of failed disks;

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

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

[0170] When the RAID type is RAID TP, go to step S56;

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

[0172] If yes, go to step S58;

[0173] If not, proceed to step S53;

[0174] S53. Determine whether there is a failed back-copy disk;

[0175] If yes, use the data in the to-be-copied area of ​​the copied disk to restore the copied disk, and then use the restored copied disk, the normal disk and the P check data block to restore the remaining faulty disk, and then end;

[0176] If not, proceed to step S58;

[0177] S54. Determine whether the number of failed disks is greater than 4;

[0178] If yes, go to step S58;

[0179] If not, proceed to step S55;

[0180] S55. Determine whether there are less than or equal to two copy-back disk failures;

[0181] If yes, use the data in the to-be-copied area of ​​the copied disk to restore the copied disk, and then use the restored copied disk and the normal disk in combination with the P check data block and the Q check data block to restore the remaining faulty disk, and then end; if no, proceed to step S58;

[0182] S56. Determine whether the number of failed disks is greater than 6;

[0183] If yes, go to step S58;

[0184] If not, proceed to step S57;

[0185] S57. Determine whether there are less than or equal to three copy-back disk failures;

[0186] If yes, use the data in the to-be-copied area of ​​the copied disk to restore the copied disk, and then use the restored copied disk and the normal disk in combination with the P check data block, the Q check data block, and the R check data block to restore the remaining faulty disks, and then end;

[0187] If not, proceed to step S58;

[0188] S58. It is determined that the number of failures exceeds the limit and the failed disk cannot be recovered through RAID.

[0189] Take RAID5 with 8 disks as an example. Figure 3 As shown, during the copyback process, the area that has completed the copyback is called the copyback area or done area, the area that is in the process of copying back is called the copyback area or transform area, and the area that has not yet been copied back is called the pending area; Figure 3 The dark-colored part in the middle is the data block to be written with new data, P is the verification data block, disk B is the copy-back disk, and disk B' is the disk to be copied back. When the dark-colored data block is written, the data in disk B is copied to disk B'.

[0190] In this RAID, for the done area, since the copyback has been completed, disk B in the RAID has been replaced by disk B'; for the transform area, if there is an IO falling in the transform area, the IO will be suspended, and the IO will be awakened after the transform area is converted to the done area; for the pending area, since the copyback has not been carried out, disk B in the RAID has not been replaced at this time;

[0191] During the copy-back process, if the copied disk B' and any other disk in the RAID (assuming it is disk C) fail at the same time, then in the done area, since disk B has been replaced by disk B', there are two failed disks in RAID 5. Figure 4 As shown; Figure 4 The darker part in the middle is the data block where new data is written, and P is the check data block. RAID 5 has the data recovery function only when one disk fails. Since disk B' and disk C fail, data cannot be written, and the data in disk B' and disk C cannot be recovered through data from other disks, which will cause permanent loss of data in disk B' and disk C.

[0192] To ensure data security, after using the present invention, the same data as that in disk B' will be written to disk B. In this way, in the above scenario, only the data in bad disk C is unknown. According to the RAID 5 characteristics, the data in disks A, B, D, E, F, G, and H can be used to calculate the data in disk C. That is, in the scenario where copyback and foreground IO are concurrent, if the IO falls in the done area, it will be written to the area where the IO is located in the copyback disk and the copied disk at the same time.

[0193] Taking 8-disk RAID 5 as an example, disks B' and C fail, and the original stripe is in the done area. Therefore, the copyback disk B in the RAID has been replaced by the free copyback disk B'. ​​The RAID structure is as follows: Figure 5 As shown, when writing the i-th disk (assuming that the i-th disk is where disk B is located), the copy-back disk B' is written; the stripe is assigned to the pending area. At this time, the copy-back disk B in the RAID has not been replaced by the free copy-back disk B'. ​​The RAID structure is as follows Figure 6 As shown, when writing to the i-th disk, the data is written to the copy disk B; in this way, the disk B whose done area is outside the RAID group is also written with data, so that the purpose of writing data to both the copy disk B and the copied disk B' can be achieved. Even if the copied disk B' fails, the newly written data is still retained in the copy disk B.

[0194] Taking RAID6 with 8 disks as an example, in the done area, it has two check disks P and Q. When the disk being copied back has 1 to 2 damaged disks, except for the disk involved in the copy back, the number of damaged disks in the RAID is less than or equal to 2, the method of the present invention can still ensure data security. Figure 7 The traditional RAID 6 method shown in the figure allows at most two disks to fail. Figure 8 As shown in the present invention, in the IO disk drop scenario where the foreground IO and the back copy are in parallel, a maximum of 4 disks can be allowed to fail, so data security is greatly improved in this scenario. Fig. 9 , Fig.10 , Fig.11 In the three scenarios shown, traditional methods will lead to permanent data loss, but the method of the present invention can still ensure the security of data.

[0195] For the done area of ​​RAID TP, it has three check disks P, Q, and R. When 1 to 3 disks are damaged by the disk being copied back, except for the disk involved in the copy back, the number of damaged disks in the RAID is less than or equal to 3, the method of the present invention can still ensure data security. The traditional method RAID TP allows up to 3 damaged disks, while the present invention allows up to 6 damaged disks in the IO drop scenario where the foreground IO and the copy back are parallel. Therefore, data security is greatly improved in this scenario. In the following six scenarios:

[0196] ①One piece of the back-copy disk was damaged, and three pieces of the other disks were damaged;

[0197] ② Two pieces of the back-copy disk were damaged, and two pieces of other disks were damaged;

[0198] ③ Two pieces of the back-copy disk were damaged, and three pieces of the other disks were damaged;

[0199] ④ Three pieces of the back-copy disk were damaged, and one piece of the other disk was damaged;

[0200] ⑤ Three pieces of the back-copy disk were damaged, and two pieces of other disks were damaged;

[0201] ⑥ Three pieces of the back-copy disk were damaged, and three pieces of the other disks were damaged.

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

[0203] For the done area of ​​RAID 1, it has two disks, one data disk and one mirror disk. The traditional method RAID1 allows at most one disk to fail, but in the IO drop scenario where the foreground IO and the copyback are parallel, even if the two disks in RAID 1 are all failed, the data security can still be guaranteed, so the data security in this scenario is greatly improved.

[0204] It should be understood that the order of execution of the steps in the above embodiment does not mean that 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 embodiment of the present invention.

[0205] The following is an embodiment of a data protection system in which RAID foreground IO and copyback are in parallel provided by an embodiment of the present disclosure. This system and the data protection method in which RAID foreground IO and copyback are in parallel in the above-mentioned embodiments belong to the same inventive concept. For details not fully described in the embodiment of the data protection system in which RAID foreground IO and copyback are in parallel, reference can be made to the embodiment of the data protection method in which RAID foreground IO and copyback are in parallel.

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

[0207] RAID stripe identification module, used to identify the RAID stripe to which the foreground IO belongs when the foreground IO and RAID copyback are in parallel;

[0208] The IO data parallel writing module is used to determine the additional writing disk and the location and size of the written data according to the starting location and size of the written data, the number of disks during copyback, and the location in the RAID when the RAID stripe to which it belongs is a copied back area, and perform copyback parallel data writing;

[0209] The copy-back waiting module is used to suspend the foreground IO when the RAID stripe to which it belongs is in the copy-back area, until the RAID stripe to which it belongs enters the copy-back area;

[0210] The IO data is normally written into the module, which is used when the RAID stripe to which it belongs is the area to be copied back, and the original foreground IO disk write process is used;

[0211] The fault data recovery module starts fault recovery when a faulty disk appears in the RAID according to the RAID type, the number of faulty disks, and whether the faulty disk is a disk to be copied back.

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

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

[0214] The IO data parallel writing module includes:

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

[0216] A copy-back area data writing unit, used to write data to a corresponding position of the copy-back area of ​​the i-th disk according to the calculated disk writing parameters;

[0217] A copy-back disc identification unit, used to identify whether the i-th disc is a copy-back disc;

[0218] The data parallel writing unit is used for pointing the stripe of the i-th disk to the to-be-copy-back area when the i-th disk is a copy-back disk, and writing the same data to the corresponding position of the to-be-copy-back area using the calculated disk writing parameters;

[0219] A first determination unit for locating the disk is used to determine whether i is less than the number of disks to be written n;

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

[0221] The first data writing completion determination unit is used to complete the parallel writing of the foreground IO data on the copy-back disk and the data on the disk to be copied back when i is equal to the number of write disks n;

[0222] The copyback waiting module includes:

[0223] A foreground IO suspension unit is used to suspend the foreground IO that needs to write data;

[0224] The copy-back area entry judgment unit is used to judge whether the RAID stripe to which the foreground IO belongs enters the copy-back area; the IO data normal writing module includes:

[0225] The second disk writing quantity calculation unit is used to calculate the number of disks to be written n according to the data to be written by the foreground IO; the second disk writing parameter calculation unit locates the i-th disk to be written, calculates the disk writing parameters of the i-th disk, and initializes the i-th disk to 0;

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

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

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

[0229] The second data writing completion determination unit is used to complete the foreground IO data writing when i is equal to the number of write disks n; the fault data recovery module includes:

[0230] RIAI type and fault disk quantity identification unit, used to identify the RAID type and the number of fault disks when a fault disk appears in the RAID;

[0231] A RAID5 fault disk quantity judgment unit, used to judge whether the number of fault disks is greater than or equal to 2 when the RAID type is RAID5;

[0232] RAID5 copyback disk fault quantity judgment unit, used to judge whether there is a copyback disk fault when the number of faulty disks is less than 2;

[0233] RAID5 fault disk recovery unit, when there is a faulty copy disk, use the data in the to-be-copied area of ​​the copied disk to recover the copy disk, then use the recovered copy disk, normal disk and P check data block to recover the remaining faulty disk, and then end;

[0234] A RAID6 fault disk quantity judgment unit, used to judge whether the number of fault disks is greater than 4 when the RAID type is RAID5;

[0235] A RAID6 copyback disk fault number judgment unit is used to judge whether there are less than or equal to two copyback disk faults when the number of faults is less than or equal to 4;

[0236] The RAID6 fault disk recovery unit is used to recover the copy disk using the data in the waiting copy area of ​​the copied disk when there are two or less copy disks faults, and then use the recovered copy disk, normal disk, and P check data block and Q check data block to recover the remaining fault disk;

[0237] A RAID TP fault disk quantity judgment unit, used to judge whether the number of fault disks is greater than 6 when the RAID type is RAID TP;

[0238] A RAID TP copyback disk fault quantity judgment unit is used to judge whether there are three or fewer copyback disk faults when the number of faulty disks is less than or equal to 6;

[0239] The RAID TP fault disk recovery unit is used to use the data in the waiting-to-copy-back area of ​​the copied disk to recover the copied disk when there are three failed copies of the disk, and then use the recovered copied disk and normal disk in combination with P check data block, Q check data block and R check data block to recover the remaining faulty disks, and then end; the faulty disk exceeds the limit and cannot be recovered judgment unit is used to judge that the number of faults exceeds the limit and the faulty disk cannot be recovered through RAID.

[0240] The RAID foreground IO and copyback parallel data protection method provided by the present invention is a combination of the modules and algorithm steps of each example described in the embodiments disclosed herein, and can be implemented by 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 the function. Whether these functions are executed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present invention.

[0241] Those skilled in the art will appreciate that the various aspects of the RAID foreground IO and copyback parallel data protection method provided by the present invention can be implemented as a system, method or program product. Therefore, various aspects of the present disclosure can be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or an implementation combining hardware and software, which can be collectively referred to as a "circuit", "module" or "system" here.

[0242] In the non-transitory computer-readable storage medium storing the data protection method of the RAID foreground IO and copyback in parallel, it can be but not limited to an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0243] Although the present invention has been described in detail with reference to the accompanying drawings and in combination with the preferred embodiments, the present invention is not limited thereto. Without departing from the spirit and essence of the present invention, a person of ordinary skill in the art may make various equivalent modifications or substitutions to the embodiments of the present invention, and these modifications or substitutions shall be within the scope of the present invention. Any person of ordinary skill in the art may easily think of changes or substitutions within the technical scope disclosed by the present invention, and these shall be within the scope of protection of the present invention.

Claims

1. A data protection method for RAID foreground IO and copyback in parallel, characterized in that: The steps include: S1. When the foreground IO and RAID copyback are in parallel, identify the RAID stripe to which the foreground IO belongs; When the RAID stripe is a copied-back area, go to step S2; When the RAID stripe is a copy-back area, go to step S3; When the RAID stripe is a to-be-copied area, proceed to step S4; S2. Determine the location and size of the additional disk and the data written based on the starting position and size of the written data, the number of disks when copying back, and the location in the RAID, perform copyback parallel data writing, and proceed to step S5; S3 suspends the foreground IO until the RAID stripe enters the back-copy area, and returns to step S2; S4. Use the original front-end IO disk-storage process; S5. When a failed disk appears in the RAID, failure recovery is started according to the RAID type, the number of failed disks, and whether the failed disk is a disk to be copied back.

2. The RAID foreground IO and copyback parallel data protection method as claimed in claim 1, characterized in that: The specific steps of step S1 are as follows: S11. Get the RAID status of the RAID stripe to which the foreground IO belongs; When the RAID status is the copy-back status, go to step S12; When the RAID status is non-copyback status, go to step S4; S12. Identify the RAID stripe to which the foreground IO belongs; When the RAID stripe is a copied-back area, go to step S2; When the RAID stripe is a copy-back area, go to step S3; When the RAID stripe is the area to be copied back, go to step S4.

3. The data protection method for RAID foreground IO and copyback in parallel as claimed in claim 1, characterized in that: The specific steps of step S2 are as follows: S21. Calculate the number of disks n that need to be written based on the data that needs to be written by the foreground IO; S22. Locate the i-th disk to which data needs to be written, calculate the write parameters of the i-th disk, and initialize the i-th disk to 0; S23. Writing data to the corresponding position of the copied-back area of ​​the i-th disk according to the calculated disk writing parameters; S24. Identify whether the i-th disk is a copy-back disk; If yes, go to step S25; If not, proceed to step S26; S25. Point the stripe of the i-th disk to the to-be-copied area, and use the calculated write disk parameters to write the same data to the corresponding position of the to-be-copied area; S26. Determine whether i is less than the number of disks to be written n; If yes, set i=i+1 and return to step S22; If not, the parallel writing of the foreground IO data to the copy-back disk and the data to be copied-back disk is completed, and the process ends.

4. The data protection method for RAID foreground IO and copyback in parallel as claimed in claim 3, characterized in that: The disk writing parameters in step S22 include the location of the data to be written in the memory, the starting location and length of the i-th disk to which the data is to be written.

5. The data protection method for RAID foreground IO and copyback in parallel as claimed in claim 1, characterized in that: The specific steps of step S3 are as follows: S31. Suspend the foreground IO that needs to write data; S32. Determine whether the RAID stripe to which the foreground IO belongs has entered the back-copy area; If yes, return to step S2; If not, return to step S31.

6. The data protection method for RAID foreground IO and copyback in parallel as claimed in claim 1, characterized in that: The specific steps of step S4 are as follows: S41. Calculate the number of disks n that need to be written based on the data that needs to be written by the foreground IO; S42. Locate the i-th disk to which data needs to be written, 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 to-be-copied area of ​​the RAID stripe of the i-th disk according to the calculated write parameters; S44. Determine whether i is less than the number of disks to be written n; If yes, set i=i+1 and return to step S42; If not, complete the foreground IO data writing.

7. The data protection method for RAID foreground IO and copyback in parallel as claimed in claim 3, characterized in that: The specific steps of step S5 are as follows: S51. When a failed disk occurs in the RAID, identify the RAID type and the number of failed disks; When the RAID type is RAID5, proceed to step S52; When the RAID type is RAID6, proceed to step S54; When the RAID type is RAID TP, go to step S56; S52. Determine whether the number of failed disks is greater than or equal to 2; If yes, go to step S58; If not, proceed to step S53; S53. Determine whether there is a failed back-copy disk; If yes, use the data in the to-be-copied area of ​​the copied disk to restore the copied disk, and then use the restored copied disk, the normal disk and the P check data block to restore the remaining faulty disk, and then end; If not, proceed to step S58; S54. Determine whether the number of failed disks is greater than 4; If yes, go to step S58; If not, proceed to step S55; S55. Determine whether there are less than or equal to two copy-back disk failures; If yes, use the data in the to-be-copied area of ​​the copied disk to restore the copied disk, and then use the restored copied disk and the normal disk in combination with the P check data block and the Q check data block to restore the remaining faulty disk, and then end; if no, proceed to step S58; S56. Determine whether the number of failed disks is greater than 6; If yes, go to step S58; If not, proceed to step S57; S57. Determine whether there are less than or equal to three copy-back disk failures; If yes, use the data in the to-be-copied area of ​​the copied disk to restore the copied disk, and then use the restored copied disk and the normal disk in combination with the P check data block, the Q check data block, and the R check data block to restore the remaining faulty disks, and then end; If not, proceed to step S58; S58. It is determined that the number of failures exceeds the limit and the failed disk cannot be recovered through RAID.

8. A RAID foreground IO and copyback parallel data protection system, characterized in that: include: RAID stripe identification module, used to identify the RAID stripe to which the foreground IO belongs when the foreground IO and RAID copyback are in parallel; The IO data parallel writing module is used to determine the location and size of the additional writing disk and the writing data according to the starting location and size of the writing data, the number of disks during copyback, and the location in the RAID when the RAID stripe to which it belongs is the copyback area, and perform copyback parallel data writing; The copy-back waiting module is used to suspend the foreground IO when the RAID stripe to which it belongs is in the copy-back area, until the RAID stripe to which it belongs enters the copy-back area; The IO data is normally written into the module, which is used when the RAID stripe to which it belongs is the area to be copied back, and the original foreground IO disk write process is used; The fault data recovery module starts fault recovery when a faulty disk appears in the RAID according to the RAID type, the number of faulty disks, and whether the faulty disk is a disk to be copied back.

9. An electronic device, characterized in that: including a processor and a memory; The memory is used to store a computer program, and the processor is used to call and run the computer program from the memory, so that the electronic device executes the method described in any one of claims 1 to 7.

10. A storage medium, characterized in that: The storage medium stores instructions, which, when executed on a computer, enable the computer to execute the method described in any one of claims 1 to 7.

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

  • Method and device for managing disks by storage system, and storage server

    CN110187841A

  • Disk array initialization method and system, electronic equipment and storage medium

    CN115098046A

  • Method, system and equipment for rapidly dropping RAID cache data into disk and storage medium

    CN116339630A

Cited By

  • Data writing method and device, electronic equipment and storage medium

    CN119847816A