A method, apparatus, electronic device, and storage medium for reducing the size of a disk array.

By determining the retention matrix and migration coordinates during disk array shrinking, the amount of data to be migrated is reduced, solving the problem of low efficiency caused by large amounts of data migration in existing technologies, and achieving efficient disk array shrinking.

CN122131973APending Publication Date: 2026-06-02SHANDONG YUNHAI GUOCHUANG CLOUD COMPUTING EQUIP IND INNOVATION CENT CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHANDONG YUNHAI GUOCHUANG CLOUD COMPUTING EQUIP IND INNOVATION CENT CO LTD
Filing Date
2026-01-30
Publication Date
2026-06-02

AI Technical Summary

Technical Problem

In existing technologies, the amount of data to be migrated during disk array downsizing is large, resulting in low efficiency of the downsizing operation.

Method used

By acquiring the disk array and target information before scaling down, the retention matrix and the data to be migrated are determined. The target retention array is determined based on the disk array and retention matrix before scaling down, and the migration coordinates are calculated for the data to be migrated. Data migration is performed based on the target retention array to reduce the amount of data to be migrated and adjust the physical order of data blocks.

Benefits of technology

It reduces disk read/write operations, improves scaling efficiency, ensures data integrity, supports online scaling, has low resource consumption, reduces system performance impact, maximizes the use of free storage space, and reduces storage fragmentation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122131973A_ABST
    Figure CN122131973A_ABST
Patent Text Reader

Abstract

This invention relates to the field of computer technology and discloses a disk array downsizing method, apparatus, electronic device, and storage medium. Based on the total number of stripes and disks in the disk array before downsizing, as well as the downsizing target information, a retention matrix and multiple data to be migrated are determined. Based on the disk array before downsizing and the retention matrix, a target retention array is determined. Since the physical order of data blocks can be adjusted after downsizing, only data blocks from the disks to be migrated are considered as data to be migrated. For any data to be migrated, migration coordinates are calculated based on the total number of stripes, the total number of disks, and the corresponding original coordinates. Based on the target retention array, the data to be migrated is migrated according to the migration coordinates to obtain the target migration array, thereby determining the target disk array after downsizing. Because the target retention array retains the data from the un-downsized disks, and only the data to be migrated is migrated, the amount of data to be migrated is reduced, thereby reducing the number of disk read / write operations and improving disk downsizing efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and specifically to a method, apparatus, electronic device, and storage medium for reducing the size of a disk array. Background Technology

[0002] When a disk array is created, its capacity and logical address distribution are fixed. As the business uses it, it may need to be changed. If the capacity of the array created at the beginning is much greater than the actual needs, and it is necessary to reduce the number of disks to achieve the purpose of shrinking the capacity, the data stored at higher physical addresses needs to be moved to the free area at lower addresses, thereby achieving disk shrinking.

[0003] In related technologies, the number of data items remains unchanged and the physical order is consistent during the shrinking process. The entire migration process requires migrating data one by one from high-order stripes to low-order conditions, which involves a large amount of data migration. This leads to an increase in the number of disk read / write operations and reduces the efficiency of the shrinking operation. Summary of the Invention

[0004] This application provides a disk array scaling-down method, apparatus, electronic device, and storage medium to at least solve the problem in the related art of low scaling-down efficiency caused by large amounts of data migration during scaling-down.

[0005] This application provides a method for reducing the size of a disk array, including:

[0006] Obtain information about the disk array before and the target array before scaling down; Based on the total number of stripes and disks represented by the disk array before scaling down, as well as the scaling down target information, determine the retention matrix and multiple data to be migrated; Determine the target reserved array based on the disk array before shrinkage and the reserved matrix; For any data to be migrated, the migration coordinates corresponding to the data to be migrated are determined based on the total number of stripes, the total number of disks, and the original coordinates of the data to be migrated as represented by the disk array before scaling down. Based on the target retention array, the data to be migrated is migrated according to the corresponding migration coordinates to obtain the target migration array; the target migration array has new stripes relative to the target retention array, and the new stripes are composed of the data to be migrated; Based on the target migration array, the target disk array to be scaled down is determined. This application also provides a disk array scaling-down device, comprising: The acquisition module is used to acquire information about the disk array before and the target of the downsizing. The first determining module is used to determine the retention matrix and multiple data to be migrated based on the total number of stripes and the total number of disks represented by the disk array before the downsizing, as well as the downsizing target information. The second determining module is used to determine the target reserved array based on the disk array before shrinkage and the reserved matrix; The third determination module is used to determine the migration coordinates of any data to be migrated based on the total number of stripes, the total number of disks, and the original coordinates of the data to be migrated before the reduction of the disk array. The migration module is used to migrate the data to be migrated according to the corresponding migration coordinates based on the target retention array to obtain the target migration array; wherein, the target migration array has new stripes relative to the target retention array, and the new stripes are composed of the data to be migrated; The fourth determination module is used to determine the scaled-down target disk array based on the target migration array.

[0007] This application also provides an electronic device, including: a memory for storing a computer program; and a processor for executing the computer program to implement the steps of any of the disk array scaling-down methods described above.

[0008] This application also provides a computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, it implements the steps of any of the disk array scaling-down methods described above.

[0009] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of any of the disk array scaling-down methods described above.

[0010] This application achieves the following: by determining the retention matrix and multiple data to be migrated based on the total number of stripes and disks represented by the disk array before scaling down, as well as the scaling down target information, and by determining the target retention array based on the disk array before scaling down and the retention matrix, the physical order of data blocks after scaling down can be adjusted. Only the data blocks of the disks to be migrated are considered as the data to be migrated. For any data to be migrated, the migration coordinates are calculated based on the total number of stripes, the total number of disks, and the corresponding original coordinates. Based on the target retention array, the data to be migrated is migrated according to the migration coordinates to obtain the target migration array, thereby determining the target disk array after scaling down. Since the data of the disks not scaled down is retained by the target retention array, and only the data to be migrated is migrated, the amount of data that needs to be migrated is reduced, thereby reducing the number of disk read / write operations and improving the efficiency of disk scaling down. 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 This is a schematic diagram of the disk array scaling-down system on which the embodiments of this application are based; Figure 2 It is a schematic flowchart of the method for reducing the capacity of a disk array provided by an embodiment of the present application; Figure 3 It is a schematic structural diagram of the device for reducing the capacity of a disk array provided by an embodiment of the present application; Figure 4 It is a schematic structural diagram of an electronic device provided by an embodiment of the present application. Detailed implementation manners

[0013] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the protection scope of the present application.

[0014] It should be noted that in the description of the present application, the terms "include", "comprise" or any other variant thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements but also includes other elements not explicitly listed, or further includes elements inherent to such process, method, article or device. The terms "first", "second", etc. in the present application are used to distinguish similar objects and are not used to describe a specific order or sequence.

[0015] Before creating an array, its capacity often cannot be accurately estimated and may need to be changed later with business use. After the array is created, its available capacity and the distribution of logical block addresses (Logical Block Address, abbreviated as: LBA) are determined. If the capacity of the initially created array is much larger than the actual requirement and disk capacity reduction is needed, the data in a certain LBA x will be overwritten by the data in a lower-position LBA y (y < x), and at this time, the data in the LBA x has not been backed up or copied, which causes damage to user data.

[0016] In the related art, during capacity reduction, the number of data remains unchanged and the physical order is the same. The entire migration process needs to migrate data one by one from the high-order strip to the low-order strip, involving a large amount of migrated data, which in turn increases the number of disk reads and writes and reduces the efficiency of the capacity reduction operation.

[0017] To address the aforementioned technical problems, this application provides a disk array downsizing method, apparatus, electronic device, and storage medium. The method includes: acquiring disk array information before downsizing and target downsizing information; determining a retention matrix and multiple data sets to be migrated based on the total number of stripes and disks represented by the disk array before downsizing, and the target downsizing information; determining a target retention array based on the disk array before downsizing and the retention matrix; for any data set to be migrated, determining the migration coordinates corresponding to the data set to be migrated based on the total number of stripes and disks represented by the disk array before downsizing, and the original coordinates of the data set to be migrated; migrating the data set to be migrated according to the corresponding migration coordinates based on the target retention array to obtain a target migration array; wherein the target migration array has additional stripes relative to the target retention array, and the additional stripes consist of data sets to be migrated; and determining the target disk array after downsizing based on the target migration array. The method provided by the above scheme determines the retention matrix and multiple data to be migrated based on the total number of stripes and disks represented by the disk array before scaling down, as well as the scaling down target information. Based on the disk array before scaling down and the retention matrix, the target retention array is determined. Since the physical order of data blocks after scaling down can be adjusted, only the data blocks of the disks to be migrated are considered as data to be migrated. For any data to be migrated, the migration coordinates are calculated based on the total number of stripes, the total number of disks, and the corresponding original coordinates. Based on the target retention array, the data to be migrated is migrated according to the migration coordinates to obtain the target migration array, and then the target disk array after scaling down is determined. Since the data of the disks that have not been scaled down is retained by the target retention array, and only the data to be migrated is migrated, the amount of data that needs to be migrated is reduced, thereby reducing the number of disk read and write operations and improving the efficiency of disk scaling down.

[0018] To enable those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0019] The specific application environment architecture or specific hardware architecture on which the disk array scaling down method depends is described here.

[0020] First, the structure of the disk array scaling system on which this application is based will be described: The disk array scaling-down method, apparatus, electronic device, and storage medium provided in this application are applicable to disk array scaling-down. Figure 1 The diagram shows the structure of a disk array scaling-down system based on an embodiment of this application. It mainly includes a disk array to be scaled down, a data acquisition device, and a disk array scaling-down device. The data acquisition device is used to acquire information about the disk array before scaling down and the target scaling-down information. The disk array scaling-down device is used to scale down the disk array based on the disk array scaling-down method provided in this embodiment of the application.

[0021] This application provides a method for reducing the size of a disk array. The execution subject of this application is an electronic device, such as a server, desktop computer, laptop computer, tablet computer, or other electronic devices that can be used for disk array reduction.

[0022] like Figure 2 The diagram shown is a flowchart illustrating a disk array scaling-down method provided in an embodiment of this application. The method includes: Step 201: Obtain information about the disk array before scaling down and the target array for scaling down.

[0023] Specifically, the downsizing target information includes the number of disks to be migrated and their corresponding sequence numbers. The disks to be migrated are the disks corresponding to the data blocks that need to be migrated. This includes disks removed due to downsizing, and also the last disk in the disk array after disk removal, as the last disk is used to store checksums. The data blocks involved in the disks to be migrated are also considered. After disk downsizing, the number of data blocks must remain unchanged, but the physical order can be changed; that is, only the data blocks involved in the disks to be migrated are migrated.

[0024] Step 202: Based on the total number of stripes and total number of disks represented by the disk array before scaling down, and the scaling down target information, determine the retention matrix and multiple data to be migrated.

[0025] Specifically, the data to be migrated consists of all data blocks on the disk to be migrated. Before scaling down, the disk array comprised at least one stripe and at least one disk; the total number of stripes is [data missing]. The total number of disks is indicated by... This indicates that the dimensions of the disk array before scaling down were... The last disk is used to store the parity block. An exemplary disk array before scaling down is shown in Table 1: Table 1. Exemplary disk arrays before scaling down

[0026] In the exemplary disk array before scaling down, the total number of stripes is 6, the total number of disks is 5, disks D0-D3 are used to store data content E0-E23, and disk D4 is used to store parity blocks P0-P5. Based on the disk array before scaling down and the scaling down target information, the disk to be removed is determined to be D4, and the last disk in the disk array after removal is D3, which is used to store the new parity blocks. Therefore, the disks to be migrated are D4 and D3. Since no data blocks are stored in disk D4, there is no data to be migrated. The multiple data blocks stored on disk D3 in the disk array before scaling down are considered as data to be migrated. The data on disks D0-D2 after scaling down has not been migrated. Therefore, the data blocks stored on disks D0-D2 are the data blocks to be retained. Through a retention matrix, the position of the data blocks to be retained is determined to be 1, the position of the data blocks to be migrated is determined to be 0, and the position of the original parity blocks is determined to be 0. The dimension of the retention matrix is ​​the same as the dimension of the disk array before scaling down, i.e. .

[0027] Correspondingly, by using the retention matrix to determine the position of the data block to be retained as 1, the data to be retained is retained, avoiding the migration of a large amount of data, reducing the number of data read and write operations, and improving the efficiency of disk shrinkage.

[0028] Step 203: Determine the target reserved array based on the disk array before shrinkage and the reserved matrix.

[0029] Specifically, the corresponding matrix is ​​determined based on the disk array before scaling down. Based on this matrix and the retention matrix, the corresponding target retention array is determined. The target retention array contains data that has not been migrated.

[0030] Taking the disk array before scaling down as shown in Table 1 above as an example, its corresponding matrix is ​​as follows:

[0031] Step 204: For any of the data to be migrated, determine the migration coordinates corresponding to the data to be migrated based on the total number of stripes, the total number of disks, and the original coordinates of the data to be migrated before the downsizing of the disk array.

[0032] Step 205: Based on the target retention array, the data to be migrated is migrated according to the corresponding migration coordinates to obtain the target migration array; wherein, the target migration array has new stripes relative to the target retention array, and the new stripes are composed of the data to be migrated.

[0033] Specifically, the original coordinates of the data to be migrated are the coordinate positions of the matrix corresponding to the data in the disk array before scaling down, and the migration coordinates of the data to be migrated are the coordinate positions in the target migration array. Based on the target retained array, the data to be migrated is migrated to the newly added stripes in sequence.

[0034] Accordingly, by migrating the data to be migrated to the new stripe of the target migration array, the risk of low address data overwriting high address data during the migration process is avoided, ensuring that user data is not lost.

[0035] Step 206: Determine the scaled-down target disk array based on the target migration array.

[0036] Accordingly, since the order of data blocks can be changed after scaling down, only the data blocks on the disk to be migrated are considered as the data blocks to be migrated, and data migration can be performed according to the migration coordinates. Compared to ensuring that the physical order of data blocks remains consistent after scaling down, the amount of data to be migrated is reduced, and the number of read / write operations is reduced. Down to Taking the disk array before scaling down as shown in Table 1 above as an example, if the physical order is kept consistent during data migration, the corresponding number of reads is 23 and the number of writes is 29. According to the method of this application, the corresponding number of reads is 12 and the number of writes is 14, which is reduced by more than 50%.

[0037] Furthermore, this application supports online scaling down without affecting business operations and with low resource consumption, thereby reducing the impact on system performance. Through batch migration and dynamic verification updates, it maximizes the utilization of idle strips and reduces storage fragmentation.

[0038] Based on the above embodiments, as an implementable approach, in one embodiment, a retention matrix and multiple data to be migrated are determined according to the total number of stripes and the total number of disks characterized by the disk array before scaling down, and the scaling down target information, including: Step 2021: Determine the retention matrix based on the total number of stripes and disks represented by the disk array before shrinkage, and the shrinkage intensity represented by the shrinkage target information; Step 2022: Based on the total number of disks represented by the disk array before scaling down and the disks to be migrated represented by the scaling down target information, determine multiple data to be migrated.

[0039] Specifically, in one embodiment, the retention matrix can be determined based on the following formula:

[0040] in, Represents the retained matrix. This indicates the total number of disks in the disk array before scaling down. This represents the total number of stripes in the disk array before scaling down, and 'a' represents the scaling down effort indicated by the target information. This indicates that the coordinates of the matrix elements are retained. Indicates the strip number of the retained matrix element. This indicates the disk index of the retained matrix element.

[0041] Specifically, the scaling down is determined by the number of disks to be migrated. Since the number of data blocks must remain unchanged after scaling down, but the physical order can be different, only the data to be migrated needs to be migrated. Therefore, through... Iterate through each element of the disk array before scaling down, keeping non-migrating data unchanged and setting it to 1, while setting migrating data to 0.

[0042] Taking the disk array before scaling down as shown in Table 1 above as an example, its corresponding retention matrix is ​​as follows:

[0043] Accordingly, by iterating through each element sequentially, data that has not been migrated is identified as 1, and data that has been migrated is identified as 0, thus achieving data retention. By retaining the data, large amounts of data are avoided from being migrated, reducing the number of data read and write operations and improving the efficiency of disk shrinkage.

[0044] In some alternative implementations, step 2022 above includes: Step b1: Determine the migration cycle based on the total number of disks represented by the disk array before the downsizing and the number of disks to be migrated represented by the downsizing target information. Step b2: Based on the disk array before scaling down and the migration cycle, identify multiple data items to be migrated.

[0045] Specifically, the migration cycle is determined based on the following formula:

[0046] in, Indicates the migration cycle. Indicates the total number of disks. This indicates the number of disks to be migrated representing the shrinkage target.

[0047] Specifically, the migration period is k, and the migration occurs every k data blocks. n consecutive data blocks are migrated to D0 of the high-order strip. Taking the disk array before scaling down as shown in Table 1 above as an example, the disks to be migrated are D4 and D3, and the migration cycle is determined. Then, every 3 data blocks, the data is migrated, that is, the 6 consecutive data blocks of D3 are migrated to the high-order strip D0 to D2.

[0048] For example, taking the disk array before scaling down as shown in Table 1 above, the data in D4 is periodically... The nodes are moved to higher-order strips. Specifically, E3 of strip0 is moved to D0 of strip6, E7 of strip1 is moved to D1 of strip6, and E11 of strip2 is moved to D2 of strip6. E15 of strip3 is moved to D0 of strip7, E19 of strip4 is moved to D1 of strip7, and E23 of strip5 is moved to D2 of strip7.

[0049] Accordingly, based on the migration cycle, the data to be migrated was accurately identified, reducing the number of invalid reads and writes and improving the efficiency of scaling down.

[0050] Specifically, in one embodiment, the target retention array can be determined based on the following formula:

[0051] in, Represented as the Hadamard product of matrices A and M, This represents the matrix corresponding to the disk array before scaling down. Represents the retained matrix. This indicates the target reserved array.

[0052] Specifically, the Hadamard product is performed between the matrix corresponding to the disk array before scaling down and the retention matrix, thereby retaining the data content corresponding to disks D0-D2. Taking the disk array before scaling down shown in Table 1 above as an example, its target retention array is as follows:

[0053] Specifically, in one embodiment, the migration coordinates of the data to be migrated can be determined based on the following formula:

[0054] in, Indicates the original coordinates of the data to be migrated. The corresponding data content, Indicates the migration coordinates of the data to be migrated. The corresponding data content, This indicates the total number of disks in the disk array before scaling down. This indicates the total number of stripes in the disk array before scaling down. Indicates the original stripe number. Indicates the original disk serial number. Indicates the strip number after migration. Indicates the disk serial number after migration. This indicates the migration cycle; where the migration coordinates of the data to be migrated include the stripe number and disk number after migration, and the original coordinates of the data to be migrated include the original stripe number and original disk number.

[0055] For example, taking the disk array before scaling down as shown in Table 1 above, when hour, These are the original coordinates of the data to be migrated, and the corresponding data content is E3. , Therefore, the migration coordinates were determined as follows: This means migrating the data to be migrated to the location corresponding to D0 in strip6.

[0056] Based on the above embodiments, as one implementable approach, in one embodiment, determining the scaled-down target disk array according to the target migration array includes: Step 2061: Determine the new checksum based on the original checksum corresponding to the multiple stripes characterized by the target migration array and the disk array before scaling down, and the multiple data to be migrated. Step 2062: Determine the target disk array after scaling down based on the target migration array and the new checksum.

[0057] Specifically, in one embodiment, the new checksum can be determined based on the following formula:

[0058] in, Indicates the stripe number is The new checksum of the stripe, This represents the original checksum. Indicates the stripe number is The data to be migrated corresponding to the stripes, Indicates the migration coordinates as The data to be migrated This indicates the total number of stripes in the target migration array. This indicates the total number of stripes in the disk array before scaling down. This indicates the total number of disks in the disk array before scaling down.

[0059] Specifically, the data content of the target migration array is verified to obtain new checksums for each stripe. The checksums for the original stripes are then processed using... The new checksum is obtained by XORing the original checksum corresponding to the stripe with the data to be migrated corresponding to that stripe. For the checksum of the newly added stripe, the following method is used: This involves XORing the data blocks of that stripe in the target migration array to obtain the corresponding new checksum.

[0060] For example, taking the disk array before size reduction shown in Table 1 above as an example, when hour, ,in, The corresponding data is E3. ; when hour, .

[0061] Taking the disk array before scaling down as shown in Table 1 above as an example, the corresponding target migration array is as follows:

[0062] Accordingly, for the stripe corresponding to the target reserved array, the original check code and the data to be migrated are XORed to directly update the check block without reading the full data, thereby reducing the amount of data read and improving the efficiency of disk shrinkage.

[0063] Specifically, in one embodiment, the process of shrinking the disk array may be subject to the risk of system power failure or disk failure. Therefore, during the data block migration process, the management information corresponding to the data to be migrated is saved, including the data content, original coordinates and migration coordinates of the data to be migrated. After all the data to be migrated is confirmed to be written to the target location, the management information is released, so that in the event of a failure, the data to be migrated can be recovered based on the management information, thus avoiding data loss due to failure during the shrinking process.

[0064] Specifically, in one embodiment, for Reed-Solomon codes or LRC (Local Reconstruction Codes), local verification updates can be used to reduce the computational load during scaling down. For example, only the affected data blocks are updated instead of being fully re-encoded.

[0065] Furthermore, for dual-parity systems such as RAID6, a two-layer dynamic parity update mechanism can be implemented. For example, P and Q parities can be updated simultaneously, and migration rules can be optimized to adapt to the scaling-down scenario of multiple parity blocks.

[0066] The disk array scaling-down method provided in this application includes: acquiring disk array information before scaling-down and scaling-down target information; determining a retention matrix and multiple data to be migrated based on the total number of stripes and total number of disks represented by the disk array before scaling-down and the scaling-down target information; determining a target retention array based on the disk array before scaling-down and the retention matrix; for any data to be migrated, determining the migration coordinates corresponding to the data to be migrated based on the total number of stripes and total number of disks represented by the disk array before scaling-down and the original coordinates of the data to be migrated; migrating the data to be migrated according to the corresponding migration coordinates based on the target retention array to obtain a target migration array; wherein the target migration array has additional stripes relative to the target retention array, and the additional stripes are composed of data to be migrated; and determining the target disk array after scaling-down based on the target migration array. The method provided by the above scheme determines the retention matrix and multiple data to be migrated based on the total number of stripes and disks represented by the disk array before scaling down, as well as the scaling down target information. Based on the disk array before scaling down and the retention matrix, the target retention array is determined. Since the physical order of data blocks after scaling down can be adjusted, only the data blocks of the disks to be migrated are considered as data to be migrated. For any data to be migrated, the migration coordinates are calculated based on the total number of stripes, the total number of disks, and the corresponding original coordinates. Based on the target retention array, the data to be migrated is migrated according to the migration coordinates to obtain the target migration array, and then the target disk array after scaling down is determined. Since the data of the disks that have not been scaled down is retained by the target retention array, and only the data to be migrated is migrated, the amount of data that needs to be migrated is reduced, thereby reducing the number of disk read and write operations and improving the efficiency of disk scaling down.

[0067] Furthermore, by using a retention matrix to determine the location of the data blocks to be retained, the data to be retained is preserved, avoiding the migration of large amounts of data, reducing the number of data read / write operations, and improving the efficiency of disk shrinking. By migrating the data to be migrated to the newly added stripe of the target migration array, the risk of low-address data overwriting high-address data during the migration process is avoided, ensuring that user data is not lost. Since the order of data blocks can be changed after shrinking, only the data blocks of the disk to be migrated are used as the data blocks to be migrated, and data migration can be performed according to the migration coordinates. Compared to ensuring that the physical order of data blocks remains consistent after shrinking, the amount of data to be migrated is reduced, and the number of read / write operations is reduced. Down to Taking the disk array before scaling down as shown in Table 1 above as an example, if the physical order is kept consistent during data migration, the corresponding number of reads is 23 and the number of writes is 29. Following the method of this application, the corresponding number of reads is 12 and the number of writes is 14, a reduction of more than 50%. Simultaneously, this application supports online scaling down, with no impact on business operations and low resource consumption, thus reducing the impact on system performance. Through batch migration and dynamic verification updates, idle strips are maximized, reducing storage fragmentation. By sequentially traversing each element, data that has not been migrated is marked as 1, and data that has been migrated is marked as 0, achieving data retention. This data retention avoids migrating large amounts of data, reducing the number of data reads and writes and improving the efficiency of disk scaling down. Based on the migration cycle, the data to be migrated is accurately determined, reducing the number of invalid reads and writes and improving the efficiency of scaling down. For the stripes corresponding to the target retained array, the original checksum and the data to be migrated are XORed, enabling direct updating of the checksum block without reading the entire data, thus reducing the amount of data read and improving the efficiency of disk scaling down.

[0068] 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.

[0069] The embodiments of this application also provide a disk array shrinkage device for performing the disk array shrinkage method provided in the above embodiments.

[0070] like Figure 3 The diagram shown is a schematic representation of the disk array scaling-down device provided in this embodiment of the application. The disk array scaling-down device 30 includes: an acquisition module 301, a first determination module 302, a second determination module 303, a third determination module 304, a migration module 305, and a fourth determination module 306.

[0071] The system comprises the following modules: an acquisition module for acquiring information about the disk array before scaling down and the target scaling down module; a first determination module for determining a retention matrix and multiple data sets to be migrated based on the total number of stripes and disks represented by the disk array before scaling down and the target scaling down module; a second determination module for determining a target retention array based on the disk array before scaling down and the retention matrix; a third determination module for determining the migration coordinates corresponding to any data set to be migrated based on the total number of stripes and disks represented by the disk array before scaling down and the original coordinates of the data set; a migration module for migrating the data set to be migrated according to the corresponding migration coordinates based on the target retention array to obtain a target migration array; wherein the target migration array has additional stripes relative to the target retention array, and the additional stripes are composed of data sets to be migrated; and a fourth determination module for determining the target disk array after scaling down based on the target migration array.

[0072] For a description of the features in the embodiment corresponding to the disk array shrinkage device, please refer to the relevant description of the embodiment corresponding to the disk array shrinkage method, which will not be repeated here.

[0073] Embodiments of this application also provide an electronic device, such as... Figure 4 The diagram shown is a schematic diagram of the structure of an electronic device provided in an embodiment of this application, including a processor 10 and a memory 20. The memory 20 stores a computer program, and the processor 10 is configured to run the computer program to execute the steps in any of the disk array scaling-down method embodiments described above.

[0074] 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 array scaling-down method embodiments described above when running.

[0075] 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.

[0076] 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 array scaling-down method embodiments described above.

[0077] 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 array scaling-down method embodiments described above.

[0078] 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.

[0079] The foregoing has provided a detailed description of a disk array scaling method, apparatus, electronic device, and storage medium provided in this application. 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 aid in understanding 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 reducing the size of a disk array, characterized in that, The method includes: Obtain information about the disk array before and the target array before scaling down; Based on the total number of stripes and total number of disks represented by the disk array before scaling down, as well as the scaling down target information, a retention matrix and multiple data to be migrated are determined. Based on the disk array before scaling down and the retention matrix, determine the target retention array; For any of the data to be migrated, the migration coordinates corresponding to the data to be migrated are determined based on the total number of stripes, the total number of disks, and the original coordinates of the data to be migrated before the reduction in size of the disk array. Based on the target retention array, the data to be migrated is migrated according to the corresponding migration coordinates to obtain the target migration array; wherein, the target migration array has new stripes relative to the target retention array, and the new stripes are composed of the data to be migrated; Based on the target migration array, determine the target disk array after scaling down.

2. The disk array scaling-down method according to claim 1, characterized in that, The step of determining the retention matrix and multiple data to be migrated based on the total number of stripes and total number of disks represented by the disk array before the downsizing, and the downsizing target information, includes: The retention matrix is ​​determined based on the total number of stripes and the total number of disks represented by the disk array before the downsizing, and the downsizing intensity represented by the downsizing target information; Based on the total number of disks represented by the disk array before the downsizing and the disks to be migrated represented by the downsizing target information, multiple data items to be migrated are determined.

3. The disk array scaling-down method according to claim 2, characterized in that, The step of determining the retention matrix based on the total number of stripes and disks represented by the disk array before scaling down, and the scaling down intensity represented by the scaling down target information, includes: The retention matrix is ​​determined based on the following formula: in, Represents the retained matrix. This indicates the total number of disks in the disk array before scaling down. This indicates the total number of stripes in the disk array before scaling down, and 'a' represents the scaling down intensity characterized by the scaling down target information. This indicates that the coordinates of the matrix elements are retained. This represents the stripe number of the element in the retained matrix. This represents the disk index of the element in the reserved matrix.

4. The disk array scaling-down method according to claim 2, characterized in that, The step involves determining multiple data items to be migrated based on the total number of disks represented by the disk array before scaling down and the disks to be migrated represented by the scaling down target information, including: The migration cycle is determined based on the total number of disks represented by the disk array before the downsizing and the disks to be migrated represented by the downsizing target information. Based on the disk array before scaling down and the migration cycle, the plurality of data to be migrated are determined.

5. The disk array scaling-down method according to claim 1, characterized in that, The step of determining the target retention array based on the disk array before scaling down and the retention matrix includes: The target retention array is determined based on the following formula: in, Represented as the Hadamard product of matrices A and M, This represents the matrix corresponding to the disk array before scaling down. Represents the retained matrix. This indicates the target reserved array.

6. The disk array scaling-down method according to claim 1, characterized in that, For any of the data to be migrated, determining the migration coordinates corresponding to the data to be migrated based on the total number of stripes, the total number of disks represented by the disk array before scaling down, and the original coordinates of the data to be migrated includes: The migration coordinates of the data to be migrated are determined based on the following formula: in, Indicates the original coordinates of the data to be migrated. The corresponding data content, Indicates the migration coordinates of the data to be migrated. The corresponding data content, This indicates the total number of disks in the disk array before scaling down. This indicates the total number of stripes in the disk array before scaling down. Indicates the original stripe number. Indicates the original disk serial number. Indicates the strip number after migration. Indicates the disk serial number after migration. The migration cycle is indicated; wherein, the migration coordinates of the data to be migrated include the stripe number and disk number after migration, and the original coordinates of the data to be migrated include the original stripe number and original disk number.

7. The disk array scaling-down method according to claim 1, characterized in that, The step of determining the scaled-down target disk array based on the target migration array includes: A new checksum is determined based on the original checksums corresponding to multiple stripes characterized by the target migration array and the disk array before scaling down, and multiple data to be migrated. Based on the target migration array and the new checksum, determine the target disk array after scaling down.

8. The disk array scaling-down method according to claim 7, characterized in that, The step of determining a new checksum based on the original checksums corresponding to multiple stripes characterized by the target migration array and the disk array before scaling down, and multiple pieces of data to be migrated, includes: The new check digit is determined based on the following formula: in, Indicates the stripe number is The new checksum of the stripe, This represents the original checksum. Indicates the stripe number is The data to be migrated corresponding to the stripes, Indicates the migration coordinates as The data to be migrated This indicates the total number of stripes in the target migration array. This indicates the total number of stripes in the disk array before scaling down. This indicates the total number of disks in the disk array before scaling down.

9. A disk array reduction device, characterized in that, The device includes: The acquisition module is used to acquire information about the disk array before and the target of the downsizing. The first determining module is used to determine the retention matrix and multiple data to be migrated based on the total number of stripes and the total number of disks represented by the disk array before the downsizing, as well as the downsizing target information. The second determining module is used to determine the target reserved array based on the disk array before shrinkage and the reserved matrix; The third determining module is used to determine the migration coordinates corresponding to any of the data to be migrated based on the total number of stripes, the total number of disks, and the original coordinates of the data to be migrated before the reduction of the disk array. A migration module is used to migrate the data to be migrated according to the corresponding migration coordinates based on the target retention array to obtain a target migration array; wherein, the target migration array has new stripes relative to the target retention array, and the new stripes are composed of the data to be migrated; The fourth determining module is used to determine the scaled-down target disk array based on the target migration array.

10. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the steps of the disk array scaling-down method as described in any one of claims 1 to 8 when executing the computer program.