Disk capacity expansion method and device, equipment and storage medium

By restoring the data from the faulty disk using the original stripe checksum during RAID expansion and temporarily storing it in the reserved area, the problem of expansion interruption caused by disk failure during online RAID expansion was solved, thus improving data integrity and system reliability.

CN121900703APending Publication Date: 2026-04-21JINAN MAIWEI INTELLIGENT TECHNOLOGY CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
JINAN MAIWEI INTELLIGENT TECHNOLOGY CO LTD
Filing Date
2026-02-28
Publication Date
2026-04-21

AI Technical Summary

Technical Problem

In existing technologies, RAID online expansion cannot continue when a disk fails, resulting in inconsistent storage status and affecting system reliability and data security.

Method used

When a bad disk is detected during the expansion process, the data elements of the bad disk are restored using the checksum of the original stripe, the target data element is identified, and it is written to the reserved area. After the conditions are met, it is migrated to the target disk array after expansion to ensure data integrity.

Benefits of technology

It ensures the continuity of the expansion process in the event of disk failure, guarantees data integrity, avoids expansion interruption, and improves system reliability and data security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121900703A_ABST
    Figure CN121900703A_ABST
Patent Text Reader

Abstract

The invention discloses a disk capacity expansion method and device, equipment and a storage medium, and relates to the technical field of storage, in the disk capacity expansion method, under the condition that a bad disk is detected during disk array capacity expansion, at least one original stripe before capacity expansion is determined according to an abnormal stripe containing the bad disk after capacity expansion; restoring the bad disk data element according to the check code in the original stripe and the normal data element in the original stripe to obtain a restored target data element; then determining a target stripe according to the restored target data element and the normal data element in the abnormal stripe; writing the target strip into a reserved area of any normal disk; and finally, under the condition that a preset migration condition is met, migrating the target strip stored in the reserved area to the expanded target disk array. According to the method and the device, on the premise of ensuring the data consistency of the RAID system, the continuous capacity expansion under the condition that the disk breaks down during the online capacity expansion of the RAID can be realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of storage technology, and in particular to disk expansion methods, apparatus, devices and storage media. Background Technology

[0002] With the development of technologies such as big data, data has experienced explosive growth. Enterprise servers and data centers need to process massive amounts of business data such as documents, images, and videos every day, and the demand for storage capacity continues to grow like a snowball. The original RAID (Redundant Array of Independent Disks) storage architecture is gradually becoming unable to meet the needs of business expansion.

[0003] To cope with the growth in storage capacity, existing technologies typically employ traditional RAID online expansion solutions. This involves increasing the number of disks and migrating data stripe by stripe, redistributing the original stripe data according to the new number of disks. While this can expand storage capacity and improve performance, the expansion process abruptly stops when a member disk fails or goes offline, leaving an inconsistent storage state that severely impacts system reliability and data security. Therefore, how to continue expanding RAID online even when disks fail has become a pressing issue. Summary of the Invention

[0004] This application provides a disk expansion method, apparatus, device, and storage medium to at least solve the problem in the related art where RAID online expansion disks cannot be continuously expanded due to failure.

[0005] This application provides a disk expansion method, including:

[0006] If a bad disk is detected during disk array expansion, at least one original stripe before expansion is determined based on the data elements in the abnormal stripe containing the bad disk after expansion; wherein, the original stripe includes data elements, and the data elements include bad disk data elements and normal data elements; Based on at least one checksum from the original stripe and the normal data elements from the original stripe, restore the bad disk data elements to obtain the restored target data elements; The target strip is determined based on the restored target data elements and the normal data elements in the abnormal strips; Write the target stripe to the reserved area of ​​any normal disk; wherein the reserved area includes at least one stripe for temporary storage of recovery data; If the preset migration conditions are met, the target stripe stored in the reserved area will be migrated to the expanded target disk array.

[0007] This application also provides a disk expansion device, including: The original stripe determination module is used to determine at least one original stripe before the expansion when a bad disk is detected during disk array expansion, based on the data elements in the abnormal stripe containing the bad disk after expansion; wherein the original stripe includes data elements, and the data elements include bad disk data elements and normal data elements; The data element restoration module is used to restore the bad disk data element based on at least one check code in the original stripe and the normal data element in the original stripe, so as to obtain the restored target data element. The target stripe determination module is used to determine the target stripe based on the restored target data elements and the normal data elements in the abnormal stripes; The reserved area write module is used to write the target stripe to the reserved area of ​​any normal disk; wherein the reserved area includes at least one stripe for temporary storage of recovery data; The migration module is used to migrate the target stripe stored in the reserved area to the expanded target disk array, provided that preset migration conditions are met.

[0008] This application also provides an electronic device, including: a memory for storing a computer program; and a processor for implementing the steps of any of the disk expansion methods described above when executing the computer program.

[0009] This application also provides a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the steps of any of the disk expansion methods described above.

[0010] In some embodiments of this application, when a bad disk is detected during disk array expansion, at least one original stripe before expansion is first determined based on the data elements in the abnormal stripe containing the bad disk after expansion. Then, based on at least one checksum and normal data elements in the original stripe, the bad disk data elements are restored to obtain the target data elements. The target stripe is then determined by combining the normal data elements in the abnormal stripe. The target stripe is written to the reserved area of ​​any normal disk. Finally, when preset migration conditions are met, the target stripe in the reserved area is migrated to the target disk array after expansion. In this way, when a bad disk is encountered during the expansion process, the problem of data loss can be solved by locating the original stripe and restoring the bad disk data. For example, the bad disk data can be calculated in reverse using the checksum of the original stripe to ensure the integrity of the data required for expansion. The target stripe is temporarily stored in the reserved area to avoid the inability to store data due to the bad disk, thereby ensuring that the expansion process is not interrupted in the case of a bad disk. This solves the problem in the prior art that the expansion cannot continue when a disk fails during online RAID expansion. Attached Figure Description

[0011] To more clearly illustrate the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0012] Figure 1 A schematic diagram illustrating a conventional capacity expansion method provided by some prior art in this application; Figure 2 This application provides a schematic diagram of a traditional capacity expansion process for some prior art techniques; Figure 3 A schematic flowchart illustrating a disk expansion method provided for some embodiments of this application; Figure 4 This is a schematic diagram illustrating the basic process of online RAID expansion provided in this application; Figure 5 A schematic diagram illustrating the process for resolving bad disks during RAID online expansion provided in this application; Figure 6 A schematic diagram of the RAID zones before expansion, provided in this application; Figure 7 A schematic diagram of the stripe mapping relationship provided for this application; Figure 8 A schematic diagram illustrating the data processing for a failed disk during online RAID expansion provided in this application; Figure 9 Schematic diagram of a disk expansion device provided for some embodiments of this application; Figure 10 A schematic diagram of the modules of an electronic device provided for some embodiments of this application. Detailed Implementation

[0013] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of this application.

[0014] It should be noted that, in the description of this application, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. The terms "first," "second," etc., in this application are used to distinguish similar objects and are not used to describe a specific order or sequence.

[0015] To enable those skilled in the art of the present technology to better understand the solution of this application, the following provides a further detailed description of this application in conjunction with the accompanying drawings and specific implementation manners.

[0016] Refer to Figure 1 , which is a schematic diagram of a traditional expansion method provided by some prior arts of this application. Figure 1 In, expand RAID6 with 5 disks to 6 disks. Taking stripe 3 after expansion as an example, the corresponding gray part of stripe 3 after expansion is data blocks D9 to D12, corresponding to data blocks D9 to D12 in stripe 3 and stripe 4 of RAID6 before expansion. The traditional expansion method reads data blocks D9 to D12 from RAID6 before expansion, recalculates parity data based on data blocks D9 to D12, and fills it into the corresponding positions in stripe 3 of RAID6 after expansion.

[0017] Refer to Figure 2 , which is a schematic diagram of a traditional expansion process provided by some prior arts of this application. Figure 2 In, first mark the first stripe to be expanded as x, which is used to mark the starting position of the currently processed stripe, and mark the total number of stripes to be expanded as y, which is used to determine the target range of the expansion task; then perform data reorganization operations on the current stripe x in the expansion manner, redistribute the original stripe data according to the number of disks after expansion, and complete the expansion processing of this stripe; then switch the currently processed stripe to the next stripe x + 1 to advance the expansion process; then determine whether the expansion is completed, that is, determine whether the currently processed stripe number x is less than the total number of stripes y to be expanded; if the judgment result is yes, that is, x < y holds, then the process returns to the step of reorganizing data on stripe x in the expansion manner, and continue to expand the next stripe; if the judgment result is no, that is, x < y does not hold, then the expansion process ends.

[0018] In the related art, when a disk fails or goes offline, the expansion process will suddenly stop, leaving a non - consistent storage state, seriously affecting the reliability and data security of the system. Therefore, how to continue expansion in the case of a disk failure during RAID online expansion has become an urgent problem to be solved.

[0019] In view of this, this application provides a disk expansion method, which can solve the above problems. The disk expansion method can be applied to electronic devices. Electronic devices can include, but are not limited to, tablet computers, laptop computers, desktop computers, servers, etc. Refer to Figure 3 , which is a schematic diagram of the process of the disk expansion method provided by some embodiments of this application. Figure 3 In, the disk expansion method includes the following steps: Step S101: If a bad disk is detected during disk array expansion, at least one original stripe before expansion is determined based on the data elements in the abnormal stripe containing the bad disk after expansion; wherein, the original stripe includes data elements, and the data elements include bad disk data elements and normal data elements.

[0020] Specifically, a disk array refers to RAID, or Redundant Array of Independent Disks, a storage virtualization technology that combines multiple independent physical hard drives into one or more logical storage units through hardware or software to achieve data redundancy, performance improvement, or a combination of both. For example, a RAID 6 disk array contains multiple data disks and two parity disks, enabling data recovery in the event of a failure of up to two disks.

[0021] Specifically, a bad disk refers to a member disk that suddenly fails, goes offline, or cannot read or write data normally during the online expansion of a disk array. The data stored on it cannot be directly accessed, which will cause the expansion process to be interrupted and data consistency to be compromised.

[0022] Specifically, an abnormal stripe refers to a stripe containing faulty disks after expansion. Due to the presence of faulty disks, some data elements are missing in this stripe, making it impossible to complete the expansion and reorganization directly. Normal expansion can only be achieved by restoring the data elements of the faulty disks.

[0023] Specifically, a data element refers to the basic data unit that makes up a stripe, including data blocks and parity blocks in the stripe. It is the smallest operational unit for data storage and expansion and reorganization of the disk array. The virtual disk uses it as the unit to map the address of the virtual disk to the address of the member disk.

[0024] Specifically, the original stripe refers to the stripe before the disk array was expanded. It is the data source of the abnormal stripe after the expansion and contains all the data elements corresponding to the abnormal stripe.

[0025] Specifically, bad data elements refer to abnormal data elements stored on the disk, while normal data elements refer to normal data elements stored on the disk.

[0026] Understandably, when a disk array encounters a faulty disk during expansion, the distribution of data elements in the abnormal stripe after expansion can be used to locate the original stripe before expansion that corresponds to the abnormal stripe, thus clarifying the source of the faulty data elements and the normal data elements.

[0027] Step S102: Based on at least one checksum in the original stripe and normal data elements in the original stripe, restore the bad disk data elements to obtain the restored target data elements.

[0028] Specifically, the checksum, or check block, refers to the check data used to achieve data redundancy protection. For example, the P check block and Q check block in a RAID6 disk array. The P check block is generated by the XOR algorithm, and the Q check block is generated by the Reed-Solomon algorithm. The two work together to achieve data recovery in the event of a single or two disk failures.

[0029] Specifically, the target data element refers to the normal data element obtained through the restoration operation. It has the same format and specifications as the normal data element in the original stripe and can replace the original bad disk data element for subsequent target stripe reconstruction.

[0030] Understandably, based on the type of bad disk data element, the corresponding checksum and algorithm are selected, and combined with the normal data elements in the original stripe for reverse calculation to complete the restoration of the bad disk data element and confirm the target data element.

[0031] Step S103: Determine the target strip based on the restored target data elements and the normal data elements in the abnormal stripes.

[0032] Specifically, a target stripe refers to a complete stripe composed of target data elements written into an abnormal stripe, replacing the original bad disk data elements, and normal data elements.

[0033] Understandably, after confirming the restored target data elements and the normal data elements in the abnormal stripe, the integrity and accuracy of the target stripe are calculated using the new checksum, and a target stripe that meets the expansion requirements is constructed.

[0034] Step S104: Write the target stripe to the reserved area of ​​any normal disk; wherein the reserved area includes at least one stripe for temporary storage of recovery data.

[0035] Specifically, the reserved area is used for temporary storage of data recovered during the expansion process, to avoid the inability to store recovered data due to disk failure, and to provide a transition area for subsequent data migration.

[0036] Understandably, the normal disks in the disk array are first screened out, and at least one normal disk is selected as the reserved area; then, according to the storage rules of the reserved area, the target stripe is completely written into the reserved area of ​​the normal disk.

[0037] Step S105: If the preset migration conditions are met, migrate the target stripe stored in the reserved area to the expanded target disk array.

[0038] Specifically, the preset migration conditions refer to the prerequisites for triggering the migration of the target stripe from the reserved area to the expanded target disk array.

[0039] Understandably, the process first checks whether the preset migration conditions are met. If the preset migration conditions are met, the storage locations of all target stripes in the reserved area are located. Then, according to the stripe distribution rules of the expanded target disk array, the target stripes in the reserved area are migrated one by one to the corresponding physical storage locations.

[0040] In summary, in the technical solutions of some embodiments of this application, when a bad disk is detected during disk array expansion, at least one original stripe before expansion is first determined based on the data elements in the abnormal stripe containing the bad disk after expansion. Then, based on at least one checksum and normal data elements in the original stripe, the bad disk data elements are restored to obtain the target data elements. The target stripe is determined by combining the normal data elements in the abnormal stripe, and the target stripe is written to the reserved area of ​​any normal disk. Finally, when preset migration conditions are met, the target stripe in the reserved area is migrated to the target disk array after expansion. In this way, when a bad disk is encountered during the expansion process, the data loss problem can be solved by locating the original stripe and restoring the bad disk data. For example, the bad disk data can be calculated in reverse using the checksum of the original stripe to ensure the integrity of the data required for expansion. The target stripe is temporarily stored in the reserved area to avoid the inability to store data due to the bad disk, thereby ensuring that the expansion process is not interrupted in the case of a bad disk. Thus, the problem of continuous expansion due to disk failure during online RAID expansion in the prior art can be solved.

[0041] In some embodiments, before writing the target stripe to the reserved area of ​​any normal disk in step S104, the method of this application further includes: Step a1: According to the configuration of the disk array, a space of a preset size is set on each disk as a reserved area; wherein, the reserved area includes at least one stripe for temporary storage of recovery data.

[0042] Specifically, before executing step S104 to write the target stripe, a reserved area of ​​a preset size is uniformly divided on all member disks according to the actual configuration of the disk array. The storage location and capacity of the reserved area are first determined to ensure that each disk has the ability to temporarily store and recover data. During the division process, the logical space allocation rules of the disk array are strictly followed to ensure that the size of the reserved area can adapt to the scenario of multiple bad disks and can store multiple target stripes at the same time.

[0043] In the above embodiments, by setting up a reserved area on each disk in advance, a reliable carrier is provided for the temporary storage of subsequent target stripes, which solves the problems of no dedicated temporary storage area and inability to store recovered data in the event of a bad disk in traditional capacity expansion.

[0044] In some embodiments, step S101, when a bad disk is detected during disk array expansion, involves determining at least one original stripe before the expansion based on data elements in the abnormal stripe containing the bad disk after expansion, including: Step S1011: If a bad disk is detected during disk array expansion, obtain the starting position of the data element corresponding to the abnormal stripe, the stripe size before expansion, and the stripe size after expansion.

[0045] Step S1012: Based on the starting position of the data element, the stripe size before expansion, and the stripe size after expansion, determine at least one original stripe of the data element before expansion.

[0046] Specifically, the starting position of a data element refers to the starting address of each data element in the abnormal stripe within the logical space of the disk array, and this address is aligned with the stripe size after expansion.

[0047] Specifically, the stripe size before expansion refers to the fixed storage capacity of each stripe before the disk array is expanded, which is determined by the initial configuration of the disk array. The stripe size after expansion refers to the fixed storage capacity of each stripe after the disk array is expanded, which is determined by the number of member disks after the expansion.

[0048] Understandably, after a bad disk is detected during disk array expansion, three parameters are obtained: the starting position of the abnormal stripe data element, the stripe size before expansion, and the stripe size after expansion, to ensure that the original stripe range is located.

[0049] In the above embodiments, the precise positioning of the original stripe is achieved by using the starting position of the data element, the stripe size before expansion, and the stripe size after expansion, which provides a basis for the subsequent reconstruction of the target stripe by restoring the data elements of the faulty disk.

[0050] In some embodiments, determining at least one original stripe of the data element before expansion based on the starting position of the data element, the stripe size before expansion, and the stripe size after expansion in step S1012 includes: Step b1: Determine the stripe number of the data element's starting position before expansion using the following formula: x=slba / stripe_size Where x is the stripe number of the data element at its starting position before resizing, slba is the starting position of the data element, and stripe_size is the stripe size before resizing.

[0051] Step b2, determine the stripe number of the data element at the end position before resizing using the following formula: y=(slba+stripe_size`) / stripe_size Where y is the stripe number of the data element at the end position before expansion, slba is the start position of the data element, stripe_size is the stripe size after expansion, and stripe_size is the stripe size before expansion.

[0052] Step b3: Determine at least one original stripe of the data element before expansion based on the stripe number of the starting position and the ending position of the data element before expansion.

[0053] Specifically, the starting stripe number before expansion refers to the original stripe number to which the data element first belonged before expansion, and the ending stripe number before expansion refers to the original stripe number to which the data element last belonged before expansion.

[0054] It is understandable that, based on the stripe number x at the starting position before expansion obtained in step b1 and the stripe number y at the ending position before expansion obtained in step b2, the original stripe of the data element before expansion is determined to be a set of continuous stripes with stripe numbers from x to y.

[0055] In the above embodiments, the stripe number x at the starting position of the data element before expansion and the stripe number y at the ending position before expansion are determined respectively, and all original stripes containing the data element are determined, realizing the complete location of the original stripes and providing a basis for subsequent recovery of bad disk data.

[0056] In some embodiments, before step S102, which restores the bad disk data element based on at least one checksum in the original stripe and the normal data element in the original stripe to obtain the restored target data element, the method of this application further includes: Step c1: If the bad disk data element in the abnormal stripe is unique, determine whether the bad disk data element is a checksum.

[0057] Step c2: If the bad disk data element is not a checksum, perform the step of restoring the bad disk data element based on at least one checksum from the original stripe and the normal data element from the original stripe to obtain the restored target data element.

[0058] Specifically, the number of bad disk data elements in the abnormal stripe is first detected. If the bad disk data element is unique in the abnormal stripe, the identification information of the bad disk data element is obtained and compared with the identification information of the check code in the original stripe to determine whether the bad disk data element belongs to the check code. If the bad disk data element is not the check code, it is determined that the bad disk data element is a data block in the original stripe, and the restoration operation in step S102 is triggered. If the bad disk data element is the check code, the restoration operation in step S102 is not triggered.

[0059] Specifically, when the bad disk data elements in the abnormal stripe are not unique, the type of each bad disk data element is first determined to determine whether it is a check code or a data block. Then, according to the type combination of the bad disk data elements, the corresponding restoration strategy is matched. If there are bad disk data elements that are not check codes, the restoration operation in step S102 is triggered for that type of data block. If all bad disk data elements are check codes, the restoration operation in step S102 is not triggered.

[0060] In the above embodiment, before performing the bad disk data element restoration operation in step S102, it is first determined whether the unique bad disk data element in the abnormal stripe is a check code, and then the bad disk data element that is not a check code is restored, thus realizing the targeted execution of the restoration operation.

[0061] In some embodiments, step S103, determining the target stripe based on the restored target data element and the normal data elements in the abnormal stripe, includes: Step S1031: Calculate a new checksum based on the restored target data element and the normal data element in the abnormal stripe.

[0062] Step S1032: Place the checksum at the target checksum position according to the checksum arrangement rules of the disk array.

[0063] Step S1033: Based on the target check code position, determine the first target element position of the restored target data element and the second target element position of the normal data element in the abnormal stripe.

[0064] Step S1034: Place the restored target data element at the first target element position and place the normal data element in the abnormal strip at the second target element position to obtain the target strip.

[0065] Specifically, the new checksum refers to the checksum recalculated based on the complete data of the expanded stripe.

[0066] Specifically, the checksum arrangement rule refers to the fixed rule preset in the disk array to standardize the storage location of the checksum, which specifies the specific storage location of the checksum block in the target stripe, such as the left-hand asymmetric arrangement rule.

[0067] Specifically, the target check code position refers to the fixed storage location pre-assigned to the new check code according to the check code arrangement rules.

[0068] Specifically, the first target element position refers to the preset storage position of the restored target data element in the target strip; the second target element position refers to the preset storage position of the normal data element in the abnormal strip in the target strip.

[0069] Understandably, the process begins by integrating the restored target data elements with the normal data elements in the abnormal stripe, and then generating a new checksum based on the integrated complete data. Next, the checksum arrangement rules after disk array expansion are retrieved to determine the target checksum position corresponding to the new checksum, and the checksum is placed at the target checksum position. Then, using the target checksum position as a reference, and combining it with the stripe arrangement rules of the disk array, the storage positions corresponding to the restored target data elements and the normal data elements in the abnormal stripe are derived, namely the first target element position and the second target element position. Finally, the restored target data elements are placed at the first target element position, and the normal data elements in the abnormal stripe are placed at the second target element position, completing the placement of all data elements and achieving the ordered reorganization of the target stripe to obtain the target stripe.

[0070] In the above embodiments, by calculating the checksum, determining the location of the data element, and placing the data element, a target stripe that meets the expansion requirements is constructed, providing a reliable foundation for the temporary storage and final migration of the target stripe, and ensuring the continuity of the expansion process in the event of a disk failure.

[0071] In some embodiments, step S105, which involves migrating the target stripe stored in the reserved area to the expanded target disk array when the preset migration conditions are met, includes: Step S1051: After all abnormal stripes have completed data element restoration and all target stripes have been written to the reserved area, the target stripes in the reserved area are migrated to the expanded target disk array in storage order.

[0072] Specifically, first confirm that all abnormal stripes have had their bad disk data elements restored, and that all reconstructed target stripes have been completely written to the reserved area. If the above two conditions are met, replace the bad disk in the disk array, then read the target stripes in the reserved area one by one, accurately migrate the target stripes to the corresponding physical storage locations, complete the expansion operation, and ensure that the data is stored correctly.

[0073] In the above embodiments, by clearly defining the migration trigger conditions, the safe and orderly migration of the target stripe from the reserved area to the expanded target disk array is realized, ensuring the closed-loop advancement of RAID online expansion in the case of disk failure, and guaranteeing the reliability and data consistency of the storage system.

[0074] See also Figure 4 , Figure 4 This is a schematic diagram illustrating the basic process of online RAID expansion provided in this application. Figure 4In this process, first, a reserved area for damaged stripes is created to temporarily store the target stripes recovered during the expansion process. Then, the first stripe to be expanded is marked as x to mark the starting position of the stripe currently being processed. Next, the total number of stripes to be expanded is calculated and marked as y to determine the target range of the expansion task. After that, data reorganization operations are performed on the current stripe x in the expansion mode, and the original stripe data is redistributed according to the number of expanded disks. During the reorganization process, it is judged in real time whether there is a bad disk during the expansion. When there is a bad disk during the expansion, the expansion operation with a bad disk in the stripe is executed. When there is no bad disk during the expansion, the traditional expansion method is executed, and the stripe reorganization is directly completed according to the conventional expansion logic. After the expansion process of the current stripe x is completed, the currently processed stripe is switched to the next stripe (x + 1) to advance the expansion process. Subsequently, it is judged whether the expansion is completed. When the expansion is not completed, the process returns to the step of reorganizing data for stripe x in the expansion mode, and the expansion operation is continued for the next stripe. When the expansion is completed, the expansion process ends.

[0075] Refer to Figure 5 , Figure 5 which is a schematic diagram of the solution process for bad disks in the RAID online expansion provided by this application. Figure 5 In this process, first, the stripe containing a bad disk after expansion is mapped to the RAID array before expansion, the stripe processing range is set from x to y, and the current stripe number i to be processed is initialized as x. Then, the data of the stripe with the current number i is read into the memory, and then it is judged whether the bad disk data in this stripe is used for this expansion. When the bad disk data is used for this expansion, the bad disk data restoration calculation is executed, the complete data is written into the reserved area, and then i is incremented. When the bad disk data is not used for this expansion, i is directly incremented. After that, it is judged whether i is less than y. If i < y, the process returns to the step of reading the stripe data. If i ≥ y, the new checksum corresponding to the user data in the reserved area is calculated. Finally, all the data in the reserved area is written into the target disk array according to the rules of the RAID array after expansion, and the entire expansion process is completed.

[0076] Refer to Figure 6 , Figure 6 which is a schematic diagram of each area of the RAID before expansion provided by this application. Figure 6 In this process, before the formal start of the RAID expansion, each member disk reserves an additional reserved area with a preset space size as a temporary storage area for the recovered target stripes.

[0077] Refer to Figure 7 , Figure 7 which is a schematic diagram of the stripe mapping relationship provided by this application. Figure 7Since disks 3 and 5 were known to be faulty before the expansion of RAID6, the data elements D9, D10, D11 and D12 corresponding to stripe 3 of the expanded RAID6 can be identified as faulty data elements through stripe mapping, and need to be restored using the method of this application.

[0078] See also Figure 8 , Figure 8 This is a schematic diagram illustrating the data processing for a failed disk during online RAID expansion provided in this application. Figure 8 In the process, stripe 3 before expansion is read into memory, D9 is calculated using the remaining data of stripe 3 before expansion, and then written to the reserved area of ​​any undamaged member disk according to the data arrangement after expansion. Stripe 4 before expansion is read into memory, D10 and D12 are calculated using the remaining data of stripe 4 before expansion, and D10, D11, and D12 are written to the reserved area according to the data arrangement after expansion. Using the data in the reserved area, new parity blocks P' and Q' are calculated, and D9, D10, P', Q', D11, and D12 are concatenated to obtain the target stripe, which is then written to the reserved area. Finally, the reserved area is written back to the expanded RAID, successfully handling the bad disks that occurred during the expansion.

[0079] Corresponding to the disk expansion method, this application also provides a disk expansion device. (See also...) Figure 9 This is a schematic diagram of a disk expansion device provided in some embodiments of this application. Figure 9 In this context, the disk expansion device includes: The original stripe determination module 901 is used to determine at least one original stripe before the expansion based on the data elements in the abnormal stripe containing the bad disk after the expansion when a bad disk is detected during the expansion of the disk array; wherein the original stripe includes data elements, and the data elements include bad disk data elements and normal data elements; The data element restoration module 902 is used to restore the bad disk data element based on at least one check code in the original stripe and the normal data element in the original stripe, so as to obtain the restored target data element. The target stripe determination module 903 is used to determine the target stripe based on the restored target data elements and the normal data elements in the abnormal stripe; The reserved area write module 904 is used to write the target stripe to the reserved area of ​​any normal disk; wherein the reserved area includes at least one stripe for temporary storage of recovery data; The migration module 905 is used to migrate the target stripe stored in the reserved area to the expanded target disk array when the preset migration conditions are met.

[0080] In some embodiments, the device further includes: The reserved area setting unit is used to set a preset size of space on each disk as a reserved area according to the configuration of the disk array; wherein the reserved area includes at least one stripe for temporary storage of recovery data.

[0081] In some embodiments, the original stripe determination module 901 includes: The parameter acquisition unit is used to obtain the starting position of the data element corresponding to the abnormal stripe, the stripe size before expansion, and the stripe size after expansion when a bad disk is detected during disk array expansion.

[0082] The original stripe determination unit is used to determine at least one original stripe of a data element before expansion, based on the starting position of the data element, the stripe size before expansion, and the stripe size after expansion.

[0083] In some embodiments, the original stripe determination unit includes: The starting position determines the sub-cell, which is used to determine the stripe number of the data element's starting position before expansion using the following formula: x=slba / stripe_size Where x is the stripe number of the data element at its starting position before resizing, slba is the starting position of the data element, and stripe_size is the stripe size before resizing.

[0084] The end position determination subcell is used to determine the stripe number of the data element's end position before expansion using the following formula: y=(slba+stripe_size`) / stripe_size Where y is the stripe number of the data element at the end position before expansion, slba is the start position of the data element, stripe_size is the stripe size after expansion, and stripe_size is the stripe size before expansion.

[0085] The original stripe determination sub-unit is used to determine at least one original stripe of the data element before expansion based on the stripe number of the data element's starting position and the stripe number of its ending position before expansion.

[0086] In some embodiments, the device further includes: The checksum determination unit is used to determine whether a bad disk data element is a checksum when the bad disk data element in the abnormal stripe is unique.

[0087] The determination execution unit is used to perform the step of restoring the bad disk data element based on at least one check code in the original stripe and the normal data element in the original stripe, so as to obtain the restored target data element when the bad disk data element is not a check code.

[0088] In some embodiments, the target stripe determination module 903 includes: The check code calculation unit is used to calculate a new check code based on the restored target data element and the normal data element in the abnormal stripe.

[0089] The checksum arrangement unit is used to place the checksum at the target checksum position according to the checksum arrangement rules of the disk array.

[0090] The element position determination unit is used to determine the first target element position of the restored target data element and the second target element position of the normal data element in the abnormal strip, based on the target check code position of the check code.

[0091] The target stripe determination unit is used to place the restored target data elements at the first target element position and place the normal data elements in the abnormal stripe at the second target element position to obtain the target stripe.

[0092] In some embodiments, the migration module 905 includes: The migration unit is used to migrate the target stripes in the reserved area to the expanded target disk array in the order of storage, after all abnormal stripes have completed data element restoration and all target stripes have been written to the reserved area.

[0093] For a description of the features in the embodiment corresponding to the disk expansion device, please refer to the relevant description in the embodiment corresponding to the sample data processing method, which will not be repeated here.

[0094] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method.

[0095] See also Figure 10 The embodiments of this application also provide an electronic device, including a memory 10 and a processor 20, wherein the memory 10 stores a computer program and the processor 20 is configured to run the computer program to perform the steps in any of the disk expansion method embodiments described above.

[0096] Embodiments of this application also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the disk expansion method embodiments described above when running.

[0097] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.

[0098] Embodiments of this application also provide a computer program product, which includes a computer program that, when executed by a processor, implements the steps in any of the disk expansion method embodiments described above.

[0099] Embodiments of this application also provide another computer program product, including a non-volatile computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps in any of the disk expansion method embodiments described above.

[0100] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0101] The disk expansion method, apparatus, device, and storage medium provided in this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are only intended to help understand the method and core ideas of this application. It should be noted that those skilled in the art can make various improvements and modifications to this application without departing from its principles, and these improvements and modifications also fall within the protection scope of the claims of this application.

Claims

1. A method for expanding disk capacity, characterized in that, The method includes: If a bad disk is detected during disk array expansion, at least one original stripe before expansion is determined based on the data elements in the abnormal stripe containing the bad disk after expansion; wherein, the original stripe includes the data elements, and the data elements include bad disk data elements and normal data elements; Based on at least one checksum in the original stripe and normal data elements in the original stripe, the bad disk data elements are restored to obtain the restored target data elements; The target strip is determined based on the restored target data elements and the normal data elements in the abnormal stripes; The target stripe is written to the reserved area of ​​any normal disk; wherein the reserved area includes at least one stripe for temporary storage of recovery data; Under the condition that the preset migration conditions are met, the target stripe stored in the reserved area will be migrated to the expanded target disk array.

2. The disk expansion method according to claim 1, characterized in that, Before writing the target stripe to the reserved area of ​​any normal disk, the method further includes: According to the configuration of the disk array, a space of a preset size is set on each disk as a reserved area; wherein, the reserved area includes at least one stripe for temporary storage of recovery data.

3. The disk expansion method according to claim 1, characterized in that, In the event that a bad disk is detected during disk array expansion, the method of determining at least one original stripe before expansion based on data elements in the abnormal stripe containing the bad disk after expansion includes: If a bad disk is detected during disk array expansion, obtain the starting position of the data element corresponding to the abnormal stripe, the stripe size before expansion, and the stripe size after expansion; Based on the starting position of the data element, the stripe size before expansion, and the stripe size after expansion, at least one original stripe of the data element before expansion is determined.

4. The disk expansion method according to claim 1, characterized in that, The step of determining at least one original stripe of the data element before expansion based on the starting position of the data element, the stripe size before expansion, and the stripe size after expansion includes: The stripe number of the data element at its starting position before expansion is determined by the following formula: x=slba / stripe_size Where x is the stripe number of the data element at its starting position before expansion, slba is the starting position of the data element, and stripe_size is the stripe size before expansion; The stripe number of the data element at its end position before expansion is determined by the following formula: y=(slba+stripe_size`) / stripe_size Where y is the stripe number of the data element at the end position before expansion, slba is the start position of the data element, stripe_size is the stripe size after expansion, and stripe_size is the stripe size before expansion; Based on the stripe number of the data element at its starting position before expansion and the stripe number at its ending position before expansion, at least one original stripe of the data element before expansion is determined.

5. The disk expansion method according to claim 1, characterized in that, Before restoring the bad disk data element based on at least one checksum in the original stripe and normal data elements in the original stripe to obtain the restored target data element, the method further includes: If the bad disk data element in the abnormal stripe is unique, determine whether the bad disk data element is a check digit; If the bad disk data element is not a checksum, the step of restoring the bad disk data element based on at least one checksum in the original stripe and the normal data element in the original stripe to obtain the restored target data element is performed.

6. The disk expansion method according to claim 1, characterized in that, The step of determining the target stripe based on the restored target data elements and the normal data elements in the abnormal stripe includes: A new checksum is calculated based on the restored target data element and the normal data element in the abnormal stripe; According to the checksum arrangement rules of the disk array, place the checksum at the target checksum position; Based on the target check code position of the check code, determine the first target element position of the restored target data element and the second target element position of the normal data element in the abnormal stripe; The restored target data element is placed at the first target element position, and the normal data element in the abnormal strip is placed at the second target element position to obtain the target strip.

7. The disk expansion method according to claim 1, characterized in that, The step of migrating the target stripe stored in the reserved area to the expanded target disk array under the condition of meeting the preset migration conditions includes: Once all abnormal stripes have had their data elements restored and all target stripes have been written to the reserved area, the target stripes in the reserved area will be migrated to the expanded target disk array in storage order.

8. A disk expansion device, characterized in that, The device includes: The original stripe determination module is used to determine at least one original stripe before the expansion when a bad disk is detected during disk array expansion, based on the data elements in the abnormal stripe containing the bad disk after expansion; wherein, the original stripe includes the data elements, and the data elements include bad disk data elements and normal data elements; The data element restoration module is used to restore the bad disk data element based on at least one check code in the original stripe and the normal data element in the original stripe, so as to obtain the restored target data element. The target stripe determination module is used to determine the target stripe based on the restored target data elements and the normal data elements in the abnormal stripe; A reserved area writing module is used to write the target stripe into the reserved area of ​​any normal disk; wherein, the reserved area includes at least one stripe for temporarily storing recovery data; The migration module is used to migrate the target stripe stored in the reserved area to the expanded target disk array when the preset migration conditions are met.

9. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the steps of the disk expansion method as described in any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the disk expansion method as described in any one of claims 1 to 7.

Citation Information

Cited By

  • Disk array capacity expansion method and device, electronic equipment and medium

    CN122086331A