Disk data processing method, device, equipment and storage medium

By dividing the disk into multiple logical partitions and distributing them in groups, the problem of excessive read/write pressure on the backup disk during data recovery in distributed storage systems is solved, improving recovery efficiency and ensuring business processing speed.

CN119883099BActive Publication Date: 2025-11-11CHINA UNITED NETWORK COMM GRP CO LTD +2
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311396745.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-10-25
Publication Date
2025-11-11
Estimated Expiration
2043-10-25

AI Technical Summary

Technical Problem

In a distributed storage system, excessive read/write pressure on the disk containing backup data during data recovery can affect the normal business processing of the storage system.

Method used

Each disk is divided into multiple logical partitions, and the disks are grouped according to the logical partitions of the multiple disks, so that the backup partitions of each logical partition are distributed across as many other disks as possible, and the data of the failed disk is repaired by backing up the logical partitions.

Benefits of technology

It improves the concurrent processing efficiency of data recovery, reduces the read and write pressure on the disk where each backup partition is located, and ensures the normal business processing response speed of the storage system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119883099B_ABST
    Figure CN119883099B_ABST
Patent Text Reader

Abstract

This application provides a disk data processing method, apparatus, device, and storage medium. The electronic device includes M disks, each disk including at least two logical partitions, the M disks including N disk groups, and each disk group including logical partitions from at least two disks. Each disk group contains at least one backup partition used to back up data from other logical partitions within the disk group. The method includes: determining whether to perform data repair on a first logical partition of a first disk among the M disks; if so, obtaining the first disk group containing the first logical partition; determining a first backup logical partition of the first logical partition from the first disk group; and repairing the data of the first logical partition using backup data stored in the first backup logical partition. This method improves the concurrent processing efficiency during disk repair and reduces the read / write pressure on the disk.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing, and more particularly to a disk data processing method, apparatus, device, and storage medium. Background Technology

[0002] Distributed storage achieves high data reliability and fault tolerance by redundantly storing data across multiple disks. When one or more disks fail, backup data from other healthy disks is used for recovery, allowing the distributed storage system to continue providing business services without downtime. However, when using other disks to recover data from a failed disk, the read / write load on those other disks increases because they need to read and write all their data, impacting their normal business operations and consequently affecting the normal business operations of the entire storage system.

[0003] Therefore, how to reduce the read / write pressure on the disk where the backup data is located during data recovery and ensure the normal business processing of the storage system is an urgent problem to be solved. Summary of the Invention

[0004] This application provides a disk data processing method, apparatus, device, and storage medium to solve the technical problem of how to reduce the read / write pressure on the disk where backup data is located during data recovery and ensure the normal business processing of the storage system.

[0005] In a first aspect, this application provides a disk data processing method. An electronic device includes M disks, each disk including at least two logical partitions, the M disks including N disk groups, each disk group including logical partitions from at least two disks, wherein each disk group contains at least one backup partition used to back up data from other logical partitions within the disk group; the method includes:

[0006] Determine whether to perform data repair on the first logical partition of the first disk among the M disks;

[0007] If so, then obtain the first disk group where the first logical partition is located;

[0008] Determine the first backup logical partition of the first logical partition from the first disk group;

[0009] The data in the first logical partition is repaired using the backup data stored in the first backup logical partition.

[0010] Optionally, repairing the data in the first logical partition using the backup data stored in the first backup logical partition includes:

[0011] Based on the backup data stored in the first backup logical partition, obtain the original data of the first logical partition;

[0012] When the first disk fails and the electronic device has a backup disk, the logical partition of the backup disk is added to the first disk group, and the original data is written to the logical partition of the backup disk.

[0013] Optionally, before determining whether to perform data repair on the target logical partition of the target disk among the M disks, the method further includes:

[0014] When there is a need to build a new disk group, at least one second logical partition is determined from the M disks based on the disk groups to which each disk has been added.

[0015] Use the at least one second logical partition to construct a new disk group.

[0016] Optionally, each disk records a disk group array, where each element in the disk group array corresponds to another disk besides the disk mentioned above. When the element is a first value, it indicates that the disk has a logical partition that is added to the same disk group as the logical partition of the other disk corresponding to the element. When the element is a second value, it indicates that the disk does not have a logical partition that is added to the same disk group as the logical partition of the other disk corresponding to the element.

[0017] The step of determining at least one second logical partition from the M disks based on the disk groups to which each of the disks has been added includes:

[0018] The M disks are sorted according to the disk grouping array of each disk and the sorting rules; the sorting rules include: a first sub-sorting rule that disks with fewer disk groups are sorted first, and a second sub-sorting rule that disks with the same number of disk groups are sorted according to their identifier order.

[0019] The candidate disk list is obtained by removing disks with no free logical partitions from the sorted M disks.

[0020] A second logical partition is determined from the candidate disk list, and the disk to which the determined second logical partition belongs is removed from the candidate disk list;

[0021] Based on the updated list of candidate disks, a second logical partition is determined, and this process continues until the number of determined second logical partitions meets the requirements for building a new disk group.

[0022] Optionally, after constructing a new disk group using the at least one second logical partition, the method further includes:

[0023] Update the disk grouping array of the disks based on the newly constructed disk groupings.

[0024] Optionally, the method further includes:

[0025] If the electronic device adds a new disk, iterate through the existing disk groups to see if there is a target disk group with insufficient logical partitions;

[0026] If it exists, add the logical partition of the new disk to the target disk group, and update the disk group array of the new disk, as well as the disk group array of the M disks;

[0027] If it does not exist, then all elements in the disk grouping array of the new disk are set to the second value, and the disk grouping arrays of the M disks are updated.

[0028] Optionally, determining a second logical partition from the candidate disk list includes:

[0029] A second logical partition is determined from the free logical partitions of the first candidate disk in the candidate disk list.

[0030] Secondly, this application provides a disk data processing apparatus, the electronic device including M disks, each disk including at least two logical partitions, the M disks including N disk groups, each disk group including logical partitions from at least two disks, wherein at least one backup partition exists in each disk group, the backup partition being used to back up data from other logical partitions in the disk group; the apparatus includes:

[0031] The determination module is used to determine whether to perform data repair on the first logical partition of the first disk among the M disks;

[0032] The acquisition module is used to acquire the first disk group where the first logical partition is located if the condition is met.

[0033] The processing module is used to determine the first backup logical partition of the first logical partition from the first disk group;

[0034] The control module is used to repair the data in the first logical partition using the backup data stored in the first backup logical partition.

[0035] Thirdly, the processor and the memory; the processor and the memory are communicatively connected.

[0036] The memory stores computer-executed instructions;

[0037] The processor executes computer execution instructions stored in the memory to implement the method as described in any one of the first aspects.

[0038] Fourthly, this application provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the disk data processing method as described in any one of the first aspects.

[0039] Fifthly, this application provides a computer program product, which, when executed by a processor, is used to implement the disk data processing method as described in any one of the first aspects.

[0040] The disk data processing method, apparatus, device, and storage medium provided in this application divide each disk in an electronic device into multiple logical partitions, group the disks according to the multiple logical partitions of the multiple disks, and distribute the backup partitions of each logical partition of each disk as widely as possible across a large number of other disks. When a first disk in a disk group needs data repair, the first disk group corresponding to the first logical partition that needs data repair is determined, and a first backup logical partition is selected from the first disk group to repair the data of the first logical partition. This improves concurrent processing efficiency during disk repair, reduces the read and write pressure on the disk where each backup partition is located, and ensures the normal business processing response speed of the disk. Attached Figure Description

[0041] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0042] Figure 1 A schematic diagram illustrating a scenario for data repair on a faulty disk provided in this application;

[0043] Figure 2 This is a schematic diagram of a disk data processing scenario provided in an embodiment of this application;

[0044] Figure 3 A schematic flowchart illustrating a disk data processing method provided in an embodiment of this application;

[0045] Figure 4 A schematic flowchart illustrating another disk data processing method provided in an embodiment of this application;

[0046] Figure 5 A schematic flowchart illustrating another disk data processing method provided in this application embodiment;

[0047] Figure 6 A schematic flowchart illustrating another disk data processing method provided in an embodiment of this application;

[0048] Figure 7 A schematic flowchart illustrating another disk data processing method provided in an embodiment of this application;

[0049] Figure 8 This is a schematic diagram of the structure of a disk data processing device provided in an embodiment of this application;

[0050] Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.

[0051] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation

[0052] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.

[0053] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with relevant laws, regulations and standards, and corresponding operation entry points are provided for users to choose to authorize or refuse.

[0054] To facilitate understanding, the application scenarios involved in this application will be explained first.

[0055] Figure 1 This is a schematic diagram illustrating a scenario for data repair on a faulty disk, as provided in this application. Figure 1 As shown, the scenario includes: disk 1, disk 2, disk 3, disk 4, and disk 5.

[0056] In this system, disks 1 through 5 are disks within the same distributed storage system, and disks 1, 2, and 3 belong to the same disk group. Assuming disk 1 has failed, disks 2 and 3 contain backup data of the data on disk 1. This backup data could be copied data or backup data using erasure coding for data redundancy. When using erasure coding for data redundancy, the original data is divided into multiple coded segments and distributed across disks 1, 2, and 3. When disk 1 needs to recover data, the lost data segments can be reconstructed from disks 2 and 3 using the erasure coding algorithm, without directly copying the data.

[0057] When disk 1 fails, the distributed storage system needs to read all the data on disks 2 and 3, determine the backup data in disks 2 and 3 used to repair the data in disk 1, obtain the original data in disk 1 based on the backup data, and restore the function of the distributed storage system by restoring the backup data to disk 1.

[0058] However, currently, when a disk failure occurs in a distributed storage system, only the full data of other disks within the same disk group as the failed disk can be read to obtain backup data for recovery of the original data on the failed disk. This results in low concurrency and inefficient disk recovery. Furthermore, for each disk with backup data, the entire disk needs to be read and written during recovery, leading to significant read / write pressure on that disk and impacting its normal business processing response speed, which in turn affects the normal business processing response speed of the storage system.

[0059] In view of this, this application provides a disk data processing method, which divides each disk in an electronic device into multiple logical partitions, groups the disks according to the multiple logical partitions of the multiple disks, and distributes the backup partitions of each logical partition of each disk as widely as possible on a large number of other disks, thereby increasing the number of disks where the backup partitions of each logical partition are located. This improves the concurrent processing efficiency during disk repair, reduces the read and write pressure on the disks where each backup partition is located, and ensures the normal business processing response speed of the disk.

[0060] Figure 2 This is a schematic diagram of a disk data processing scenario provided in an embodiment of this application. The scenario includes M disks in an electronic device.

[0061] The electronic device may be, for example, a computer, a laptop, or a server. The M disks are disks for which disk groups have been created; this application does not limit whether the electronic device includes disks other than the M disks. Each of the M disks includes at least two logical partitions, and the M disks include N disk groups, each disk group including logical partitions from at least two disks. Each disk group contains at least one backup partition used to back up data from other logical partitions within that disk group.

[0062] For example, such as Figure 2 As shown, M is 6. The M disks include disk A, disk B, disk C, disk D, disk E, and disk F. Each disk is divided into 4 logical partitions. Taking disk A as an example, the four logical partitions are A0, A1, A2, and A3.

[0063] In this example, taking one disk group out of N disk groups as an example, this disk group includes logical partitions A0, B1, C0, D0, E2, and F1. This disk group can use a copy backup method, with one disk as the master disk and the others as slave disks. Backup data is stored in the corresponding logical partitions of the slave disks. When the master disk fails, the backup data in the corresponding logical partitions of the slave disks can be read to repair the corresponding logical partitions of the master disk. If this disk group uses erasure coding backup, then when any disk in this disk group fails, the backup data of the corresponding logical partitions of the other disks can be read to obtain the original data of the logical partitions of this disk group from the failed disk, thus repairing the disk group.

[0064] It should be understood that different logical partitions of each disk can be divided into different disk groups, and the division of these logical partitions can also be determined according to actual needs.

[0065] The following is based on Figure 2 Taking this scenario as an example, and the electronic device containing the M disks as the execution entity, the technical solution of this application and how it solves the aforementioned technical problems will be described in detail through specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.

[0066] Figure 3 This is a flowchart illustrating a disk data processing method provided in an embodiment of this application, as shown below. Figure 3 As shown, the method includes:

[0067] S301. Determine whether to perform data repair on the first logical partition of the first disk among the M disks.

[0068] The first disk can be any of the M disks. The electronic device can determine whether data repair of the first logical partition of the first disk is necessary by detecting faults in the first disk. For example, if a fault is detected in the first disk or its first logical partition, data repair of the first logical partition of the first disk is required. Alternatively, the electronic device can determine whether data repair of the first logical partition of the first disk is necessary by analyzing read / write operations on the first disk or its first logical partition. When read / write operations are abnormal, such as being unable to perform read / write operations, the read / write speed being lower than a preset speed threshold, or the read data being corrupted or abnormal, data repair of the first logical partition of the first disk is required.

[0069] S302. If so, then obtain the first disk group where the first logical partition is located.

[0070] If data repair is required on the first logical partition of the first disk among M disks, the first disk group where the first logical partition is located can be obtained according to the disk group record. The disk group record can be recorded in the database or in the disk log. If it is recorded in the disk log, the disk log can be recorded in other storage locations outside the M disks, such as other disks or other devices connected to the electronic device.

[0071] The electronic device can also determine the first disk group in which the first logical partition is located based on the disk grouping operation record. For example, when performing disk grouping, the relevant content of each disk grouping operation is recorded, including the disk, logical partition, and result of the disk grouping operation.

[0072] S303. Determine the first backup logical partition of the first logical partition from the first disk group.

[0073] The first backup logical partition can be some or all of the logical partitions in the first disk group. For example, if it is a copy backup method, the first backup logical partition can be any logical partition in the first disk group that contains the copy backup data of the first logical partition, and the logical partition can be any one logical partition in the first disk group; if it is an erasure coding backup method, the logical partition can be any one, any multiple, or all of the logical partitions in the first disk group, etc.

[0074] The logic for determining the first backup logical partition can be determined according to actual needs, and this application does not impose any restrictions on it.

[0075] S304. Repair the data in the first logical partition using the backup data stored in the first backup logical partition.

[0076] The method for repairing the data in the first logical partition can be to copy the backup data as the data in the first logical partition, or to calculate the data in the first logical partition based on the backup data stored in the first backup logical partition and the association between the backup data and the data in the first logical partition.

[0077] One possible implementation involves repairing the data in the first logical partition using backup data stored in the first backup logical partition, and then transferring the repaired data to the first logical partition of the first disk. This implementation can be used when the first disk has only data errors or data loss, but the hardware of the first disk has not failed. Therefore, the repaired data can overwrite the data in the first logical partition, achieving the effect of data repair.

[0078] Another possible implementation involves repairing the data in the first logical partition using backup data stored in the first backup logical partition, and then transferring the backup disk to the backup disk, thus replacing the first disk. This implementation can be used when the first disk experiences hardware failure and can no longer provide data storage functionality. Therefore, the repaired data can be written to the backup disk, achieving the effect of data recovery. In this backup disk, the logical partitions are identical to those of the first disk, and the corresponding logical partitions of the backup disk have already been added to the first disk group.

[0079] The method provided in this application divides each disk in an electronic device into multiple logical partitions, groups the disks according to the multiple logical partitions of the multiple disks, and distributes the backup partitions of each logical partition of each disk as widely as possible across a large number of other disks. When a disk in a disk group needs data repair, the method determines the first disk group corresponding to the first logical partition that needs data repair, selects the first backup logical partition from the first disk group to repair the data of the first logical partition, thereby improving the concurrent processing efficiency during disk repair and reducing the read and write pressure on the disk where each backup partition is located, ensuring the normal business processing response speed of the disk.

[0080] The following will explain how step S304 above repairs the data of the first logical partition using the backup data stored in the first backup logical partition, by repairing the data of the first logical partition to the backup disk using the backup data stored in the first backup logical partition. Figure 4 A flowchart illustrating another disk data processing method provided in this application embodiment is shown below. Figure 4 As shown, the aforementioned step S304 may include:

[0081] S401. Obtain the original data of the first logical partition based on the backup data stored in the first backup logical partition.

[0082] The original data can be obtained through the data relationship between the backup data stored in the first backup logical partition and the original data. For example, the original data can be obtained through at least one backup data stored in the first backup logical partition, and a function that calculates the original data using the backup data. Alternatively, the original data can be obtained through an erasure coding algorithm and the backup data.

[0083] For example, taking the acquisition of original data through erasure coding algorithms and backup data as an example, the erasure coding algorithm can be, for example, the Reed-Solomon (RS) algorithm, the Cauchy Reed-Solomon (Cauchy RS) algorithm, the exclusive OR (XOR) algorithm, etc. The backup data is the redundant block or remaining data block of the original data. The original data is obtained by performing calculations and decoding operations on the backup data through the above-mentioned erasure coding algorithm. The specific type of erasure coding algorithm used can be determined according to actual needs, and this application does not impose any restrictions on it.

[0084] S402. When the first disk is damaged and the electronic device has a backup disk, the logical partition of the backup disk is added to the first disk group, and the original data is written to the logical partition of the backup disk.

[0085] If the first disk is damaged due to hardware failure, the recovered original data cannot be restored to the first disk. A disk other than the M disks is needed to replace the first disk; this disk is referred to as the backup disk. The backup disk can be originally installed in the electronic device, or it can be added to the electronic device after detecting the first disk's failure and receiving a prompt to add a backup disk.

[0086] Before using the backup disk to restore the original data, it is necessary to perform logical partitioning on the backup disk. For example, the backup disk can be divided according to the logical partitions of the first disk to reduce the impact on the storage function of the electronic device after the backup disk is replaced. Delete the first logical partition of the first disk from the first disk group and add the free logical partition of the backup disk to the first disk group to replace the first logical partition.

[0087] The following section details how to group the logical partitions in the M disks before determining whether to perform data repair on the target logical partitions of the target disks.

[0088] Figure 5 A flowchart illustrating another disk data processing method provided in this application embodiment is shown below. Figure 5As shown, before determining whether to perform data repair on the target logical partition of the target disk among the M disks, the method may further include:

[0089] S501. When there is a need to build a new disk group, determine at least one second logical partition from the M disks based on the disk groups that each disk has been added to.

[0090] The disk group information that each disk has joined may include the number of disk groups that the disk has joined, the number of disk groups that exist between the disk and any other disk, and the number of other disks that have a disk group relationship with the disk.

[0091] One possible implementation is to use a free logical partition on a disk with a smaller number of already joined disk groups as the second logical partition.

[0092] Another possible implementation is to use the free logical partition in a disk that has fewer disk groups than any other disk as the second logical partition.

[0093] Another possible implementation involves determining the number of other disks that have disk grouping relationships with each disk, and using the free logical partitions in the smaller number of disks as the second logical partition.

[0094] Optionally, the above three implementation methods can be combined. First, a portion of the second logical partitions can be determined according to one method, and then the remaining second logical partitions can be determined according to other methods, etc.

[0095] S502, Use at least one second logical partition to construct a new disk group.

[0096] The number of second logical partitions included in this new disk group can be determined according to actual needs, and this application does not impose any restrictions on this. After constructing the multiple second logical partitions into a new disk group, the logical partitions included in this disk group can be used for data backup, data recovery, etc.

[0097] exist Figure 5 In the implementation shown, in order to improve the concurrency of data during backup data recovery, thereby improving recovery efficiency and reducing the read and write pressure on each disk during backup data recovery, the data can be backed up to as many disks as possible in the manner described in step S501 to achieve the above effects.

[0098] Below, to achieve the above effect, we will explain in detail using the example of each disk recording a disk group array. Each element in this disk group array corresponds to another disk besides the current disk. When the element has a first value, it indicates that a logical partition on this disk has been added to the same disk group as the logical partition on the other disk corresponding to that element. When the element has a second value, it indicates that no logical partition on this disk has been added to the same disk group as the logical partition on the other disk corresponding to that element. Continuing from the previous explanation... Figure 2 Taking a disk group array including A(1,1,1,1,0), B(1,1,0,0,0), C(1,1,0,0,0), D(1,0,0,1,0), E(1,0,0,1,0), and F(0,0,0,0,0) as an example, this section explains how step S501 determines at least one second logical partition from M disks based on the disk groups to which each disk has been added. Specifically, disk A has one logical partition located in the same disk group as disks B, C, D, and E.

[0099] Figure 6 This is a flowchart illustrating another disk data processing method provided in an embodiment of this application, as shown below. Figure 6 As shown, the aforementioned step S501 may further include:

[0100] S601. Sort the M disks according to the disk grouping array of each disk and the sorting rules.

[0101] The sorting rules include a first sub-sorting rule that disks with fewer disk groups are sorted first, and a second sub-sorting rule that disks with the same number of disk groups are sorted according to their identifier order.

[0102] Under this sorting rule, the number of disk groups that each disk has disk grouping relationships with other disks is determined based on the disk grouping array of each disk. Sorting these disks according to the first sub-sorting rule yields the order F, B, C, D, E, A. Since B, C, D, and E each have disk grouping relationships with only two other disks, and each has only two added disk groups, their sorting rank is the same under the first sub-sorting rule. Then, according to the second sub-sorting rule, the disks with the same sorting rank under the first sub-sorting rule (i.e., B, C, D, E) are sorted according to a preset identification order (e.g., A, B, C, D, E, F). That is, the sorting of the M disks can be determined as F, B, C, D, E, A.

[0103] Optionally, the disks can be sorted first by the minimum value in each disk group array, i.e., sorted according to whether there is a 0 value among the disks. Then, they can be further sorted according to the number of minimum values ​​for each disk. Finally, they can be sorted according to the identifier order to determine the sorting of the M disks.

[0104] S602. Remove disks with no free logical partitions from the sorted M disks to obtain the candidate disk list.

[0105] The candidate disk list can be determined based on the number of disks required for the new disk group. For example, if the new disk group requires three disks, the first three disks are selected as the candidate disks according to the sorting of the M disks. However, since the disks added to the new disk group must be free logical partitions from the M disks that are not yet added to any disk group (i.e., each logical partition can only be added to one disk group), it is also necessary to remove disks without free logical partitions from the M disks after sorting to ensure that the second logical partition with a free logical partition can be selected to be added to the new disk group.

[0106] Optionally, the step of removing disks with no free logical partitions from the M disks can be performed before sorting, and this application does not limit this.

[0107] S603. Determine a second logical partition from the candidate disk list, and remove the disk to which the determined second logical partition belongs from the candidate disk list.

[0108] One possible implementation is to determine a second logical partition from the free logical partitions of the first candidate disk in the candidate disk list. For example, any free logical partition that is not included in any disk group can be selected from the aforementioned disk F as the second logical partition.

[0109] Another possible implementation is to determine a second logical partition from the free logical partitions of any candidate disk in the candidate disk list. For example, any free logical partition that is not included in any disk group can be selected from the aforementioned disks B, C, D, and E as the second logical partition.

[0110] S604. Based on the updated candidate disk list, determine a second logical partition until the number of determined second logical partitions meets the number required to build a new disk group.

[0111] One possible implementation involves determining the number of disk grouping relationships between each disk and the disk to which the first determined second logical partition belongs in the updated candidate disk list. The free logical partition of the disk with the fewest disk grouping relationships with the disk to which the second logical partition belongs in the updated candidate disk list is then selected as the next second logical partition. If the updated candidate disk list contains multiple disks with the fewest disk grouping relationships with the disk to which the second logical partition belongs, further sorting can be performed according to the method in step S601 above to finally determine the disk to which the next second logical partition belongs; this will not be elaborated further here.

[0112] Another possible implementation is to select any free logical partition from the updated candidate disk list as the next second logical partition. For example, it could be the first disk in the updated candidate disk list, or any other disk.

[0113] The method provided in this application sorts M disks using disk group arrays and sorting rules, and progressively determines the logical partitions included in new disk groups based on the disk list obtained from the sorting. This allows disks with fewer disk groups to be allocated to new disk groups first. By considering the number of disk group relationships between the disk selected for the second logical partition and other remaining disks each time, disks with fewer disk groups compared to the previously selected disks are given priority as the next disks to be selected for the second logical partition. This reduces the correlation between disks, improves the balance of creating new disk groups, and thus enhances the security of the storage system.

[0114] In the above Figure 6 In the method shown, since the method primarily relies on the disk grouping array to construct new disk groups, after constructing a new disk group using at least one second logical partition, the method may further include updating the disk grouping array for each of the aforementioned disks based on the constructed new disk group. This disk grouping array may be recorded in the operation log of the electronic device or stored in a database. The disk grouping array for each disk is updated for use in the next construction of a new disk group.

[0115] Optionally, in one possible implementation, if a new disk is added to the electronic device, the existing logical partitions in the electronic device can also be optimized using the new disk. Figure 7 This is a flowchart illustrating another disk data processing method provided in an embodiment of this application, as shown below. Figure 7 As shown, the method may further include:

[0116] S701. Traverse the existing disk groups to see if there is a target disk group with insufficient logical partitions. If it exists, it means that the target disk group needs to add a free logical partition of the new disk, and proceed to step S702; if it does not exist, it means that there is currently no disk group that does not need to add a free logical partition, and proceed to step S703.

[0117] The insufficient number of logical partitions in the target disk group could be due to insufficient free logical partitions on the disk when the target disk group was previously built, or it could be due to disk failure, resulting in unusable logical partitions in the target disk group.

[0118] If the problem is caused by insufficient free logical partitions on the disk, the target disk group can be determined based on the historical fault information of insufficient logical partitions when the target disk group was built. Alternatively, the number of target logical partitions and the number of actual logical partitions for each disk group can be recorded, and the target disk group can be determined by reading the number of target logical partitions and the number of actual logical partitions for each disk group when adding a new disk.

[0119] If the problem is caused by a disk failure, the target disk group can be determined based on the disk failure information and all disk groups corresponding to that disk.

[0120] S702. Add the logical partition of the new disk to the target disk group, and update the disk group array of the new disk and the disk group array of the M disks.

[0121] Add any free logical partition in the new disk to the target disk group, and update the disk group array of the new disk and the disk group array of the disks included in the target disk group according to the disks included in the target disk group.

[0122] Because a new disk has been added, the existing disk grouping array of M disks needs to be updated with an additional bit to indicate the relationship between the disk grouping created with the new disk. Therefore, the disk grouping array of M disks also needs to be updated.

[0123] S703. Set all elements in the disk grouping array of the new disk to the second value, and update the disk grouping array of the M disks.

[0124] For example, if the new disk is disk G, then the disk grouping array of that disk is G(0,0,0,0,0,0).

[0125] Figure 8This is a schematic diagram of a disk data processing device provided in an embodiment of this application. The electronic device includes M disks, each disk including at least two logical partitions, the M disks including N disk groups, and each disk group including logical partitions from at least two disks. Each disk group contains at least one backup partition used to back up data from other logical partitions within the disk group. Figure 8 As shown, the disk data processing device may include: a determining module 11, an acquiring module 12, a processing module 13, and a control module 14.

[0126] The determination module 11 is used to determine whether to perform data repair on the first logical partition of the first disk among the M disks.

[0127] The acquisition module 12 is used to acquire the first disk group where the first logical partition is located if the condition is met.

[0128] Processing module 13 is used to determine the first backup logical partition of the first logical partition from the first disk group.

[0129] The control module 14 is used to repair the data in the first logical partition using the backup data stored in the first backup logical partition.

[0130] In one possible implementation, the acquisition module 12 is specifically used to acquire the original data of the first logical partition based on the backup data stored in the first backup logical partition. The control module 14 is specifically used to add the logical partition of the backup disk to the first disk group and write the original data to the logical partition of the backup disk when the first disk is damaged and the electronic device has a backup disk.

[0131] In any of the above implementations, before the determining module 11 determines whether to perform data repair on the target logical partition of the target disk among the M disks, the processing module 13 is further configured to, when there is a need to construct a new disk group, determine at least one second logical partition from the M disks based on the disk groups that each disk has already joined. The control module 14 is further configured to construct a new disk group using at least one second logical partition.

[0132] In this implementation, optionally, if each disk record has a disk group array, and each element in the disk group array corresponds to another disk besides the disk itself, when the element is a first value, it indicates that the logical partition of the disk has a logical partition corresponding to the element and is added to the same disk group; when the element is a second value, it indicates that the logical partition of the disk does not have a logical partition corresponding to the element and is added to the same disk group. The processing module 13 is specifically used to sort the M disks according to the disk group array of each disk and the sorting rules. Disks without free logical partitions are removed from the sorted M disks to obtain a candidate disk list. A second logical partition is determined from the candidate disk list, and the disk to which the determined second logical partition belongs is removed from the candidate disk list. Another second logical partition is determined according to the updated candidate disk list, until the number of determined second logical partitions meets the number required to construct a new disk group. The sorting rules include: a first sub-sorting rule that disks with fewer added disk groups are sorted higher, and a second sub-sorting rule that disks with the same number of added disk groups are sorted according to their identifier order.

[0133] Optionally, the processing module 13 is specifically used to determine a second logical partition from the free logical partitions of the first candidate disk in the candidate disk list.

[0134] Optionally, the control module 14 is further configured to update the disk group array based on the newly constructed disk group after constructing a new disk group using at least one second logical partition.

[0135] Optionally, if a new disk is added to the electronic device, the processing module 13 is further configured to iterate through the existing disk groups to see if there is a target disk group with insufficient logical partitions. If so, the control module 14 is further configured to add the logical partitions of the new disk to the target disk group and update the disk group array of the new disk, as well as the disk group array of the M disks. If not, the control module 14 is further configured to set all elements in the disk group array of the new disk to the second value and update the disk group array of the M disks.

[0136] The disk data processing apparatus provided in this application embodiment can execute the disk data processing method in the above method embodiment. Its implementation principle and technical effect are similar, and will not be described again here.

[0137] Figure 9 This is a schematic diagram of an electronic device provided in an embodiment of this application. The electronic device is used to execute the aforementioned disk data processing method, and may be, for example, the electronic device described in the aforementioned method embodiments. Figure 9As shown, the electronic device 900 may include at least one processor 901 and a memory 902.

[0138] The memory 902 is used to store programs. Specifically, the program may include program code, which includes computer operation instructions.

[0139] The memory 902 may include high-speed RAM memory, and may also include non-volatile memory, such as at least one disk storage device.

[0140] The processor 901 is used to execute computer execution instructions stored in the memory 902 to implement the method described in the foregoing method embodiments. The processor 901 may be a CPU, an Application Specific Integrated Circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of this application.

[0141] In practical implementation, if the memory 902 and processor 901 are implemented independently, they can be interconnected via a bus to communicate with each other. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc., but this does not imply that there is only one bus or one type of bus.

[0142] Optionally, in a specific implementation, if the memory 902 and the processor 901 are integrated on a single chip, the memory 902 and the processor 901 can communicate through an internal interface.

[0143] This application also provides a computer-readable storage medium, which may include various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk. Specifically, the computer-readable storage medium stores program instructions, which are used in the methods described in the above embodiments.

[0144] This application also provides a program product including executable instructions stored in a readable storage medium. At least one processor of a computing device can read the executable instructions from the readable storage medium, and the execution of the executable instructions by the at least one processor causes the computing device to perform the disk data processing method described above.

[0145] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.

Claims

1. A disk data processing method, characterized in that, An electronic device includes M disks, each disk including at least two logical partitions, and the M disks including N disk groups. Each disk group includes logical partitions from at least two disks. Each disk group contains at least one backup partition used to back up data from other logical partitions within the disk group. Each disk records a disk group array, where each element corresponds to a disk other than the disk in question. When the element is a first value, it indicates that a logical partition on the disk has been added to the same disk group as the logical partition on the other disk corresponding to that element. When the element is a second value, it indicates that no logical partition on the disk has been added to the same disk group as the logical partition on the other disk corresponding to that element. The method includes: When there is a need to construct a new disk group, based on the disk groups to which each of the disks has been joined, at least one second logical partition is determined from the M disks, including: The M disks are sorted according to the disk grouping array of each disk and the sorting rules; the sorting rules include: a first sub-sorting rule that disks with fewer disk groups are sorted first, and a second sub-sorting rule that disks with the same number of disk groups are sorted according to their identifier order. Remove disks with no free logical partitions from the sorted M disks to obtain a candidate disk list; A second logical partition is determined from the candidate disk list, and the disk to which the determined second logical partition belongs is removed from the candidate disk list; Based on the updated list of candidate disks, a second logical partition is determined until the number of determined second logical partitions meets the number required to build a new disk group. Use the at least one second logical partition to construct a new disk group; Determine whether to perform data repair on the first logical partition of the first disk among the M disks; If so, then obtain the first disk group where the first logical partition is located; Determine the first backup logical partition of the first logical partition from the first disk group; The data in the first logical partition is repaired using the backup data stored in the first backup logical partition.

2. The method according to claim 1, characterized in that, The step of repairing the data in the first logical partition using backup data stored in the first backup logical partition includes: Based on the backup data stored in the first backup logical partition, obtain the original data of the first logical partition; When the first disk fails and the electronic device has a backup disk, the logical partition of the backup disk is added to the first disk group, and the original data is written to the logical partition of the backup disk.

3. The method according to claim 1, characterized in that, After constructing the new disk group using the at least one second logical partition, the method further includes: Update the disk grouping array of the disks based on the newly constructed disk grouping.

4. The method according to claim 3, characterized in that, The method further includes: If the electronic device adds a new disk, iterate through the existing disk groups to see if there is a target disk group with insufficient logical partitions; If it exists, add the logical partition of the new disk to the target disk group, and update the disk group array of the new disk, as well as the disk group array of the M disks; If it does not exist, then all elements in the disk grouping array of the new disk are set to the second value, and the disk grouping arrays of the M disks are updated.

5. The method according to claim 3, characterized in that, Determining a second logical partition from the candidate disk list includes: A second logical partition is determined from the free logical partitions of the first candidate disk in the candidate disk list.

6. A disk data processing apparatus, characterized in that, An electronic device includes M disks, each disk including at least two logical partitions, and the M disks including N disk groups. Each disk group includes logical partitions from at least two disks. Each disk group contains at least one backup partition used to back up data from other logical partitions within the disk group. Each disk records a disk group array, where each element corresponds to a disk other than the disk in question. When the element is a first value, it indicates that a logical partition on the disk has been added to the same disk group as the logical partition on the other disk corresponding to that element. When the element is a second value, it indicates that no logical partition on the disk has been added to the same disk group as the logical partition on the other disk corresponding to that element. The device includes: A determining module is configured to, when there is a need to construct a new disk group, determine at least one second logical partition from the M disks based on the disk groups to which each disk has been added, including: sorting the M disks according to the disk group array of each disk and a sorting rule; the sorting rule includes a first sub-sorting rule that disks with fewer added disk groups are sorted first, and a second sub-sorting rule that disks with the same number of added disk groups are sorted according to their identifier order; removing disks without free logical partitions from the sorted M disks to obtain a candidate disk list; determining a second logical partition from the candidate disk list and removing the disk to which the determined second logical partition belongs from the candidate disk list; determining another second logical partition based on the updated candidate disk list, until the number of determined second logical partitions meets the number required to construct a new disk group; and using the at least one second logical partition to construct a new disk group. The determining module is further configured to determine whether to perform data repair on the first logical partition of the first disk among the M disks; The acquisition module is used to acquire the first disk group where the first logical partition is located if the condition is met. The processing module is used to determine the first backup logical partition of the first logical partition from the first disk group; The control module is used to repair the data in the first logical partition using the backup data stored in the first backup logical partition.

7. An electronic device, characterized in that, include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory to implement the method as described in any one of claims 1 to 6.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Backup management for a plurality of logical partitions

    CN104252319A

  • Method, device and terminal for detecting and recovering data damage of high-security partition

    CN114518977A