A data storage method, system, device, and storage medium
Patent Information
- Application Number
- CN202311246722.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-26
- Publication Date
- 2026-10-23
- Estimated Expiration
- 2043-09-26
AI Technical Summary
但是这种磁盘重构方法重建效率很低,尤其是大容量的磁盘阵列,重构需要大量的时间
[0038]本发明具有以下有益技术效果之一:本发明提出的方案构建子RAID阵列,将数据只写入到子RAID阵列中,其他条带保持初始全零状态,这样划分空间只向子RAID阵列写入数据的方式,合理的解决了磁盘阵列写入地址不清晰的问题,当发生重构时,仅需要对子RAID阵列部分进行重构,大大提高重构效率的同时,也保证了重构数据的完整性。
Smart Images

Figure CN117251113B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of storage, and more specifically to a data storage method, system, device, and storage medium. Background Technology
[0002] A RAID array consists of many independent hard drives combined into a large-capacity disk group, leveraging the additive effect of data transmission from each drive to improve overall disk performance. The process of recovering data stored on the RAID platform after a disk failure is called RAID refactoring.
[0003] Currently, the traditional disk array reconstruction method involves replacing a failed disk with an idle disk when a normally functioning disk fails, and then reading data from other disks to recover the contents of the failed disk. However, this disk reconstruction method is very inefficient, especially for large-capacity disk arrays, and reconstruction requires a significant amount of time. Summary of the Invention
[0004] In view of this, in order to overcome at least one aspect of the above-mentioned problems, embodiments of the present invention propose a data storage method, comprising the following steps:
[0005] Multiple stripes are constructed using multiple disks, and each RAID stripe is initialized to zero.
[0006] Several RAID stripes are selected from the plurality of RAID stripes to form a sub-RAID array and the sub-RAID array is used for data storage, while the remaining RAID stripes are used as spare stripes and kept in a zero state;
[0007] In response to the detection of the disk failure, the data of the sub-RAID array is reconstructed using a hot spare disk.
[0008] In some embodiments, selecting a plurality of RAID stripes from the plurality of RAID stripes to form a sub-RAID array and using the sub-RAID array for data storage, while the remaining RAID stripes are used as spare stripes and kept in a zero state, further includes:
[0009] In response to receiving an instruction to create the sub-RAID array, the number of RAID stripes to be selected is determined according to the instruction;
[0010] Compare the current number of spare stripes with the number of RAID stripes to be selected;
[0011] In response to the fact that the number of available spare stripes is less than the number of RAID stripes to be selected, the utilization rate of the other sub-RAID arrays is determined;
[0012] Reclaim multiple RAID stripes from other sub-RAID arrays whose utilization is less than the threshold and set them to zero;
[0013] The recovered, zeroed stripes and the currently reserved stripes are used together to create the sub-RAID array.
[0014] In some embodiments, constructing multiple stripes using multiple disks and initializing each RAID stripe to zero further includes:
[0015] Divide each disk into multiple blocks;
[0016] All the disk blocks in the same location are grouped into a stripe and each stripe is numbered;
[0017] Record the stripe number to which each block on each disk belongs.
[0018] In some embodiments, selecting a plurality of RAID stripes from the plurality of RAID stripes to form a sub-RAID array and using the sub-RAID array for data storage further includes:
[0019] Record the number of each RAID stripe constituting the sub-RAID array and set the preset flag position of each RAID stripe constituting the sub-RAID array to a first preset value.
[0020] In some embodiments, it also includes:
[0021] In response to detecting that the utilization rate of the sub-RAID array is less than a threshold, the RAID stripes in the sub-RAID array are recycled;
[0022] The recovered RAID stripe is set to zero, and the preset flag is set to the second preset value.
[0023] In some embodiments, it also includes:
[0024] In response to detecting that the utilization rate of the sub-RAID array is greater than a threshold, the sub-RAID array is expanded using the spare stripe;
[0025] Update the RAID stripe numbers included in the sub-RAID array.
[0026] In some embodiments, in response to detecting the disk failure, data reconstruction of the sub-RAID array using a hot spare disk further includes:
[0027] Obtain all currently used sub-RAID arrays to determine the numbers of all currently used RAID stripes;
[0028] The blocks used on the faulty disk are determined based on the numbers of all currently used RAID stripes;
[0029] The hot spare disk is divided into multiple blocks, and the corresponding RAID stripe is reconstructed using the blocks on the hot spare disk that are in the same position as the blocks used in the failed disk. The remaining blocks are initialized to zero and then added to the corresponding spare stripe.
[0030] Based on the same inventive concept, according to another aspect of the present invention, embodiments of the present invention also provide a data storage system, comprising:
[0031] The first construction module is configured to construct multiple stripes using multiple disks and initialize each RAID stripe to zero.
[0032] The second construction module is configured to select several RAID stripes from the plurality of RAID stripes to form a sub-RAID array and use the sub-RAID array for data storage, while the remaining RAID stripes are used as spare stripes and kept in a zero state.
[0033] The reconstruction module is configured to reconstruct the data of the sub-RAID array using a hot spare disk in response to the detection of the disk failure.
[0034] Based on the same inventive concept, according to another aspect of the present invention, embodiments of the present invention also provide a computer device, comprising:
[0035] At least one processor; and
[0036] A memory that stores a computer program that can run on the processor, wherein the processor executes the program and performs the steps of any of the data storage methods described above.
[0037] Based on the same inventive concept, according to another aspect of the present invention, embodiments of the present invention also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the steps of any of the data storage methods described above.
[0038] The present invention has one of the following beneficial technical effects: The proposed solution constructs a sub-RAID array, and writes data only to the sub-RAID array, while keeping other stripes in an initial all-zero state. This method of dividing space and writing data only to the sub-RAID array reasonably solves the problem of unclear disk array write addresses. When reconstruction occurs, only the sub-RAID array needs to be reconstructed, which greatly improves reconstruction efficiency and ensures the integrity of the reconstructed data. Attached Figure Description
[0039] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other embodiments can be obtained based on these drawings without creative effort.
[0040] Figure 1 A flowchart illustrating a data storage method provided in an embodiment of the present invention;
[0041] Figure 2 A schematic diagram of the data storage system provided for an embodiment of the present invention;
[0042] Figure 3 A schematic diagram of the structure of a computer device provided for an embodiment of the present invention;
[0043] Figure 4 A schematic diagram of the structure of a computer-readable storage medium provided for an embodiment of the present invention. Detailed Implementation
[0044] To make the objectives, technical solutions, and advantages of the present invention clearer, the embodiments of the present invention will be further described in detail below with reference to specific examples and the accompanying drawings.
[0045] It should be noted that all uses of "first" and "second" in the embodiments of the present invention are for the purpose of distinguishing two entities or parameters with the same name but different names. It is clear that "first" and "second" are only for the convenience of expression and should not be construed as limiting the embodiments of the present invention. Subsequent embodiments will not explain this in detail.
[0046] According to one aspect of the present invention, embodiments of the present invention provide a data storage method, such as... Figure 1 As shown, it may include the following steps:
[0047] S1, construct multiple stripes using multiple disks and initialize each RAID stripe to zero;
[0048] S2, select several RAID stripes from the plurality of RAID stripes to form a sub-RAID array and use the sub-RAID array for data storage, and use the remaining RAID stripes as spare stripes and keep them in a zero state;
[0049] S3, in response to the detection of the disk failure, the data reconstruction of the sub-RAID array is performed using the hot spare disk.
[0050] The proposed solution constructs a sub-RAID array, writing data only to the sub-RAID array while keeping other stripes in an initial all-zero state. This method of dividing space and writing data only to the sub-RAID array effectively solves the problem of unclear disk array write addresses. When reconstruction occurs, only the sub-RAID array needs to be reconstructed, greatly improving reconstruction efficiency while ensuring the integrity of the reconstructed data.
[0051] In some embodiments, selecting a plurality of RAID stripes from the plurality of RAID stripes to form a sub-RAID array and using the sub-RAID array for data storage, while the remaining RAID stripes are used as spare stripes and kept in a zero state, further includes:
[0052] In response to receiving an instruction to create the sub-RAID array, the number of RAID stripes to be selected is determined according to the instruction;
[0053] Compare the current number of spare stripes with the number of RAID stripes to be selected;
[0054] In response to the fact that the number of available spare stripes is less than the number of RAID stripes to be selected, the utilization rate of the other sub-RAID arrays is determined;
[0055] Reclaim multiple RAID stripes from other sub-RAID arrays whose utilization is less than the threshold and set them to zero;
[0056] The recovered, zeroed stripes and the currently reserved stripes are used together to create the sub-RAID array.
[0057] Specifically, multiple sub-RAID arrays can exist simultaneously. When creating a new sub-RAID array, if the current number of RAID stripes is less than the required number of RAID stripes, it can be determined whether there are any sub-RAID arrays with utilization below a threshold among the currently created sub-RAID arrays. If so, multiple RAID stripes are reclaimed from the sub-RAID arrays with utilization below the threshold and zeroed out. Then, the reclaimed and zeroed stripes, along with the currently reserved stripes, are used to create a new sub-RAID array. If no such sub-RAID array exists, a report of insufficient resources is directly provided.
[0058] In some embodiments, constructing multiple stripes using multiple disks and initializing each RAID stripe to zero further includes:
[0059] Divide each disk into multiple blocks;
[0060] All the disk blocks in the same location are grouped into a stripe and each stripe is numbered;
[0061] Record the stripe number to which each block on each disk belongs.
[0062] Specifically, a hard drive is divided into multiple blocks of equal size and adjacent addresses. These blocks are called slices, and slices are the elements that make up a stripe. Slices at the same "location" or with the same number on multiple disk drives in the same disk array constitute a stripe. The disk's metadata records the stripe number to which each slice belongs.
[0063] Sub-RAID arrays can use the XOR parity algorithm for data storage, therefore the disks can be divided into data disks for storing data, parity disks for storing parity data, and hot spare disks.
[0064] In some embodiments, selecting a plurality of RAID stripes from the plurality of RAID stripes to form a sub-RAID array and using the sub-RAID array for data storage further includes:
[0065] Record the number of each RAID stripe constituting the sub-RAID array and set the preset flag position of each RAID stripe constituting the sub-RAID array to a first preset value.
[0066] Specifically, a preset flag can be set for a RAID stripe. When a RAID stripe is used to build a sub-RAID array, the preset flag is set to the first preset value, indicating that the RAID stripe has been used. It can also be distinguished from spare stripes through the preset flag, so that spare stripes can be selected more quickly when creating other sub-RAID arrays.
[0067] In some embodiments, it also includes:
[0068] In response to detecting that the utilization rate of the sub-RAID array is less than a threshold, the RAID stripes in the sub-RAID array are recycled;
[0069] The recovered RAID stripe is set to zero, and the preset flag is set to the second preset value.
[0070] In some embodiments, it also includes:
[0071] In response to detecting that the utilization rate of the sub-RAID array is greater than a threshold, the sub-RAID array is expanded using the spare stripe;
[0072] Update the RAID stripe numbers included in the sub-RAID array.
[0073] Specifically, in the use of sub-RAID arrays, considering the changes in business needs, it is necessary to expand or shrink the sub-RAID array. Since the sub-RAID array is a logical concept, it has better scalability. Expansion and shrinkage thresholds can be set for the sub-RAID array. When the sub-RAID array reaches its upper limit, it is expanded, for example, when the remaining space is less than 5%, with a preset number of spare stripes added each time. When the business demand decreases due to factors such as service migration, the sub-pool capacity is shrunk when it falls below the lower limit, for example, when the remaining space is greater than 50%, with a preset number of RAID stripes removed each time. Simultaneously, the RAID stripes that have been shrunk and recycled are reset to zero through the initialization module, and the recycled RAID stripes are then returned to the storage pool as spare strips.
[0074] In some embodiments, in response to detecting the disk failure, data reconstruction of the sub-RAID array using a hot spare disk further includes:
[0075] Obtain all currently used sub-RAID arrays to determine the numbers of all currently used RAID stripes;
[0076] The blocks used on the faulty disk are determined based on the numbers of all currently used RAID stripes;
[0077] The hot spare disk is divided into multiple blocks, and the corresponding RAID stripe is reconstructed using the blocks on the hot spare disk that are in the same position as the blocks used in the failed disk. The remaining blocks are initialized to zero and then added to the corresponding spare stripe.
[0078] Specifically, hard drive failure is a common problem during the use of sub-RAID arrays. The reconstruction module can recover the contents of a failed disk using the contents of a working disk after a disk failure, write the recovered content to a hot spare disk, and replace the failed disk with a spare disk, ensuring normal business operation. Therefore, reasonable optimization of the reconstruction module is of great significance. When a hard drive failure occurs, the reconstruction module receives a hard drive failure event from the storage and initiates a fast reconstruction module. It uses an XOR algorithm to restore the blocks of the failed disk to blocks on the hot spare disk, and then uses the hot spare disk to replace the failed disk, thus ensuring data integrity. Since only some blocks on the failed disk are in use, it is only necessary to obtain all the currently used sub-RAID arrays to determine the numbers of all currently used RAID stripes. Based on the numbers of all currently used RAID stripes, the blocks used on the failed disk are determined. Then, the blocks on the hot spare disk that are in the same position as the used blocks on the failed disk are used to reconstruct the corresponding RAID stripes. The remaining blocks on the failed disk are not used externally, so the remaining blocks from the hot spare only need to be initialized to zero and added to the corresponding spare stripe.
[0079] Because there are many stripes in a storage pool, often hundreds of thousands or even millions, marking each stripe would severely impact business operations. Therefore, the solution proposed in this invention does not distinguish between spare stripes in the storage pool. Instead, it only uses a portion of the RAID stripes that constitute the sub-RAID array for data storage, while keeping the remaining stripes in a state of all zeros. This way, the space that needs to be reconstructed is only the sub-RAID array. Since the remaining stripes are already initialized to all zeros, no data changes are made to the spare disks or spare stripes. This reduces the process of detecting and calculating these stripes, thereby reducing the space that needs to be reconstructed and improving reconstruction efficiency.
[0080] Based on the same inventive concept, according to another aspect of the present invention, embodiments of the present invention also provide a data storage system 400, such as... Figure 2 As shown, it includes:
[0081] The first construction module 401 is configured to construct multiple stripes using multiple disks and initialize each RAID stripe to zero.
[0082] The second construction module 402 is configured to select several RAID stripes from the plurality of RAID stripes to form a sub-RAID array and use the sub-RAID array for data storage, while the remaining RAID stripes are used as spare stripes and kept in a zero state.
[0083] The reconstruction module 403 is configured to reconstruct the data of the sub-RAID array using a hot spare disk in response to the detection of the disk failure.
[0084] In some embodiments, the second building module 402 is further configured to:
[0085] In response to receiving an instruction to create the sub-RAID array, the number of RAID stripes to be selected is determined according to the instruction;
[0086] Compare the current number of spare stripes with the number of RAID stripes to be selected;
[0087] In response to the fact that the number of available spare stripes is less than the number of RAID stripes to be selected, the utilization rate of the other sub-RAID arrays is determined;
[0088] Reclaim multiple RAID stripes from other sub-RAID arrays whose utilization is less than the threshold and set them to zero;
[0089] The recovered, zeroed stripes and the currently reserved stripes are used together to create the sub-RAID array.
[0090] In some embodiments, the first building module 401 is further configured to:
[0091] Divide each disk into multiple blocks;
[0092] All the disk blocks in the same location are grouped into a stripe and each stripe is numbered;
[0093] Record the stripe number to which each block on each disk belongs.
[0094] In some embodiments, the second building module 402 is further configured to:
[0095] Record the number of each RAID stripe constituting the sub-RAID array and set the preset flag position of each RAID stripe constituting the sub-RAID array to a first preset value.
[0096] In some embodiments, it also includes:
[0097] In response to detecting that the utilization rate of the sub-RAID array is less than a threshold, the RAID stripes in the sub-RAID array are recycled;
[0098] The recovered RAID stripe is set to zero, and the preset flag is set to the second preset value.
[0099] In some embodiments, the second building module 402 is further configured to:
[0100] In response to detecting that the utilization rate of the sub-RAID array is greater than a threshold, the sub-RAID array is expanded using the spare stripe;
[0101] Update the RAID stripe numbers included in the sub-RAID array.
[0102] In some embodiments, the reconstruction module 403 is further configured to:
[0103] Obtain all currently used sub-RAID arrays to determine the numbers of all currently used RAID stripes;
[0104] The blocks used on the faulty disk are determined based on the numbers of all currently used RAID stripes;
[0105] The hot spare disk is divided into multiple blocks, and the corresponding RAID stripe is reconstructed using the blocks on the hot spare disk that are in the same position as the blocks used in the failed disk. The remaining blocks are initialized to zero and then added to the corresponding spare stripe.
[0106] Based on the same inventive concept, according to another aspect of the present invention, such as Figure 3 As shown, embodiments of the present invention also provide a computer device 501, comprising:
[0107] At least one processor 520; and
[0108] Memory 510 stores a computer program 511 that can run on a processor. When the processor 520 executes the program, it performs the following steps:
[0109] Multiple stripes are constructed using multiple disks, and each RAID stripe is initialized to zero.
[0110] Several RAID stripes are selected from the plurality of RAID stripes to form a sub-RAID array and the sub-RAID array is used for data storage, while the remaining RAID stripes are used as spare stripes and kept in a zero state;
[0111] In response to the detection of the disk failure, the data of the sub-RAID array is reconstructed using a hot spare disk.
[0112] In some embodiments, selecting a plurality of RAID stripes from the plurality of RAID stripes to form a sub-RAID array and using the sub-RAID array for data storage, while the remaining RAID stripes are used as spare stripes and kept in a zero state, further includes:
[0113] In response to receiving an instruction to create the sub-RAID array, the number of RAID stripes to be selected is determined according to the instruction;
[0114] Compare the current number of spare stripes with the number of RAID stripes to be selected;
[0115] In response to the fact that the number of available spare stripes is less than the number of RAID stripes to be selected, the utilization rate of the other sub-RAID arrays is determined;
[0116] Reclaim multiple RAID stripes from other sub-RAID arrays whose utilization is less than the threshold and set them to zero;
[0117] The recovered, zeroed stripes and the currently reserved stripes are used together to create the sub-RAID array.
[0118] In some embodiments, constructing multiple stripes using multiple disks and initializing each RAID stripe to zero further includes:
[0119] Divide each disk into multiple blocks;
[0120] All the disk blocks in the same location are grouped into a stripe and each stripe is numbered;
[0121] Record the stripe number to which each block on each disk belongs.
[0122] In some embodiments, selecting a plurality of RAID stripes from the plurality of RAID stripes to form a sub-RAID array and using the sub-RAID array for data storage further includes:
[0123] Record the number of each RAID stripe constituting the sub-RAID array and set the preset flag position of each RAID stripe constituting the sub-RAID array to a first preset value.
[0124] In some embodiments, it also includes:
[0125] In response to detecting that the utilization rate of the sub-RAID array is less than a threshold, the RAID stripes in the sub-RAID array are recycled;
[0126] The recovered RAID stripe is set to zero, and the preset flag is set to the second preset value.
[0127] In some embodiments, it also includes:
[0128] In response to detecting that the utilization rate of the sub-RAID array is greater than a threshold, the sub-RAID array is expanded using the spare stripe;
[0129] Update the RAID stripe numbers included in the sub-RAID array.
[0130] In some embodiments, in response to detecting the disk failure, data reconstruction of the sub-RAID array using a hot spare disk further includes:
[0131] Obtain all currently used sub-RAID arrays to determine the numbers of all currently used RAID stripes;
[0132] The blocks used on the faulty disk are determined based on the numbers of all currently used RAID stripes;
[0133] The hot spare disk is divided into multiple blocks, and the corresponding RAID stripe is reconstructed using the blocks on the hot spare disk that are in the same position as the blocks used in the failed disk. The remaining blocks are initialized to zero and then added to the corresponding spare stripe.
[0134] Based on the same inventive concept, according to another aspect of the present invention, such as Figure 4 As shown, embodiments of the present invention also provide a computer-readable storage medium 601, which stores a computer program 610. When the computer program 610 is executed by a processor, it performs the following steps:
[0135] Multiple stripes are constructed using multiple disks, and each RAID stripe is initialized to zero.
[0136] Several RAID stripes are selected from the plurality of RAID stripes to form a sub-RAID array and the sub-RAID array is used for data storage, while the remaining RAID stripes are used as spare stripes and kept in a zero state;
[0137] In response to the detection of the disk failure, the data of the sub-RAID array is reconstructed using a hot spare disk.
[0138] In some embodiments, selecting a plurality of RAID stripes from the plurality of RAID stripes to form a sub-RAID array and using the sub-RAID array for data storage, while the remaining RAID stripes are used as spare stripes and kept in a zero state, further includes:
[0139] In response to receiving an instruction to create the sub-RAID array, the number of RAID stripes to be selected is determined according to the instruction;
[0140] Compare the current number of spare stripes with the number of RAID stripes to be selected;
[0141] In response to the fact that the number of available spare stripes is less than the number of RAID stripes to be selected, the utilization rate of the other sub-RAID arrays is determined;
[0142] Reclaim multiple RAID stripes from other sub-RAID arrays whose utilization is less than the threshold and set them to zero;
[0143] The recovered, zeroed stripes and the currently reserved stripes are used together to create the sub-RAID array.
[0144] In some embodiments, constructing multiple stripes using multiple disks and initializing each RAID stripe to zero further includes:
[0145] Divide each disk into multiple blocks;
[0146] All the disk blocks in the same location are grouped into a stripe and each stripe is numbered;
[0147] Record the stripe number to which each block on each disk belongs.
[0148] In some embodiments, selecting a plurality of RAID stripes from the plurality of RAID stripes to form a sub-RAID array and using the sub-RAID array for data storage further includes:
[0149] Record the number of each RAID stripe constituting the sub-RAID array and set the preset flag position of each RAID stripe constituting the sub-RAID array to a first preset value.
[0150] In some embodiments, it also includes:
[0151] In response to detecting that the utilization rate of the sub-RAID array is less than a threshold, the RAID stripes in the sub-RAID array are recycled;
[0152] The recovered RAID stripe is set to zero, and the preset flag is set to the second preset value.
[0153] In some embodiments, it also includes:
[0154] In response to detecting that the utilization rate of the sub-RAID array is greater than a threshold, the sub-RAID array is expanded using the spare stripe;
[0155] Update the RAID stripe numbers included in the sub-RAID array.
[0156] In some embodiments, in response to detecting the disk failure, data reconstruction of the sub-RAID array using a hot spare disk further includes:
[0157] Obtain all currently used sub-RAID arrays to determine the numbers of all currently used RAID stripes;
[0158] The blocks used on the faulty disk are determined based on the numbers of all currently used RAID stripes;
[0159] The hot spare disk is divided into multiple blocks, and the corresponding RAID stripe is reconstructed using the blocks on the hot spare disk that are in the same position as the blocks used in the failed disk. The remaining blocks are initialized to zero and then added to the corresponding spare stripe.
[0160] Finally, it should be noted that those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods.
[0161] Furthermore, it should be understood that the computer-readable storage medium (e.g., memory) described herein may be volatile memory or non-volatile memory, or may include both volatile memory and non-volatile memory.
[0162] Those skilled in the art will also understand that the various exemplary logic blocks, modules, circuits, and algorithm steps described in conjunction with the disclosure herein can be implemented as electronic hardware, computer software, or a combination of both. To clearly illustrate this interchangeability between hardware and software, the functionality of various illustrative components, blocks, modules, circuits, and steps has been generally described. Whether this functionality is implemented as software or as hardware depends on the specific application and the design constraints imposed on the system as a whole. Those skilled in the art can implement the functionality in various ways for each specific application, but such implementation decisions should not be construed as departing from the scope of the embodiments disclosed herein.
[0163] The above are exemplary embodiments disclosed in this invention. However, it should be noted that various changes and modifications can be made without departing from the scope of the embodiments of this invention as defined by the claims. The functions, steps, and / or actions of the methods according to the disclosed embodiments described herein do not need to be performed in any particular order. Furthermore, although the elements disclosed in the embodiments of this invention may be described or claimed individually, they may be understood as multiple unless explicitly limited to a singular number.
[0164] It should be understood that, as used herein, the singular form “a” is intended to include the plural form as well, unless the context clearly supports an exception. It should also be understood that, as used herein, “and / or” refers to any and all possible combinations of one or more of the associated listed items.
[0165] The embodiment numbers disclosed in the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0166] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.
[0167] Those skilled in the art should understand that the discussion of any of the above embodiments is merely exemplary and is not intended to imply that the scope of the invention (including the claims) is limited to these examples. Within the framework of the invention, technical features of the above embodiments or different embodiments can be combined, and many other variations of different aspects of the invention exist, which are not provided in the details for the sake of brevity. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the invention should be included within the protection scope of the invention.
Claims
1. A data storage method, characterized in that, Includes the following steps: Multiple RAID stripes are constructed using multiple disks, and each RAID stripe is initialized to zero. Several RAID stripes are selected from the plurality of RAID stripes to form a sub-RAID array and the sub-RAID array is used for data storage, while the remaining RAID stripes are used as spare stripes and kept in a zero state; In response to the detection of the disk failure, the data of the sub-RAID array is reconstructed using a hot spare disk; Selecting a plurality of RAID stripes from the plurality of RAID stripes to form a sub-RAID array and using the sub-RAID array for data storage, the remaining RAID stripes are used as spare stripes and kept in a zero state, further comprising: In response to receiving an instruction to create the sub-RAID array, the number of RAID stripes to be selected is determined according to the instruction; Compare the current number of spare stripes with the number of RAID stripes to be selected; In response to the fact that the number of available spare stripes is less than the number of RAID stripes to be selected, the utilization rate of the other sub-RAID arrays is determined; Reclaim multiple RAID stripes from other sub-RAID arrays whose utilization is less than the threshold and set them to zero; The recovered, zeroed stripes and the currently reserved stripes are used together to create the sub-RAID array.
2. The method as described in claim 1, characterized in that, Constructing multiple RAID stripes using multiple disks and initializing each RAID stripe to zero, further includes: Divide each disk into multiple blocks; All disks in the same location are grouped into a RAID stripe and each RAID stripe is numbered. Record the RAID stripe number to which each block on each disk belongs.
3. The method as described in claim 2, characterized in that, Selecting several RAID stripes from the plurality of RAID stripes to form a sub-RAID array and using the sub-RAID array for data storage further includes: Record the number of each RAID stripe constituting the sub-RAID array and set the preset flag position of each RAID stripe constituting the sub-RAID array to a first preset value.
4. The method as described in claim 3, characterized in that, Also includes: In response to detecting that the utilization rate of the sub-RAID array is less than a threshold, the RAID stripes in the sub-RAID array are recycled; The recovered RAID stripe is set to zero, and the preset flag is set to the second preset value.
5. The method as described in claim 3, characterized in that, Also includes: In response to detecting that the utilization rate of the sub-RAID array is greater than a threshold, the sub-RAID array is expanded using the spare stripe; Update the RAID stripe numbers included in the sub-RAID array.
6. The method as described in claim 3, characterized in that, In response to the detection of the disk failure, data reconstruction of the sub-RAID array is performed using a hot spare disk, further including: Obtain all currently used sub-RAID arrays to determine the numbers of all currently used RAID stripes; The blocks used on the faulty disk are determined based on the numbers of all currently used RAID stripes; The hot spare disk is divided into multiple blocks, and the corresponding RAID stripe is reconstructed using the blocks on the hot spare disk that are in the same position as the blocks used in the failed disk. The remaining blocks are initialized to zero and then added to the corresponding spare stripe.
7. A data storage system, characterized in that, include: The first construction module is configured to construct multiple RAID stripes using multiple disks and initialize each RAID stripe to zero. The second construction module is configured to select several RAID stripes from the plurality of RAID stripes to form a sub-RAID array and use the sub-RAID array for data storage, while the remaining RAID stripes are used as spare stripes and kept in a zero state. The reconstruction module is configured to reconstruct the data of the sub-RAID array using a hot spare disk in response to the detection of the disk failure. The second building module is also configured as follows: In response to receiving an instruction to create the sub-RAID array, the number of RAID stripes to be selected is determined according to the instruction; Compare the current number of spare stripes with the number of RAID stripes to be selected; In response to the fact that the number of available spare stripes is less than the number of RAID stripes to be selected, the utilization rate of the other sub-RAID arrays is determined; Reclaim multiple RAID stripes from other sub-RAID arrays whose utilization is less than the threshold and set them to zero; The recovered, zeroed stripes and the currently reserved stripes are used together to create the sub-RAID array.
8. A computer device, comprising: At least one processor; as well as A memory storing a computer program executable on the processor, characterized in that the processor executes the program by performing the steps of the method as described in any one of claims 1-6.
9. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it performs the steps of the method as described in any one of claims 1-6.
Citation Information
Patent Citations
Method for improving usability of disk and disk array controller
CN101567211A
Redundant array of independent disk system and initializing method thereof
CN102609223A