Data recovery method, system and device based on RAID (Redundant Array of Independent Disks) and medium
By introducing vertical verification strips and M check bits in the RAID array, the accurate positioning and repair of the data consistency verification of RAID array is achieved, and the problem of insufficient data inconsistency repair capabilities in the existing technology is solved, and the improvement of the improvement of the problem of The reliability and security of data storage.
Patent Information
- Application Number
- CN202411301374.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-18
- Publication Date
- 2024-12-27
AI Technical Summary
The consistency verification task of existing RAID arrays cannot accurately locate and immediately fix the wrong data in the case of inconsistent striped data, resulting in insufficient data reliability.
Introduce vertical check strips and M check bits. By setting a fixed number of strips in the RAID array, the data of each vertical check strip is divided into the column. Vertical check bit, update the M check bit, and locate and fix erroneous data chunking through XOR calculation in the consistency check task.
It improves the accuracy of data consistency verification and data error repair capabilities of RAID arrays, enhances the reliability and security of data storage, and is suitable for RAID 5, RAID 6 and other RAID levels with check bits.
Smart Images

Figure CN119200986A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data storage, and more particularly to a data repair method, system, device and medium based on RAID. Background Art
[0002] RAID (Redundant Array of Independent Disks) is a method of combining multiple independent physical hard disks into a logical unit to improve the performance, reliability and capacity of data storage. RAID technology uses data stripes, mirrors and parity to achieve different storage goals. Its development has gone through RAID0, RAID1, RAID10, RAID5, RAID6 and other levels. Among them, RAID5 adds P check blocks to the disk array, and the data of a failed disk can be restored through the P check blocks; RAID6 adds Q check blocks to the disk array, and the data of two failed disks in the array can be restored by checking the P and Q check blocks. The implementation of RAID technology can be achieved through pure software RAID or hardware RAID, and the RAID controller is a dedicated hardware RAID device used to implement RAID technology to manage multiple hard disks. It is usually inserted on the computer motherboard or connected to the expansion slot of the motherboard. It has its own processor, memory and interface to implement RAID functions.
[0003] Currently, the common RAID controller devices in the industry have a data consistency check (Consistency Check) which is a common function used to ensure the data integrity and consistency process in the RAID array. It mainly detects and repairs data errors in advance, prevents data loss, and improves the reliability of the storage system by regularly or manually starting the consistency check (CC) task. When executing the consistency check task, the task management module inside the RAID card reads the original check value of a single stripe for each array as a single stripe, and then recalculates the check value through the data block of a single stripe. If the new check value is equal to the original check value, it is considered that there is no error in the data on the stripe and the data is consistent; otherwise, it is considered that the data on the stripe is inconsistent, and the inconsistent data information is first fed back to the upper-level user through an alarm. At the same time, the value of the array check block is forcibly updated to the new check value to ensure the consistency of the RAID stripe distribution and prevent the risk of subsequent data loss that cannot be recovered, so as to improve the reliability of the storage system.
[0004] However, the consistency check task of the above array is essentially to ensure the consistency of RAID stripe data at an early stage, so that in the event of data loss such as array disk loss or bad disk, the lost data can be restored through the consistent existing data. The existing consistency check task cannot accurately locate and immediately repair the wrong data when the stripe data is inconsistent to ensure data reliability. Summary of the invention
[0005] In view of the above problems, the purpose of the present invention is to provide a RAID-based data repair method, system, device and medium, which effectively improves the accuracy of data consistency verification and data error repair capability of the RAID array by introducing vertical check stripes and M check bits, and improves the reliability of RAID data storage.
[0006] In order to achieve the above object, the present invention is implemented through the following technical solutions: In a first aspect, the present invention discloses a RAID-based data repair method, comprising: In a RAID array, vertical parity stripes are set with a fixed number of stripes as units, and each data block of each vertical parity stripe is used as the vertical parity bit of the column, which is called the M parity bit; Receive the IO command from the host, and update the M check bit for the vertical check strip according to the IO command; When the consistency check task of the RAID array is started, in addition to the vertical check stripe, the original check value of each stripe is read, and then the new check value is calculated by the data block of the stripe; Determine whether the original check value is equal to the new check value; If they are not equal, the stripe data of the stripe is inconsistent, and the wrong data block is located according to the M check bit in the vertical check stripe of the unit to which the stripe belongs and other data blocks in the unit to which the stripe belongs; In the unit to which the stripe belongs, the correct block value is obtained by calculation using other data blocks in the column where the erroneous data block is located, so as to repair the erroneous data block.
[0007] Furthermore, in the RAID array, vertical check stripes are set with a fixed number of stripes as units, and each data block of each vertical check stripe is used as a vertical check bit of the column, which is called M check bit, including: In a RAID array, the RAID array is divided into units according to the stripe number, with N stripes as one unit; In each unit, the first N-1 stripes are used as data stripes, and the Nth stripe is used as a vertical check stripe; In each data stripe, there is a data block for storing horizontal check bits, called a check block; Each data block of the vertical check stripe is used to store the vertical check bit of the column, which is called the M check bit.
[0008] Further, the receiving IO command of the host and updating the M check bit for the vertical check strip according to the IO command comprises the following steps: S201: Receive host IO, parse host IO command IO start address SLBA and length NLB; S202: Calculate the stripe number SN where the IO is located and the starting block sequence number CNS of the stripe according to SLBA; S203: Calculate the end block number CNE of the stripe where the IO is located according to NLB; S204: Calculate the parity stripe number PSN to which the stripe belongs according to the stripe number SN; S205: Set variable i, and set the initial value of i to CNS; S206: according to the number of stripes N of each unit, sequentially read the data of the i-th data block of each stripe in the stripe number range of [PSN-N, PSN-1] to form N-1 groups of data; S207: Perform XOR calculation on N-1 groups of data to generate updated data; S208: writing the updated data into the i-th data block of the check stripe numbered PSN, and adding 1 to the value of i; S209: Determine whether i is greater than CNE; if so, end directly; if not, execute step S206. Furthermore, when the consistency check task of the RAID array is started, in addition to the vertical check stripe, the original check value of each stripe is read, and then a new check value is calculated by dividing the data blocks of the stripe, including: When the consistency check task of the RAID array is started, for each data stripe, the original check value P / Q is determined according to the value of its check block, and the value of each data block is obtained; A new check value P' / Q' is generated by performing an XOR calculation on the value of each data block.
[0009] Further, the determining whether the original check value is equal to the new check value includes: Determine whether P / Q = P' / Q'; If yes, the data consistency check of the stripe passes; If not, the data consistency check for the stripe identifies that the stripe data for the stripe is inconsistent and locks the stripe.
[0010] Further, locating the erroneous data block according to the M check bits in the vertical check strip of the unit to which the strip belongs and other data blocks in the unit to which the strip belongs comprises the following steps: S501: Obtain the current strip number X, and determine the number PX of the vertical check strip of the unit to which it belongs based on X; S502: Set variable h, h=1; S503: according to the number of stripes N of each unit, sequentially read the data of the hth data block of each stripe in the stripe number range [PX-N, PX-1] to form N-1 groups of data; S504: Perform XOR calculation on N-1 groups of data to generate a new vertical check value M'; S505: Read the i-th data block of the vertical check strip numbered PX to obtain an original vertical check value M; S506: Determine whether M=M'; if so, execute step S507; if not, execute step S508; S507: Add 1 to the value of h, and execute step S503; S508: The data of the hth data block of the stripe numbered X is wrong.
[0011] Further, in the unit to which the stripe belongs, using other data blocks in the column where the erroneous data block is located, obtaining a correct block value by calculation to repair the erroneous data block includes: In the stripes with stripe numbers ranging from [PX-N, PX], except for the stripe numbered X, data of the h-th data block of the other N-1 stripes are obtained to form N-1 groups of data; XOR calculation is performed on N-1 groups of data to generate the correct block value; Write the correct block value to the hth data block of the stripe numbered X to replace the erroneous data.
[0012] In a second aspect, the present invention further discloses a RAID-based data repair system, comprising: A vertical check stripe setting module is used to set vertical check stripes in a RAID array with a fixed number of stripes as units, and each data block of each vertical check stripe is used as a vertical check bit of the column, which is called an M check bit; A vertical check bit update module, used for receiving an IO command from a host, and updating an M check bit for a vertical check strip according to the IO command; The consistency check module is used to read the original check value of each stripe when the consistency check task of the RAID array is started, in addition to the vertical check stripe, and then calculate the new check value through the data blocks of the stripe; A judgment module is used to judge whether the original check value is equal to the new check value; A positioning module, used for locating an erroneous data block according to the M check bits in the vertical check strip of the unit to which the strip belongs and other data blocks in the unit to which the strip belongs, when the original check value is not equal to the new check value; The data repair module is used to repair the erroneous data block by calculating the correct block value using other data blocks in the column where the erroneous data block is located in the unit to which the strip belongs.
[0013] In a third aspect, the present invention further discloses a RAID-based data repair device, comprising: A memory for storing a RAID-based data repair program; A processor is used to implement the steps of the RAID-based data repair method as described in any one of the above items when executing the RAID-based data repair program.
[0014] In a fourth aspect, the present invention further discloses a readable storage medium, on which a RAID-based data repair program is stored. When the RAID-based data repair program is executed by a processor, the steps of the RAID-based data repair method as described in any of the above items are implemented.
[0015] Compared with the prior art, the present invention has the following beneficial effects: The present invention is based on the traditional RAID consistency check task mechanism, and increases vertical check bits to accurately locate the position of erroneous data blocks when stripe data is inconsistent, thereby improving the reliability of data storage by repairing erroneous data blocks with correct data blocks.
[0016] The present invention adds a vertical check bit mechanism during the RAID consistency check process to achieve the purpose of accurately locating and repairing erroneous data, thereby enhancing the characteristic principle of consistency check and improving product competitiveness.
[0017] The present invention optimizes the consistency check task by adding vertical check bits, which is not limited to RAID 5 arrays, but also applicable to RAID 6, RAID TP and other RAID levels with check bits (parity), and has strong versatility. In addition, the present invention is not limited to RAID controller devices, but also applicable to any storage solution that implements RAID technology, and the method has strong scalability.
[0018] The present invention effectively improves the data consistency and error repair capability of the RAID array by introducing vertical check strips and M check bits. The M check bits are updated in real time when data is written to ensure data integrity; during consistency check, the erroneous data blocks are quickly located by comparing the original and new check values, and the correct data is restored by XOR calculation using other data blocks, thereby achieving efficient and accurate data repair and enhancing the reliability and data security of the RAID system.
[0019] 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
[0020] 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, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0021] Figure 1 It is a method flow chart of a specific implementation mode of the present invention.
[0022] Figure 2 It is a schematic diagram of the vertical check bit writing process of a specific implementation mode of the present invention.
[0023] Figure 3 It is a schematic diagram of the locating process of erroneous data blocks according to a specific implementation manner of the present invention.
[0024] Figure 4 It is a flowchart of the array consistency check task execution according to a specific implementation mode of the present invention.
[0025] Figure 5 It is a schematic diagram of a RAID5 array according to a specific implementation mode of the present invention.
[0026] Figure 6 It is a system structure diagram of a specific implementation mode of the present invention.
[0027] Figure 7 It is a schematic diagram of the device structure in a specific implementation manner of the present invention.
[0028] In the figure, 1. vertical check strip setting module; 2. vertical check bit update module; 3. consistency check module; 4. judgment module; 5. positioning module; 6. data repair module; 101. processor; 102. memory; 103. input interface; 104. output interface; 105. communication unit; 106. keyboard; 107. display; 108. mouse. DETAILED DESCRIPTION
[0029] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used in the specification of the present invention herein are only for the purpose of describing specific embodiments and are not intended to limit the present invention.
[0030] The key terms appearing in the present invention are explained below.
[0031] RAID: Redundant Array of Independent Disks is a storage technology that combines multiple independent hard disks to form a logical single storage unit. According to different data protection strategies and data distribution methods, RAID technology can be divided into several different levels (RAID 0, RAID 1, RAID 5, RAID 6, RAID 10, etc.). Each level has its specific advantages and applicable scenarios. It is widely used in enterprise-level servers, storage systems, data centers and other environments to improve data reliability, performance and capacity.
[0032] RAID card: Also known as RAID controller, it is a dedicated hardware device used to implement RAID technology to manage multiple hard drives. RAID card is usually inserted into the computer motherboard or connected to the expansion slot of the motherboard. It has its own processor, memory and interface to implement RAID function.
[0033] Chunk: Also known as block, it is an important concept in RAID technology. It is to split the RAID array into blocks of fixed size according to LBA granularity, usually used as the basic unit of stripe.
[0034] Stripe: Also known as stripe, it is an important concept in RAID technology. It is a data storage and management method that distributes several data blocks (Chunks) in sequence on multiple storage devices that make up the RAID array to ensure data redundancy and improve data read and write performance.
[0035] LBA: It is the abbreviation of Logical Block Address, which is the logical address of the data sector (block) in the hard disk. Generally, the sector size of HDD disk is 512B, and the data block size of SSD disk is 4K. After the hard disks form a RAID array, the available capacity of the RAID array is calculated based on the hard disk capacity and RAID level, and then represented by LBA.
[0036] CC: Consistency Check is an important operation to ensure data integrity and consistency within the RAID array. It detects and corrects potential errors by verifying whether the data in the RAID array matches the check information.
[0037] In order to enable those skilled in the art to better understand the scheme of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0038] See also Figure 1 As shown, this embodiment provides a RAID-based data repair method, comprising the following steps: S1: In the RAID array, vertical check stripes are set with a fixed number of stripes as units, and each data block of each vertical check stripe is used as a vertical check bit of the column, which is called M check bit.
[0039] In a specific implementation, in a RAID array, according to the stripe number, the RAID array is divided into units with N stripes as one unit. In each unit, the first N-1 stripes are used as data stripes, and the Nth stripe is used as a vertical check stripe; in each data stripe, there is a data block for storing horizontal check bits, called a check block. In addition, each data block of the vertical check stripe is used to store the vertical check bit of the column in which it is located, called the M check bit.
[0040] S2: Receive an IO command from the host, and update the M check bit for the vertical check strip according to the IO command.
[0041] S3: When the consistency check task of the RAID array is started, in addition to the vertical check stripe, the original check value of each stripe is read, and then a new check value is calculated by dividing the data blocks of the stripe.
[0042] In a specific implementation, when the consistency check task of the RAID array is started, for each data stripe, the original check value P / Q is first determined based on the value of its check block, and the value of each data block is obtained; a new check value P' / Q' is generated by performing an XOR calculation on the value of each data block.
[0043] S4: Determine whether the original check value is equal to the new check value.
[0044] In a specific implementation, it is determined whether P / Q= P' / Q'; if so, the data consistency check of the stripe passes; if not, the data consistency check of the stripe identifies that the stripe data of the stripe is inconsistent, and the stripe is locked.
[0045] S5: If they are not equal, the stripe data of the stripe is inconsistent, and the wrong data block is located according to the M check bit in the vertical check stripe of the unit to which the stripe belongs and other data blocks in the unit to which the stripe belongs.
[0046] S6: In the unit to which the stripe belongs, the correct block value is obtained by calculation using other data blocks in the column where the erroneous data block is located, so as to repair the erroneous data block.
[0047] In a specific implementation, step S2 discloses a vertical check bit writing process, such as Figure 2 As shown, the specific steps are as follows: S201: Receive host IO, and parse the host IO command IO start address SLBA and length NLB.
[0048] S202: Calculate the stripe number SN where the IO is located and the starting block sequence number CNS of the stripe according to SLBA.
[0049] Specifically, the stripe number SN (Stripe Number) of the array where the IO is located and the chunk number CNS (Chunk Number Start) of the stripe are calculated according to the SLBA, which are used as the starting column of the vertical check bit to be updated.
[0050] S203: Calculate the end block number CNE of the stripe where the IO is located according to NLB.
[0051] Specifically, the end block number CNE (Chunk Number End) of the array stripe where the IO is located is calculated according to NLB, which is used as the end column of the vertical check bit to be updated.
[0052] S204: Calculate the parity stripe number PSN to which the stripe belongs according to the stripe number SN.
[0053] Specifically, the following method can be used to calculate the parity stripe number PSN (Parity Stripe Number) of the array where the IO is located according to the stripe number SN: Since the first stripe is numbered 0, every N stripes is a unit, and the Nth stripe in each unit is the test stripe number. Therefore, we can calculate the value of (SN+1) / N and round it up to an integer, which is recorded as L. Then PSN=N×L-1.
[0054] S205: Set a variable i, and set the initial value of i to CNS.
[0055] S206: According to the number of stripes N of each unit, the data of the i-th data block of each stripe in the stripe number range of [PSN-N, PSN-1] is read in sequence to form N-1 groups of data.
[0056] Specifically, according to a fixed number N (default 64), the data of the CNS-th data block on the array with a stripe number range of [PSN-N, PSN-1] (excluding the stripe number SN) is read in sequence to form a data group for which the vertical check bit is to be calculated.
[0057] S207: Perform XOR calculation on N-1 groups of data to generate updated data.
[0058] Specifically, N-1 groups of data are subjected to XOR calculation, and the calculation result is the vertical check value.
[0059] S208: Write the updated data into the i-th data block of the check stripe numbered PSN, and increase the value of i by 1.
[0060] Specifically, the vertical check value is written into the i-th data block of the check strip numbered PSN.
[0061] S209: Determine whether i is greater than CNE; if so, end directly; if not, execute step S206. In a specific implementation, the step S5 discloses a process for locating an erroneous data block, such as Figure 3 As shown, the specific steps include: S501: Obtain the current strip number X, and determine the number PX of the vertical check strip of the corresponding unit based on X.
[0062] If the current stripe number is X, the value of (X+1) / N can be calculated and rounded up to be L, and then the number of the longitudinal parity stripe of the unit to which the stripe numbered X belongs is PX=N×L-1.
[0063] S502: Set variable h, h=1.
[0064] S503: According to the number of stripes N of each unit, the data of the hth data block of each stripe in the stripe number range of [PX-N, PX-1] is read in sequence to form N-1 groups of data.
[0065] S504: Perform XOR calculation on N-1 groups of data to generate a new vertical check value M'.
[0066] S505: Read the i-th data block of the vertical check strip numbered PX to obtain the original vertical check value M.
[0067] S506: Determine whether M=M'; if so, execute step S507; if not, execute step S508.
[0068] S507: Add 1 to the value of h, and execute step S503.
[0069] S508: The data of the hth data block of the stripe numbered X is wrong.
[0070] In a specific implementation, step S6 implements data repair of erroneous data blocks using vertical check strips. Since step S5 has established the data error of the hth data block of the stripe numbered X, the longitudinal check stripe of the unit to which the stripe numbered X belongs is numbered PX. In this step, first, in the stripes with a stripe number range of [PX-N, PX], except for the stripe numbered X, the data of the hth data block of the other N-1 stripes are obtained respectively to form N-1 groups of data; then the N-1 groups of data are XORed to generate the correct block value; finally, the correct block value is written to the hth data block of the stripe numbered X to replace the erroneous data.
[0071] In a specific implementation, steps S3 to S6 disclose an array consistency check task execution process, such as Figure 4 As shown, the specific steps include: 1. Starting from stripe No. 0 of the array, read all the block data in the stripe, obtain the original check value P / Q, and recalculate the check value P' / Q' based on the data blocks; 2. If the original checksum P / Q is equal to the newly calculated checksum P' / Q', the data in the stripe is considered to be consistent, and the next stripe is read; 3. If the original checksum P / Q is not equal to the newly calculated checksum P' / Q', it is considered that the stripe data is inconsistent, and the stripe is locked (to avoid read and write errors caused by mutual exclusion with other IOs); 4. Enter the data segmentation process for locating errors: 1) According to the data inconsistent strip number X, calculate the strip number PX of the vertical check strip to which the strip belongs; 2) Starting from the first block number of the stripe, read the data of each column of blocks in the stripe number range [PX-N, PX-1] (including inconsistent stripe number X) on the array in sequence according to a fixed number N (default 64) to form the data blocks for which the vertical check bit is to be calculated; 3) Calculate a new vertical check value M' according to the data blocks to be calculated; 4) Read the column block corresponding to the PX-numbered strip to obtain the original vertical check value M; 5) If M is equal to M', the block is considered correct, and the calculation of the next block continues, and then continue with step 2); 6) If M is not equal to M', it is considered that an error has occurred in the block, and the error block has been located, and the process of locating the error data block is exited; 5. Enter the error data block repair process: 1) According to step 4, the stripe number X of the array where the error data block is located and the sequence number Y of the error block in stripe X are obtained; 2) Perform an XOR operation on the correct data block on stripe number X and the original check value P / Q to obtain the correct data block value, and write it into the Yth sequence number position in stripe X. At this point, the error data repair is completed, and the error data block repair process is exited; 6. After the inconsistent stripe is repaired, the stripe is unlocked and the next array stripe is read to obtain the original check value P / Q. The check value P' / Q' is recalculated based on the data blocks. Step 2 / Step 3 are repeated until all stripes on the array are checked and the process ends.
[0072] In order to better illustrate the above RAID-based data repair method, in a specific implementation manner, Figure 5 Taking 5 disks forming a RAID5 array as an example, a RAID-based data repair method is provided, as follows: See also Figure 5 As can be seen from the disclosed RAID5 array diagram, 5 disks form a RAID5 array, and a vertical parity stripe is set with a fixed unit of 4 (i.e. Figure 5 In the figure, Stripe (4) and Stripe (9) are vertical check stripes. The check bits are calculated by dividing the data into stripes (Stripe (0), Stripe (1), Stripe (2), Stripe (3), Stripe (5), ..., Stripe (8)) horizontally, where D(N) is the data block and P(N) is the check block. P(N) is obtained by XOR calculation with D(N), which is called P check bit or horizontal check bit. The check bits are calculated by dividing the data into check stripes (Stripe (4) and Stripe (9)) vertically according to the columns where the blocks in each check stripe are located (taking check stripe (4) as an example, where column 0 has D(0), D(4), D(8), and D(12) as the vertical data blocks to be calculated, and M00 is the check block). M(XY) is obtained by XOR calculation with the vertical data blocks, which is called M check bit or vertical check bit.
[0073] Assume that an error occurs in data block D(6) in Stripe(1). When the array starts the CC task, it starts reading all the data on stripe 0 (Stripe0) (D(0), D(1), D(2), D(3), P(0)), obtains the original check bit P0, and then recalculates the P check bit through the data blocks (D(0), D(1), D(2), D(3)), recorded as P0'. Because P0' is equal to P0, it is considered that stripe 0 (Stripe0) is consistent, and the consistency check of the next stripe (Stripe1) is continued. The same method is used to determine that P1' is not equal to P1, and it is considered that the data of this stripe (Stripe1) is inconsistent. At this time, locate the erroneous data and repair it according to the following steps: Step 1: Calculate according to the fixed unit 4 that the vertical check stripe to which the inconsistent stripe 1 (Stripe1) belongs is stripe 4 (Stripe4), and read all the original vertical check bits (M00, M01, M02, M03, M04) on stripe 4 (Stripe4).
[0074] Step 2: Starting from column 0, read the data blocks (D(0), D(4), D(8), D(12)) of the column where the original vertical check bit is located, and obtain the new vertical check bit M00' of column 0 by XOR calculation. Judge that M00 is equal to M00', and consider D(4) to be the correct data. Continue to compare the vertical check bits of the next column until the new vertical check bit M02' of column 2 is obtained by XOR calculation based on the data blocks (D(2), D(6), P(2), D(13)) of column 2. Judge that M02 is not equal to M02', and consider D(6) to be the wrong data, thereby accurately locating the wrong data block; Step 3: The correct D(6)' is obtained by XOR calculation of the correct blocks (D(4), D(5), P(1), D(7)) of Stripe 1 (Stripe0), and D(6) is updated to D(6)'. At this time, Stripe 1 (Stripe1) achieves the purpose of data block repair through the CC task.
[0075] In summary, the present invention provides a data repair method based on RAID, by adding vertical check bits, a vertical check stripe (parity stripe) is set with a fixed number of stripes as a unit, and each block of the check stripe (parity stripe) is a vertical check bit of the column, which is called M check bit or vertical check bit. When the CC task is started and the stripe data is found to be inconsistent, the specific erroneous data block (data chunk) is located by the vertical check bit, and then the erroneous data is repaired by the correct data block (data chunk) of the stripe and the original horizontal check bit (parity chunk). This method not only maintains the original action mechanism of the CC task, but also ensures the consistency of the RAID stripe data earlier, so that in the subsequent scenarios of data loss such as array disk drop, bad disk, etc., the lost data can be restored through consistent existing data, and it is intended to overcome the situation when CC finds that the stripe data is inconsistent and accurately locates and immediately repairs the erroneous data, and further enhances the characteristic mechanism of the CC task to improve the reliability of the data.
[0076] See also Figure 6 As shown, the present invention also discloses a RAID-based data repair system, including: a vertical check stripe setting module 1, a vertical check bit update module 2, a consistency check module 3, a judgment module 4, a positioning module 5 and a data repair module 6. The vertical check stripe setting module 1 is used to set vertical check stripes in a RAID array with a fixed number of stripes as units, and use each data block of each vertical check stripe as a vertical check bit of the column, which is called M check bit.
[0077] The vertical check bit updating module 2 is used to receive an IO command from the host and update the M check bit for the vertical check strip according to the IO command.
[0078] The consistency check module 3 is used to read the original check value of each stripe when the consistency check task of the RAID array is started, in addition to the vertical check stripe, and then calculate the new check value through the data blocks of the stripe.
[0079] The judgment module 4 is used to judge whether the original check value is equal to the new check value.
[0080] The positioning module 5 is used to locate the wrong data block according to the M check bits in the vertical check strip of the unit to which the strip belongs and other data blocks in the unit to which the strip belongs when the original check value is not equal to the new check value.
[0081] The data repair module 6 is used to repair the erroneous data block by calculating the correct block value using other data blocks in the column where the erroneous data block is located in the unit to which the stripe belongs.
[0082] The specific implementation of the RAID-based data repair system of this embodiment is basically the same as the specific implementation of the RAID-based data repair method described above, and will not be repeated here.
[0083] See also Figure 7 As shown, the present invention also discloses a RAID-based data repair device, including a processor 101 and a memory 102; wherein, when the processor 101 executes the RAID-based data repair program stored in the memory, the steps of the RAID-based data repair method as described in any one of the above items are implemented.
[0084] The RAID-based data repair device provided in this embodiment may include but is not limited to a smart phone, a tablet computer, a laptop computer, or a desktop computer.
[0085] Among them, the processor 101 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 101 can be implemented in at least one hardware form of a digital signal processor (DSP), a field-programmable gate array (FPGA), and a programmable logic array (PLA). The processor 101 may also include a main processor and a coprocessor. The main processor is a processor for processing data in an awake state, also known as a central processing unit (CPU); the coprocessor is a low-power processor for processing data in a standby state. In some embodiments, the processor 101 may be integrated with a graphics processing unit (GPU), and the GPU is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 101 may also include an artificial intelligence (AI) processor, which is used to process computing operations related to machine learning.
[0086] The memory 102 may include one or more computer-readable storage media, which may be non-transitory. The memory 102 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In this embodiment, the memory 102 is at least used to store the following computer program, wherein, after the computer program is loaded and executed by the processor 101, the relevant steps of the RAID-based data repair method disclosed in any of the aforementioned embodiments can be implemented. In addition, the resources stored in the memory 102 may also include an operating system and data, etc., and the storage method may be temporary storage or permanent storage. Among them, the operating system may include Windows, Unix, Linux, etc. The data may include, but is not limited to, the data involved in the above-mentioned RAID-based data repair method, etc.
[0087] Furthermore, the RAID-based data repair device in this embodiment may also include: The input interface 103 is used to obtain the RAID-based data repair program imported from the outside, and save the obtained RAID-based data repair program to the memory 102. It can also be used to obtain various instructions and parameters transmitted by external terminal devices, and transmit them to the processor 101, so that the processor 101 can use the above various instructions and parameters to carry out corresponding processing. In this embodiment, the input interface 103 can specifically include but is not limited to a USB interface, a serial interface, a voice input interface, a fingerprint input interface, a hard disk reading interface, etc.
[0088] The output interface 104 is used to output various data generated by the processor 101 to a terminal device connected thereto, so that other terminal devices connected to the output interface can obtain various data generated by the processor 101. In this embodiment, the output interface 104 may specifically include but is not limited to a USB interface, a serial interface, and the like.
[0089] The communication unit 105 is used to establish a remote communication connection between the server operation service optimization configuration device and the external server, so that the RAID-based data repair device can mount the image file to the external server. In this embodiment, the communication unit 105 may specifically include but is not limited to a remote communication unit based on wireless communication technology or wired communication technology.
[0090] The keyboard 106 is used to obtain various parameter data or instructions input by the user by tapping the keycaps in real time.
[0091] The display 107 is used to display relevant information of the RAID-based data repair process in real time.
[0092] The mouse 108 can be used to assist the user in inputting data and simplify the user's operation.
[0093] The present invention also discloses a readable storage medium, wherein the readable storage medium includes a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable hard disk, a CD-ROM, or any other form of storage medium known in the technical field. The readable storage medium stores a RAID-based data repair program, and when the RAID-based data repair program is executed by a processor, the steps of the RAID-based data repair method described in any one of the above items are implemented.
[0094] In summary, the present invention effectively improves the accuracy of data consistency check and data error repair capability of the RAID array by introducing the vertical check stripe and the M check bit, thereby improving the reliability of RAID data storage.
[0095] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. As for the method disclosed in the embodiment, since it corresponds to the system disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0096] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0097] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, systems and methods can be implemented in other ways. For example, the system embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of systems or units, which can be electrical, mechanical or other forms.
[0098] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0099] In addition, each functional module in each embodiment of the present invention may be integrated into one processing unit, or each module may exist physically separately, or two or more modules may be integrated into one unit.
[0100] Similarly, each processing unit in each embodiment of the present invention may be integrated into one functional module, or each processing unit may exist physically, or two or more processing units may be integrated into one functional module.
[0101] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0102] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0103] The above is a detailed introduction to the RAID-based data repair method, system, device and readable storage medium provided by the present invention. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present invention, the present invention can also be improved and modified in a number of ways, and these improvements and modifications also fall within the scope of protection of the claims of the present invention.
Claims
1. A data repair method based on RAID, characterized in that: include: In a RAID array, vertical parity stripes are set with a fixed number of stripes as units, and each data block of each vertical parity stripe is used as the vertical parity bit of the column, which is called the M parity bit; Receive the IO command from the host, and update the M check bit for the vertical check strip according to the IO command; When the consistency check task of the RAID array is started, in addition to the vertical check stripe, the original check value of each stripe is read, and then the new check value is calculated by the data block of the stripe; Determine whether the original check value is equal to the new check value; If they are not equal, the stripe data of the stripe is inconsistent, and the wrong data block is located according to the M check bit in the vertical check stripe of the unit to which the stripe belongs and other data blocks in the unit to which the stripe belongs; In the unit to which the stripe belongs, the correct block value is obtained by calculation using other data blocks in the column where the erroneous data block is located, so as to repair the erroneous data block.
2. The RAID-based data repair method according to claim 1, characterized in that: In the RAID array, vertical check stripes are set with a fixed number of stripes as units, and each data block of each vertical check stripe is used as a vertical check bit of the column, which is called M check bit, including: In a RAID array, the RAID array is divided into units according to the stripe number, with N stripes as one unit; In each unit, the first N-1 stripes are used as data stripes, and the Nth stripe is used as a vertical check stripe; In each data stripe, there is a data block for storing horizontal check bits, called a check block; Each data block of the vertical check stripe is used to store the vertical check bit of the column, which is called the M check bit.
3. The RAID-based data repair method according to claim 2, characterized in that: The receiving IO command of the host and updating the M check bit for the vertical check strip according to the IO command comprises the following steps: S201: Receive host IO, parse host IO command IO start address SLBA and length NLB; S202: Calculate the stripe number SN where the IO is located and the starting block sequence number CNS of the stripe according to SLBA; S203: Calculate the end block number CNE of the stripe where the IO is located according to NLB; S204: Calculate the parity stripe number PSN to which the stripe belongs according to the stripe number SN; S205: Set a variable i, and set the initial value of i to CNS; S206: according to the number of stripes N of each unit, sequentially read the data of the i-th data block of each stripe in the stripe number range of [PSN-N, PSN-1] to form N-1 groups of data; S207: Perform XOR calculation on N-1 groups of data to generate updated data; S208: writing the updated data into the i-th data block of the check stripe numbered PSN, and adding 1 to the value of i; S209: Determine whether i is greater than CNE; if so, end directly; if not, execute step S206.
4. The RAID-based data repair method according to claim 2, characterized in that: When the consistency check task of the RAID array is started, in addition to the vertical check stripe, the original check value of each stripe is read, and then a new check value is calculated by dividing the data blocks of the stripe, including: When the consistency check task of the RAID array is started, for each data stripe, the original check value P / Q is determined according to the value of its check block, and the value of each data block is obtained; A new check value P' / Q' is generated by performing an XOR calculation on the value of each data block.
5. The RAID-based data repair method according to claim 4, characterized in that: The determining whether the original check value is equal to the new check value includes: Determine whether P / Q = P' / Q'; If yes, the data consistency check of the stripe passes; If not, the data consistency check for the stripe identifies that the stripe data for the stripe is inconsistent and locks the stripe.
6. The RAID-based data repair method according to claim 5, characterized in that: The method of locating an erroneous data block according to the M check bits in the vertical check strip of the unit to which the strip belongs and other data blocks in the unit to which the strip belongs comprises the following steps: S501: Obtain the current strip number X, and determine the number PX of the vertical check strip of the unit to which it belongs based on X; S502: Set variable h, h=1; S503: according to the number of stripes N of each unit, sequentially read the data of the hth data block of each stripe in the stripe number range [PX-N, PX-1] to form N-1 groups of data; S504: Perform XOR calculation on N-1 groups of data to generate a new vertical check value M'; S505: Read the i-th data block of the vertical check strip numbered PX to obtain an original vertical check value M; S506: Determine whether M=M'; if so, execute step S507; if not, execute step S508; S507: Add 1 to the value of h, and execute step S503; S508: The data of the hth data block of the stripe numbered X is wrong.
7. The RAID-based data repair method according to claim 6, characterized in that: The method of repairing the erroneous data block by calculating the correct block value in the unit to which the stripe belongs using other data blocks in the column where the erroneous data block is located includes: In the stripes with stripe numbers ranging from [PX-N, PX], except for the stripe numbered X, data of the h-th data block of the other N-1 stripes are obtained to form N-1 groups of data; XOR calculation is performed on N-1 groups of data to generate the correct block value; Write the correct block value to the hth data block of the stripe numbered X to replace the erroneous data.
8. A RAID-based data repair system, characterized in that: The system adopts the RAID-based data repair method according to any one of claims 1 to 7, and the system comprises: A vertical check stripe setting module is used to set vertical check stripes in a RAID array with a fixed number of stripes as units, and each data block of each vertical check stripe is used as a vertical check bit of the column, which is called an M check bit; A vertical check bit update module, used for receiving an IO command from a host, and updating an M check bit for a vertical check strip according to the IO command; The consistency check module is used to read the original check value of each stripe when the consistency check task of the RAID array is started, in addition to the vertical check stripe, and then calculate the new check value through the data blocks of the stripe; A judgment module is used to judge whether the original check value is equal to the new check value; A positioning module, used for locating an erroneous data block according to the M check bits in the vertical check strip of the unit to which the strip belongs and other data blocks in the unit to which the strip belongs, when the original check value is not equal to the new check value; The data repair module is used to repair the erroneous data block by calculating the correct block value using other data blocks in the column where the erroneous data block is located in the unit to which the strip belongs.
9. A data repair device based on RAID, characterized in that: include: A memory for storing a RAID-based data repair program; A processor, configured to implement the steps of the RAID-based data repair method as described in any one of claims 1 to 7 when executing the RAID-based data repair program.
10. A readable storage medium, characterized in that: The readable storage medium stores a RAID-based data repair program, and when the RAID-based data repair program is executed by a processor, the steps of the RAID-based data repair method according to any one of claims 1 to 7 are implemented.
