Data recovery method, data recovery system and computing equipment
By optimizing the data replication and reconstruction method of failed disks in RAID, the problem of long reconstruction time is solved and more efficient data recovery is achieved.
Patent Information
- Application Number
- CN202410114513.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-25
- Publication Date
- 2025-07-25
AI Technical Summary
During the reconstruction process of RAID, the amount of data reading and reconstruction calculation is large, resulting in a long reconstruction time and low data recovery efficiency.
The data that can be read in the failed disk is restored to the third disk in a replica manner, while the data that cannot be read is restored to the third disk in a reconfigurable manner, reducing the amount of data read and reconstruction calculation.
Shorten the data reconstruction time and improve data recovery efficiency.
Smart Images

Figure CN120371599A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of data storage, and particularly to a data recovery method, a data recovery system, and a computing device. Background Art
[0002] In the field of storage, a redundant array of independent disks (RAID) is a commonly used storage system. The RAID includes multiple main disks, and the data stored in the multiple main disks is interrelated. When a disk fails, all the data stored in the failed disk can be reconstructed based on the data stored in other disks. Therefore, the RAID can ensure the security and reliability of data.
[0003] However, the reconstruction process of the RAID includes reading data from normal disks and reconstruction calculations to reconstruct all the data stored in the failed disk. The amount of data read and the amount of reconstruction calculation are large, resulting in a long reconstruction time and low data recovery efficiency. Summary of the Invention
[0004] This application provides a data recovery method, a data recovery system, and a computing device, which only reconstruct the data that cannot be read in the failed disk, can reduce the amount of reconstructed data, and improve the data recovery efficiency.
[0005] In a first aspect, this application provides a data recovery method. The method is applied to a redundant array of independent disks RAID, and the RAID includes multiple main disks. The method includes: in the case where a first disk among the multiple main disks fails, reading first data from the first disk and copying the first data to a third disk, where the first disk also stores second data that cannot be read; reconstructing the second data based on fourth data stored in each of multiple second disks among the multiple main disks, and writing the second data to the third disk, where the multiple main disks include the multiple second disks.
[0006] In the above solution, in the case where the first disk fails, the first data that can be read in the first disk is restored to the third disk in a copying manner, and for the second data that cannot be read in the first disk, it is restored to the third disk in a reconstructing manner, which can reduce the calculation amount of data reconstruction, shorten the reconstruction time, and thus improve the data recovery efficiency.
[0007] In a possible implementation of the first aspect, the RAID is located in a first computing device, the third disk is located in a second computing device, the plurality of main disks and the third disk each include a plurality of address spaces, the plurality of address spaces include a first address space and a second address space, the first address space and the second address space of the first disk are respectively used to store the first data and the second data, and the first address space and the second address space of the second disk are respectively used to store the third data associated with the first data and the fourth data associated with the second data.
[0008] Wherein, after the first disk fails, it is removed from the first computing device and inserted into the second computing device. Reading the first data from the first disk and copying the first data to the third disk includes: the second computing device reads the first data from the first address space of the first disk and writes the first data into the first address space of the third disk.
[0009] Wherein, after the first data is written into the third disk, the third disk is removed from the second computing device and inserted into the first computing device; reconstructing the second data based on the fourth data stored in the second disk and writing the second data into the third disk includes: the first computing device reads the fourth data from the second address space of the second disk, reconstructs the second data based on the fourth data, and writes the second data into the second address space of the third disk.
[0010] In a possible implementation of the first aspect, the method further includes: after writing the first data into the third disk, the second computing device stores the identifiers corresponding to the plurality of address spaces of the third disk in the third disk, the identifier corresponding to the first address space of the third disk indicates that data has been stored, and the identifier corresponding to the second address space of the third disk indicates that no data has been stored; before reconstructing the second data, the first computing device reads the identifiers corresponding to the plurality of address spaces of the third disk from the third disk, and determines to read the fourth data from the second address space of the second disk according to the identifier corresponding to the second address space of the third disk.
[0011] In the above solution, the second computing device stores the identifiers corresponding to each address space in the third disk, so that the first computing device can determine the recovered data and the unrecovered data through the identifiers of the address spaces, reducing the reconstruction amount of the first computing device. For example, if the identifier of an address space X indicates that the data has been stored, the first computing device does not need to recover the data in the address space X. If the identifier of an address space X indicates that the data has not been stored, the first computing device reads the data from the address space X of the second disk and performs reconstruction, writes the reconstructed data to the address space X of the third disk, and then updates the identifier corresponding to the address space X of the third disk. The updated identifier corresponding to the address space X indicates that the data has been stored.
[0012] In a possible implementation manner of the first aspect, the RAID further includes a hot spare disk. After the first disk fails, the hot spare disk is written with the fifth data, the sixth data, and / or the seventh data. The fifth data is included in the first data, the sixth data is included in the second data, and the fifth data and the sixth data are reconstructed from the data stored in the plurality of second disks by the first computing device. The seventh data is the service data that needs to be written to the first disk after the first disk fails.
[0013] Before pulling out the third disk from the second computing device, the hot spare disk is pulled out from the first computing device and inserted into the second computing device. The identifiers corresponding to the multiple address spaces of the third disk include the identifiers corresponding to the target address spaces except the first address space, and the identifiers corresponding to the target address spaces indicate that the data has not been stored. The method further includes: the second computing device reads the target data from the target address space of the hot spare disk based on the identifier corresponding to the target address space of the third disk, and writes the target data to the target address space of the third disk. The target data includes the sixth data and / or the seventh data; the second computing device updates the identifier corresponding to the target address space, and the updated identifier corresponding to the target address space indicates that the data has been stored.
[0014] In the above solution, after the first disk is pulled out, the RAID of the first computing device uses the hot spare disk to replace the first disk to work, and the reconstructed data and / or service data are written to the hot spare disk, which can avoid affecting the normal service of the RAID due to the failure of the first disk. At the same time, the second computing device copies the data during the period when the hot spare disk replaces the first disk to work to the third disk, which can avoid losing this part of the data and can also avoid the first computing device reconstructing this part of the data to the third disk again.
[0015] In a possible implementation of the first aspect, after inserting the third disk into the first computing device, the method further includes: the first computing device updates the identifier corresponding to the first disk in the RAID configuration information to the identifier corresponding to the third disk, so as to replace the first disk with the third disk.
[0016] Under normal circumstances, when a new disk is inserted into a RAID system, the RAID system will consider all data on the new disk invalid, initialize the new disk, and erase the original data on the new disk. In the above solution, after the third disk is inserted into the first computing device, the RAID configuration information is updated to replace the first disk with the third disk, which can prevent the RAID from treating the third disk as a new disk and initializing the data that has been recovered on the third disk.
[0017] In a possible implementation of the first aspect, the multiple main disks are connected to the disk interface in the first computing device through a port multiplexer.
[0018] In a second aspect, the present application provides a data recovery device. The data recovery device is applied to a second computing device, and the second computing device includes a third disk. The data recovery device includes: a reading module and a copying module.
[0019] Among them, the reading module is configured to read first data from the first disk in the case where the first disk in the RAID of the first computing device fails and the first disk is inserted into the second computing device. Among them, the first disk also stores second data that cannot be read.
[0020] Among them, the copying module is configured to copy the first data to the third disk.
[0021] In a possible implementation of the second aspect, the multiple main disks and the third disk each include multiple address spaces. The multiple address spaces include a first address space and a second address space. The first address space and the second address space of the first disk are respectively used to store the first data and the second data. The first address space and the second address space of the second disk are respectively used to store third data associated with the first data and fourth data associated with the second data. Among them, the copying module is specifically configured to read the first data from the first address space of the first disk and write the first data into the first address space of the third disk.
[0022] In a possible implementation of the second aspect, the replication module is further configured to store, in the third disk, identifiers corresponding to multiple address spaces of the third disk after writing the first data into the third disk. The identifier corresponding to the first address space of the third disk indicates that data has been stored, and the identifier corresponding to the second address space of the third disk indicates that no data has been stored.
[0023] In a possible implementation of the second aspect, the RAID further includes a hot spare disk. After the first disk fails, the hot spare disk is written with fifth data, sixth data, and / or seventh data. The fifth data is included in the first data, the sixth data is included in the second data, and the fifth data and the sixth data are reconstructed from the data stored in the multiple second disks by the first computing device. The seventh data is service data that needs to be written into the first disk after the first disk fails. Before pulling out the third disk from the second computing device, the hot spare disk is pulled out from the first computing device and inserted into the second computing device. The identifiers corresponding to multiple address spaces of the third disk include the identifiers corresponding to target address spaces other than the first address space, and the identifiers corresponding to the target address spaces indicate that no data has been stored. The replication module is further configured to read target data from the target address space of the hot spare disk based on the identifiers corresponding to the target address spaces of the third disk, write the target data into the target address spaces of the third disk, where the target data includes the sixth data and / or the seventh data, and update the identifiers corresponding to the target address spaces. After the update, the identifiers corresponding to the target address spaces indicate that data has been stored.
[0024] In a third aspect, the present application provides a data recovery device. The data recovery device is applied to a first computing device, and the first computing device includes a RAID. The data recovery device includes: a reading module and a reconstruction module.
[0025] The reading module is configured to read fourth data from multiple second disks in the RAID when the first disk in the RAID fails and the third disk of the second computing device is inserted into the first computing device. The first disk stores first data that can be read and second data that cannot be read. The second computing device is configured to read the first data from the first disk and copy the first data to the third disk after the first disk is inserted into the second computing device.
[0026] The reconstruction module is configured to reconstruct the second data based on the fourth data and write the second data into the third disk.
[0027] In a possible implementation of the third aspect, the address spaces of the multiple main disks and the third disk are the same. The second computing device is further configured to store, in the third disk, identifiers corresponding to the multiple address spaces of the third disk after copying the first data to the third disk. The identifier corresponding to the address space is used to indicate whether the address space has stored data. The multiple address spaces include a first address space and a second address space. The identifier corresponding to the first address space of the third disk indicates that data has been stored, and the identifier corresponding to the second address space of the third disk indicates that no data has been stored. Among them, before reconstructing the second data, the reading module is specifically configured to: read, from the third disk, identifiers corresponding to the multiple address spaces of the third disk, and determine to read the fourth data from the second address space of the second disk according to the identifier corresponding to the second address space of the third disk.
[0028] In a possible implementation of the third aspect, the reading module is specifically configured to: read, from the third disk, identifiers corresponding to the multiple address spaces of the third disk, and read the fourth data stored in each second disk from the second address space of each second disk before reconstructing the second data based on the fourth data stored in each of the multiple second disks.
[0029] In a possible implementation of the third aspect, the reconstructing module is specifically configured to: reconstruct the second data based on the fourth data, write the second data into the second address space of the third disk, and update the identifier corresponding to the second address space of the third disk.
[0030] In a possible implementation of the third aspect, the data recovery device further includes an updating module. After inserting the third disk into the first computing device, the updating module is configured to update the identifier corresponding to the first disk in the RAID configuration information to the identifier corresponding to the third disk, so as to replace the first disk with the third disk.
[0031] In a possible implementation of the third aspect, the multiple main disks of the RAID are connected to the disk interface in the first computing device through a port multiplexer.
[0032] In a possible implementation of the third aspect, the RAID further includes a hot spare disk. Among them, after the first disk fails, the hot spare disk is written with fifth data, sixth data, and / or seventh data. The first data includes the fifth data, the second data includes the sixth data, the fifth data and the sixth data are reconstructed from the data stored in the multiple second disks by the first computing device, and the seventh data is service data that needs to be written into the first disk after the first disk fails.
[0033] Fourthly, the present application provides a data recovery system. The data recovery system includes the data recovery device described in the second aspect or any optional implementation manner of the second aspect, and the data recovery device described in the third aspect or any optional implementation manner of the third aspect.
[0034] Fifthly, the present application provides a computing device. The computing device includes: a processor and a memory, including: a processor and a memory, and the processor is configured to execute a computer program stored in the memory to implement the method of the first aspect or any optional implementation manner of the first aspect.
[0035] Sixthly, the present application provides a computer-readable storage medium. The computer-readable storage medium includes instructions that, when run on a computer, cause the computer to implement the method of the first aspect or any optional implementation manner of the first aspect.
[0036] Seventhly, the present application further provides a computer program product containing instructions that, when run on a computer, cause the computer to implement the method of the first aspect or any optional implementation manner of the first aspect.
[0037] Any of the above-provided devices, computer storage media, or computer program products is used to execute the method provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects of the corresponding solutions in the corresponding methods provided above, and will not be elaborated here. Description of the Drawings
[0038] Figure 1 is a schematic structural diagram of a RAID provided by an embodiment of the present application;
[0039] Figure 2a is a method provided by an embodiment of the present application Figure 1 schematic connection diagram of disks in the RAID shown;
[0040] Figure 2b is a method provided by an embodiment of the present application Figure 1 schematic connection diagram of disks in the RAID shown;
[0041] Figure 3 is a flowchart of a data recovery method provided by an embodiment of the present application;
[0042] Figure 4 is a schematic hardware structure diagram for implementing the Figure 3 method shown provided by an embodiment of the present application;
[0043] Figure 5 is a flowchart of another data recovery method provided by an embodiment of the present application;
[0044] Figure 6a is a schematic diagram of the hardware structure for implementing a method provided in an embodiment of the present application; Figure 5 as shown in the figure;
[0045] Figure 6b is a schematic diagram of the user interface for implementing a method provided in an embodiment of the present application; Figure 5 as shown in the figure;
[0046] Figure 7 is a schematic diagram of the data relationship in a method provided in an embodiment of the present application; Figure 5 as shown in the figure;
[0047] Figure 8 is a schematic diagram of the hardware structure for reconstructing data on a hot standby disk in a method provided in an embodiment of the present application; Figure 5 as shown in the figure;
[0048] Figure 9a and Figure 9b is a schematic diagram of another data recovery method provided in an embodiment of the present application;
[0049] Figure 10 is a schematic diagram of the structure of a data recovery system for implementing the method shown in Figure 3 or 5 provided in an embodiment of the present application;
[0050] Figure 11 is a schematic diagram of the structure of a computing device provided in an embodiment of the present application. Detailed implementation manners
[0051] In order to make the objectives, technical solutions, and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described below with reference to the accompanying drawings.
[0052] In the description of the embodiments of the present application, words such as "exemplary", "for example", or "for instance" are used to indicate examples, illustrations, or explanations. Any embodiment or design solution described as "exemplary", "for example", or "for instance" in the embodiments of the present application should not be construed as being more preferred or having more advantages than other embodiments or design solutions. Rather, the use of words such as "exemplary", "for example", or "for instance" is intended to present related concepts in a specific manner.
[0053] In the description of the embodiments of the present application, the term "and / or" merely describes the associated relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent three situations: A exists alone, B exists alone, and A and B exist simultaneously. Additionally, unless otherwise specified, the meaning of the term "plural" refers to two or more. For example, plural systems refer to two or more systems, and plural screen terminals refer to two or more screen terminals.
[0054] Furthermore, the terms "first" and "second" are only used for descriptive purposes and cannot be construed as indicating or implying relative importance or implicitly specifying the indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include one or more of such features. The terms "include", "comprise", "have" and their variants all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0055] Before introducing the embodiments of the present application, the nouns that appear in the embodiments of the present application will be introduced below.
[0056] RAID is a data storage technology that combines multiple independent disks into a logically single disk, disperses data storage on multiple disks, and uses redundant information to provide fault tolerance, improving data reliability and security. There are multiple levels of RAID, including RAID1, RAID3, RAID4, RAID5, RAID6, and RAID10, etc.
[0057] RAID5 includes multiple main disks. RAID5 achieves redundancy by storing parity data corresponding to the target data, thereby ensuring the security and reliability of the target data. In general, to ensure data redundancy and reliability, at least 3 main disks are included in RAID5.
[0058] The exclusive OR (XOR) checksum algorithm can be used to detect data errors and recover data. In a computer, if the two values a and b are different, the XOR checksum value is 1; if the two values a and b are the same, the XOR checksum value is 0. The XOR checksum algorithm can be applied to RAID3, RAID4, RAID5, and RAID6. The checksum value is calculated using the XOR checksum algorithm, and in the case of disk failure, the XOR checksum algorithm is used for data reconstruction. Taking RAID5 as an example, the parity data of RAID5 can be obtained through the XOR checksum algorithm. When a disk fails, reconstruction can be performed based on the data and / or parity data of normal disks using the XOR checksum algorithm.
[0059] A hot spare disk is a backup disk used to replace a failed disk. Hot spare disks can be used in redundant RAID configurations, including RAID 1, RAID 5, RAID 6, RAID 10, etc. When a disk in such a RAID fails, the RAID automatically replaces the failed disk with a hot spare disk and reconstructs the data of the failed disk on the hot spare disk.
[0060] The serial (serial ATA, SATA) interface is a disk interface. The SATA interface is used for data transfer between the motherboard and storage devices (such as disk and optical disc drives).
[0061] A port multipler (PM) is used to expand disks. The PM includes multiple disk interfaces. One disk interface is connected to the disk interface of a computing device, and each of the other disk interfaces of the PM is connected to a disk. In this way, multiple disks can be connected to the computing device through the PM to achieve disk expansion.
[0062] The following takes RAID5 as an example to introduce the solution of this application.
[0063] Figure 1 is a schematic diagram of the structure of a RAID5. As Figure 1 shown, this RAID5 includes multiple main disks (Disk D1 to Disk D6). This RAID5 may also include one or more hot spare disks ( Figure 1 not shown). It should be noted that the number of disks in RAID5 is not limited to Figure 1 the number shown.
[0064] Figure 1 The RAID5 shown can be set in computing device 1. Each disk in the RAID5 can be directly connected to the disk interface in computing device 1 and / or indirectly connected to the disk interface in computing device 1 through a port multipler PM. Figure 1 The specific connection relationship of the disks in the RAID5 shown is as Figure 2a or Figure 2b shown. In Figure 2a and Figure 2b , the RAID5 is located in computing device 1, and computing device 1 also includes a central processing unit (CPU) and one or more SATA interfaces. Among them, the CPU is set on the motherboard of computing device 1, and the SATA interface can be set on the motherboard of computing device 1 or independently set within computing device 1.
[0065] In Figure 2aIn it, disks D1 - D3 in RAID5 are connected to PM1, disks D4 - D6 are connected to PM2, and PM1 and PM2 are respectively connected to a SATA interface.
[0066] In Figure 2b when there are enough SATA interfaces in computing device 1, the main disk and the hot spare disk in RAID5 can be directly connected to the SATA interface, that is, each disk is connected to a SATA interface.
[0067] Figure 1 The RAID5 shown can divide the continuous data to be stored into data units of the same size. Calculate the parity check data units corresponding to every five data units, and then disperse the five data units and the parity check data units to the same address space on disks D1 to D6. Among them, each parity check data unit is evenly stored on disks D1 to D6. Taking Figure 1 the data units Dt0 - 0 to Dt04 and their corresponding parity check data unit Dt0 - P shown as an example, the data units Dt0 - 0 to Dt04 are respectively stored on disks D1 to D5, and the parity check data unit Dt0 - P is stored on disk D6. Taking Figure 1 the data units Dt1 - 0 to Dt14 and their corresponding parity check data unit Dt1 - P shown as an example, the data units Dt1 - 0 to Dt1 - 3 are respectively stored on disks D1 to D4, the parity check data unit Dt1 - P is stored on disk D5, and the data unit Dt1 - 4 is stored on disk D6. That is to say, the parity check data unit Dt0 - P and the parity check data unit Dt1 - P are stored on different disks. Among them, the data unit can include a data block or a file.
[0068] In RAID5, when a disk fails, the data of the failed disk can be reconstructed by reading the data and the parity check data of the remaining normal disks. For example, when Figure 1 the disk D5 shown fails, data can be read from other disks to reconstruct and calculate all the data of disk D5. In one embodiment, after disk D5 fails, it will be pulled out and then a new disk is inserted, so the reconstructed data can be written into the newly inserted disk. In another embodiment, RAID5 can also include a hot spare disk, so the reconstructed data can be written into the hot spare disk. In the embodiment including a hot spare disk, after writing the reconstructed data into the hot spare disk, the hot spare disk can replace the failed disk to work, or copy the data of the hot spare disk to the newly inserted hot spare disk.
[0069] The above reconstruction scheme reconstructs all the data of the failed disk, with a long reconstruction time and low data recovery efficiency. Data reconstruction will occupy the computing resources of the RAID, and the long reconstruction time will also affect the data reading and writing operations of the RAID.
[0070] To this end, an embodiment of the present application provides a data recovery method, which can solve the above problems.
[0071] In the data recovery method provided by the embodiment of the present application, the RAID includes multiple main disks, and among the multiple main disks, there are a first disk that has failed and multiple second disks that have not failed. The first data that can be read in the first disk is copied to the third disk, and then the second data that cannot be read in the first disk is reconstructed. In this way, the data reading and reconstruction calculation amounts can be reduced, the reconstruction time can be shortened, and the reconstruction efficiency can be improved.
[0072] In the data recovery method provided by the embodiment of the present application, the first data in the first disk is recovered by copying, not by reconstruction, which can reduce the data reading amount and the reconstruction calculation amount, thereby shortening the data reconstruction time and improving the data reconstruction efficiency. If the first data is recovered by reconstruction, it is necessary to read the third data associated with the first data from the second disks in the RAID and perform reconstruction calculations based on the third data associated with the first data in the second disks to calculate the first data. In contrast, the embodiment of the present application does not need to read the third data associated with the first data and perform reconstruction calculations.
[0073] The following takes Figure 2a and Figure 2b as an example to introduce the data recovery of the failed disk D5 in the RAID5 shown. In the case where the disk D5 fails, the disk D5 is the first disk, the disks D1 - D4 and the disk D6 are the second disks, and the disk DN is the third disk. And for the sake of convenient expression, the first data is expressed as data 1, the second data is expressed as data 2, the third data is expressed as data 3, and the fourth data is expressed as data 4. It can be understood that data 1 - data 4 should not be understood as one data, but a type of data.
[0074] Figure 3 is a flowchart of a data recovery method provided by an embodiment of the present application. In this method, it can be jointly executed by the computing device 1 and the computing device 2. The RAID5 is located in the computing device 1, and the disk DN is located in the computing device 2. Among them, the computing device 2 can include a device with the same structure as the computing device 1. As Figure 3 shown, this method may include the following S301 - S302.
[0075] S301, pull out the disk D5 in the RAID5 from the computing device 1 and insert it into the computing device 2. After the disk D5 is inserted into the computing device 2, the computing device 2 reads the data 1 from the disk D5 and copies the data 1 to the disk DN.
[0076] In this embodiment, the computing device 1 can determine whether each main disk in RAID5 has failed by the IO time of each main disk in RAID5. For example, when the IO time of an IO of a disk exceeds the first time threshold, the RAID controller may determine that the disk has failed. In addition, in other embodiments, the computing device 1 can also determine whether each main disk in RAID5 has failed by the number of abnormal events of each main disk in RAID5. Specifically, in the normal state, the RAID controller of RAID5 can analyze the IO information of each main disk in real time to determine the number of abnormal events of each main disk. For example, when the IO time of an IO of a disk exceeds the second time threshold, the RAID controller can increment the number of abnormal events corresponding to the disk by 1; when the number of abnormal events of a disk exceeds the number threshold, it is determined that the disk has failed.
[0077] In this embodiment, as Figure 4 shown, after determining that the disk D5 has failed, in order to avoid affecting the read and write operations of other disks, the disk D5 can be removed from the computing device 1. Among them, in the case where each main disk in RAID5 is connected to the disk interface of the computing device 1 through the PM interface, if the disk D5 fails, the read and write time of the disk sharing the same PM interface with the disk D5 may be extended, thereby affecting its read and write operations.
[0078] In this embodiment, after the disk D5 fails, only some of the data stored on the disk D5 may be damaged and unreadable. As Figure 4 shown, the disk D5 includes data 1 that can be read and data 2 that cannot be read. Therefore, the disk D5 can be inserted into the computing device 2, and the computing device 2 can make full use of the data 1 that can be read on the disk D5 for data recovery, and copy the data 1 to the disk DN.
[0079] Specifically, both the disk DN and each disk in the RAID include multiple identical address spaces. The computing device 2 can sequentially read data units from multiple address spaces of the disk D5 and copy the successfully read data units to the same address spaces of the disk DN. Among them, taking Figure 1 the data unit Dt0-4 shown as an example, if the computing device 2 successfully reads the data unit Dt0-4 from the address space X of the disk D5, the data unit Dt0-4 is written into the address space X of the disk DN.
[0080] Among them, the computing device 2 can also store the identifiers corresponding to multiple address spaces of the disk DN in the disk DN. The identifier corresponding to each address space of the disk DN indicates whether data has been stored in this address space of the disk DN. For example, if the data unit Dt0-4 is written into the address space X of the disk DN, the identifier corresponding to the address space of the disk DN indicates that data has been stored. For another example, if data cannot be successfully read from the address space Y of the disk D5, the identifier corresponding to the address space Y of the disk DN indicates that no data is stored.
[0081] In addition, a data processing program can also be set in the computing device 2. The computing device 2 can perform data recovery on the disk D5 by executing the data processing program, so that more data 1 can be read from the disk D5.
[0082] S302: Pull out the disk DN from the computing device 2 and insert it into the computing device 1. After the disk DN is inserted into the computing device 1, the computing device 1 reconstructs the data 2 based on the data 4 stored in the normal disks (including disks D1 to D4 and disk D6), and writes the data 2 into the disk DN.
[0083] In this embodiment, each of the disks D1 to D4 and disk D6 stores data 3 and data 4. The data 3 stored in each disk is associated with the data 1, and the data 4 is associated with the data 2. The association of multiple data means that if one of the multiple data is lost or damaged, this one data can be recalculated based on the other data among the multiple data. Taking the data 1 of the disk D5 including Figure 1 the data units Dt0-4 shown, and the data 2 including Figure 1 the data units Dt1-P shown as an example, the data 3 stored in the disks D1 to D4 and disk D6 sequentially includes the above Figure 1 data units Dt0-0, Dt0-1, Dt0-2, Dt0-3, Dt0-P shown, and the data 4 stored in the disks D1 to D4 and disk D6 sequentially includes the above Figure 1 data units Dt1-0, Dt1-1, Dt1-2, Dt1-3, Dt1-4 shown.
[0084] Specifically, the data 1 stored in the disk DN can include one or more data units A, the data 2 can include multiple data units b, and the computing device 1 can specifically find all the data units B that are not related to the data 1 (or the data units B related to the data unit b) from the disks D1 to D4 and disk D6 by repeatedly executing the following S3021-S3023, and perform data reconstruction.
[0085] In S3021, the computing device 1 reads the identifiers corresponding to multiple address spaces of the disk DN from the disk DN. The identifiers corresponding to the multiple address spaces of the disk DN include the identifier corresponding to the first address space and the identifier corresponding to the second address space. The identifier corresponding to the first address space indicates that data is stored, for example, it includes the identifier corresponding to the above-mentioned address space X. The identifier corresponding to the second address space indicates that no data is stored, for example, it includes the identifier corresponding to the above-mentioned address space Y.
[0086] In S3022, the computing device 1 reads data 4 associated with data 2 from the second address space of disks D1 to D4 and disk D6 based on the identifier corresponding to the second address space of the disk DN. For example, since the identifier corresponding to the address space Y of the disk DN indicates that no data is stored (data unit Dt1-P), the computing device 1 needs to recover the data unit Dt1-P in the address space Y of the disk DN. Therefore, the computing device 1 reads data units Dt1-0, Dt1-1, Dt1-2, Dt1-3, Dt1-4 associated with the data unit Dt1-P from the address space Y of disks D1 to D4 and disk D6.
[0087] In S3023, the computing device 1 calculates data 2 using the XOR check algorithm based on the data 4 read from disks D1 to D4 and disk D6, and writes data 2 to the second address space of the disk DN. For example, the computing device 1 calculates the corresponding data unit Dt1-P using XOR reconstruction based on the data units Dt1-0, Dt1-1, Dt1-2, Dt1-3, Dt1-4, and then writes the corresponding data unit Dt1-P to the address space Y of the disk DN.
[0088] The above S302 can be executed by the RAID controller of RAID5. The RAID controller can be located on the motherboard of the computing device 1 or independently set within the computing device 1. The RAID controller communicates and transfers data with the disks of RAID5 through the SATA interface.
[0089] Before the disk DN is inserted into the computing device 1, update the identifier of disk 5 in the RAID5 configuration information to the identifier of the disk DN to replace disk 5 with the disk DN. After updating the RAID5 configuration information, the disk DN joins RAID5. In this way, it is possible to avoid the RAID controller initializing the data in the disk DN after the disk DN is inserted into the computing device 1. When the RAID controller detects that a disk is inserted, it can determine whether the inserted disk belongs to the disks of RAID5 based on the identifier of the disk in the configuration information. If it does not belong, it will initialize it; otherwise, it will not initialize. Among them, the identifier of the disk can include the serial number of the disk and / or the universally unique identifier.
[0090] Among them, the configuration information of RAID5 can be stored in the storage unit of the RAID controller, or stored in one or more main disks in RAID5, or stored in other memories within the computing device 1 that do not belong to RAID, or stored in the management device outside the computing device 1.
[0091] In addition, after the disk DN is inserted into the computing device 1, the computing device 1 can also determine whether the data 1 on the disk DN is complete. If the data 1 is incomplete and there is missing data, according to the reconstruction method of the XOR checksum algorithm, read the data associated with the data 1 from other normal disks, perform XOR checksum to obtain the missing data, and write the missing data into the disk DN.
[0092] Figure 5 It is a flowchart of another data recovery method provided by an embodiment of the present application. In this method, it can be jointly executed by the computing device 1 and the computing device 2. RAID5 is located in the computing device 1, and the disk DN is located in the computing device 2.
[0093] Among them, the RAID5 includes a hot spare disk. After the RAID5 determines that the disk D5 fails, the hot spare disk replaces the disk D5 to work. And the RAID controller reconstructs the data of the disk D5 and writes the reconstructed data into the hot spare disk.
[0094] Among them, the computing device 2 can include a device with the same structure as the computing device 1. Such as Figure 5 As shown, this method can include the following S501-S503.
[0095] S501, pull out the disk D5 in the RAID5 from the computing device 1 and insert it into the computing device 2. After the disk D5 is inserted into the computing device 2, as Figure 6a shown, the computing device 2 reads the data 1 from the disk D5 and copies the data 1 to the disk DN.
[0096] Among them, after the disk D5 is inserted into the computing device 2, the computing device 2 can display Figure 6b the user interface as shown. This user interface provides two copy options, including copying the data of the failed disk and copying the data of the hot spare disk. The user can, through Figure 6b the user interface as shown, select to copy the data of the failed disk, and then the computing device 2 executes S501.
[0097] In this embodiment, the specific process of S501 can refer to the introduction of S301 in the above Figure 3 shown embodiment, and will not be elaborated here.
[0098] In this embodiment, during the process of pulling out the disk D5 and the computing device 2 copying the data 1 ( Figure 6aIn the steps ① to ③ shown, due to the existence of the hot spare disk, the RAID controller of RAID5 will reconstruct the data units stored on disk D5 based on the data of disks D1 to D4 and disk D6, and write the newly generated data units to the hot spare disk.
[0099] That is to say, the RAID controller may write one or more of data 5, data 6, and data 7 to the hot spare disk, and the data written to the hot spare disk depends on the specific situation. Figure 6a It shows that the hot spare disk is written with three kinds of data: data 5, data 6, and data 7. The following will introduce data 5, data 6, and data 7 respectively.
[0100] Among them, data 5 is a part of data 1. As Figure 7 shown, data 5 is associated with data 8 in data 3. When the computing device 2 is in Figure 6a the steps ① to ③ shown, the RAID controller can reconstruct and obtain data 5 based on Figure 8 the data 8 in disks D1 to D4 and disk D6 shown, and write data 5 to the hot spare disk using the XOR check method.
[0101] Among them, data 6 is a part of data 2. As Figure 7 shown, data 6 is associated with data 9 in data 2. When the computing device 2 is in Figure 6a the steps ① to ③ shown, the RAID controller can reconstruct and obtain data 6 based on Figure 8 the data 9 in disks D1 to D4 and disk D6 shown, and write data 6 to the hot spare disk using the XOR check method.
[0102] Among them, data 7 is the data unit that needs to be written to disk 5 after disk 5 fails. After disk D5 is pulled out, RAID5 is in a degraded working state, and the hot spare disk will replace disk D5 to work. During the degraded working state, RAID5 still provides normal services, and the data 7 generated during this period will be written to the hot spare disk. In other words, data 7 was originally to be written to disk D5. Due to the failure of disk D5 and its being pulled out, the hot spare disk replaces disk D5 to store data 7. Of course, as Figure 8 shown, data 10 associated with data 7 is stored in disks D1 to D4 and disk D6.
[0103] S502, Pull out the hot spare disk in RAID5 from computing device 1 and insert it into computing device 2. After the hot spare disk is inserted into computing device 2, as Figure 6a shown, computing device 2 reads the target data from the hot spare disk and copies the target data to disk DN.
[0104] In this embodiment, the computing device 2 can determine the identifier corresponding to the target address space according to the identifier corresponding to the address space stored in the disk DN. The identifier corresponding to the target address space indicates that no data is stored. Then, the computing device 2 reads the target data from the target address space of the hot spare disk and writes the target data into the target address space of the disk DN. The computing device 2 updates the identifier corresponding to the target address space of the disk DN, and the updated identifier corresponding to the target address space indicates that data has been stored.
[0105] Among them, the target data may include the above-mentioned data 6 and data 7. Since the computing device 2 has already copied the data 1 of the first disk to the disk DN by executing S501, and the data 5 in the hot spare disk is a part of the data 1, in this step, the computing device 2 can determine according to the identifier of the address space that only the data 6 and data 7 need to be copied to the disk DN, and there is no need to copy the data 5 again.
[0106] Among them, after the hot spare disk is inserted into the computing device 2, the computing device 2 can display Figure 6b the user interface shown. The user can Figure 6b select to copy the data of the hot spare disk through the user interface shown, and then the computing device 2 executes S502.
[0107] S503, unplug the disk DN from the computing device 2 and insert it into the computing device 1. After the disk DN is inserted into the computing device 1, the computing device 1 reconstructs the missing data of the disk DN based on the data stored in the normal disks (including disks D1 - D4 and disk D6) and writes the reconstructed data into the disk DN.
[0108] Specifically, the computing device 1 can perform data reconstruction according to the following S5031 - S5033.
[0109] In S5031, the computing device 1 reads the identifiers corresponding to multiple address spaces of the disk DN from the disk DN.
[0110] In S5032, the computing device 1 determines the identifier corresponding to the target address space from the identifiers corresponding to multiple address spaces of the disk DN. The identifier corresponding to the target address space indicates that no data is stored. According to the identifier corresponding to the target address space, the computing device 1 reads data from each of the disks D1 - D4 and disk D6. The data that is not stored includes Figure 7 the data in data 2 except for data 6 shown.
[0111] In S5033, the computing device 1 calculates the reconstructed data using the XOR check algorithm based on the data read from each of the disks D1 - D4 and disk D6, and writes the reconstructed data into the target address space of the disk DN. The reconstructed data includes Figure 7 the data in data 2 except for data 6 shown.
[0112] The embodiments of the present application also provide a data migration method, which is used to copy the data of a disk to a hot spare disk when it is predicted that a disk in RAID5 will fail. Taking disk D5 as an example, as Figure 9a shown, when it is predicted that RAID5 fails (RAID5 has not failed yet), the data in disk D5 is copied to the hot spare disk; after RAID5 fails, as Figure 9b shown, if a new disk is added to RAID5 to replace disk D5, the data in the hot spare disk can be copied to the new disk; if a new disk is not added to RAID5 to replace disk D5, the hot spare disk can replace disk D5.
[0113] Among them, the RADI controller of RAID5 can predict whether each main disk in RAID5 fails by the IO time of each main disk in RAID5. For example, when the IO time of an IO of a disk exceeds the first time threshold, the RAID controller can determine that the disk is about to fail, and then execute the copy process.
[0114] In addition, in other embodiments, the RADI controller can also predict whether each main disk in RAID5 fails by the number of abnormal events of each main disk in RAID5. Specifically, in the normal state, the RAID controller of RAID5 can analyze the IO information of each main disk in real time to determine the number of abnormal events of each main disk. For example, when the IO time of an IO of a disk exceeds the second time threshold, the RAID controller can increment the number of abnormal events corresponding to the disk by 1; when the number of abnormal events of a disk exceeds the number threshold, it is determined that the disk is about to fail.
[0115] Based on Figure 3 and Figure 5 the method embodiments shown, the embodiments of the present application provide a data recovery system.
[0116] Figure 10 FIG. is a schematic structural diagram of a data recovery system provided by the embodiments of the present application. As Figure 10 shown, the data recovery system 1000 includes a data recovery device 1010 and a data recovery device 1020. The data recovery device 1010 can be applied to Figure 3 or Figure 5 the computing device 1 in the embodiments shown. The data recovery device 1020 can be applied to Figure 3 or Figure 5 the computing device 2 in the embodiments shown.
[0117] As Figure 10 shown, the data recovery device 1010 includes a reading unit 1011 and a reconstruction unit 1012.
[0118] Among them, the reading unit 1011 is configured to read the fourth data from the second disk based on the first data of the third disk.
[0119] Among them, the reconstruction unit 1012 is configured to reconstruct the second data of the first disk based on the fourth data and write the second data into the third disk.
[0120] As Figure 11 shown, the data recovery device 1020 includes a reading unit 1021 and a copying unit 1022.
[0121] When the data recovery device 1020 can be applied to Figure 3 or Figure 5 the computing device 2 in the embodiment shown
[0122] Among them, the reading unit 1021 is configured to read the first data from the first disk.
[0123] Among them, the copying unit 1021 is configured to copy the first data in the first disk to the third disk.
[0124] When the data recovery device 1020 can be applied to Figure 3 or Figure 5 the computing device 2 in the embodiment shown
[0125] Among them, the reading unit 1021 is configured to read the first data from the first disk and read the target data from the hot spare disk.
[0126] Among them, the copying unit 1021 is configured to copy the first data in the first disk to the third disk and copy the target data in the hot spare disk to the third disk.
[0127] It should be noted that Figure 10 when the data recovery devices 1010 and 1020 provided in the embodiments execute the data recovery method, only the above division of each functional module is used as an example for illustration. In practical applications, the above functions can be allocated to different functional modules according to needs, that is, the internal structure is divided into different functional modules to complete all or part of the functions described above. In addition, the computing device provided in the above embodiment and Figure 3 and Figure 5 the data recovery method embodiments shown belong to the same concept. For the specific implementation process, please refer to the method embodiments and will not be elaborated here.
[0128] Figure 11 is a schematic hardware structure diagram of a computing device 1100 provided by an embodiment of the present application.
[0129] The computing device 1100 can deploy the computing device 1 or the computing device 2 in the above embodiment. Refer to Figure 11, the computing device 1100 includes a processor 1101, a memory 1102, a communication interface 1103, and a bus 1104. The processor 1101, the memory 1102, and the communication interface 1103 are connected to each other through the bus 1104. The processor 1101, the memory 1102, and the communication interface 1103 may also be connected by other connection means in addition to the bus 1104.
[0130] The processor 1101 may be a general-purpose processor, and the general-purpose processor may be a processor that executes specific steps and / or operations by reading and executing the content stored in a memory (such as the memory 1102). For example, the general-purpose processor may be a central processing unit (CPU). The processor 1101 may include at least one circuit to execute Figure 3 or Figure 5 all or part of the steps of the method provided by the illustrated embodiment. Among them, the processor 1101 may include one or more cores.
[0131] The memory 1102 may be various types of storage media, such as random access memory (RAM), read-only memory (ROM), non-volatile RAM (NVRAM), programmable ROM (PROM), erasable PROM (EPROM), electrically erasable PROM (EEPROM), flash memory, optical memory, hard disk, etc.
[0132] Among them, when the computing device 1100 is the above-mentioned computing device 1, the memory 1102 may store the program corresponding to the above data recovery device 1010. When the computing device 1100 is the above-mentioned computing device 2, the memory 1102 may store the program corresponding to the above data recovery device 1020. And when the data recovery device 1020 is used to execute Figure 5 the illustrated method, the processor 1101 is further configured to execute the program corresponding to the data recovery device 1020 to display Figure 6b the illustrated interface. The user may, through Figure 6b the illustrated interface, select to copy the data of the faulty disk or the data of the hot spare disk.
[0133] The communication interface 1103 includes interfaces such as input / output (I / O) interfaces, physical interfaces, and logical interfaces for implementing the interconnection of components within the computing device 1100, as well as interfaces for implementing the interconnection between the computing device 1100 and other devices (such as other computing devices or user devices). The physical interface can be an Ethernet interface, a fiber optic interface, an ATM interface, etc.
[0134] The bus 1104 can be of any type and is a communication bus for implementing the interconnection of the processor 1101, the memory 1102, and the communication interface 1103, such as a system bus.
[0135] The above-mentioned components can be separately provided on independent chips, or at least partially or entirely provided on the same chip. Whether to separately provide each component on different chips or integrate them on one or more chips often depends on the requirements of product design. The embodiments of the present application do not limit the specific implementation forms of the above-mentioned components.
[0136] Figure 11 The illustrated computing device 1100 is merely exemplary. During implementation, the computing device 1100 may further include other components, which are not listed one by one herein.
Claims
1. A data recovery method, characterized in that, Applied to a Redundant Array of Independent Disks (RAID), the RAID includes a plurality of main disks, and the method includes: In the case where a first disk among the plurality of main disks fails, reading first data from the first disk and copying the first data to a third disk, wherein the first disk also stores second data that cannot be read; Reconstructing the second data based on fourth data stored in a second disk and writing the second data to the third disk, the plurality of main disks including the second disk.
2. The method according to claim 1, characterized in that, The RAID is located in a first computing device, the third disk is located in a second computing device, the plurality of main disks and the third disk each include a plurality of address spaces, the plurality of address spaces including a first address space and a second address space, the first address space and the second address space of the first disk are respectively used to store the first data and the second data, and the first address space and the second address space of the second disk are respectively used to store third data associated with the first data and fourth data associated with the second data; After the first disk fails, it is removed from the first computing device and inserted into the second computing device. Reading first data from the first disk and copying the first data to the third disk includes: The second computing device reads the first data from the first address space of the first disk and writes the first data to the first address space of the third disk; After the first data is written to the third disk, the third disk is removed from the second computing device and inserted into the first computing device. Reconstructing the second data based on fourth data stored in the second disk and writing the second data to the third disk includes: The first computing device reads the fourth data from the second address space of the second disk, reconstructs the second data based on the fourth data, and writes the second data to the second address space of the third disk.
3. The method according to claim 2, characterized in that, The method further includes: After writing the first data to the third disk, the second computing device stores identifiers corresponding to the plurality of address spaces of the third disk in the third disk. The identifier corresponding to the first address space of the third disk indicates that data has been stored, and the identifier corresponding to the second address space of the third disk indicates that no data has been stored; Before reconstructing the second data, the first computing device reads the identifiers corresponding to the plurality of address spaces of the third disk from the third disk, and determines to read the fourth data from the second address space of the second disk according to the identifier corresponding to the second address space of the third disk.
4. The method according to claim 2 or 3, characterized in that, The RAID further includes a hot spare disk. After the first disk fails, the hot spare disk is written with fifth data, sixth data, and / or seventh data. The fifth data is included in the first data, and the sixth data is included in the second data. The fifth data and the sixth data are reconstructed from the data stored in the multiple second disks by the first computing device. The seventh data is service data that needs to be written to the first disk after the first disk fails. Before pulling out the third disk from the second computing device, the hot spare disk is pulled out from the first computing device and inserted into the second computing device. The identifiers corresponding to the multiple address spaces of the third disk include the identifiers corresponding to the target address spaces except the first address space. The identifiers corresponding to the target address spaces indicate that no data is stored. The method further includes: The second computing device reads target data from the target address space of the hot spare disk based on the identifier corresponding to the target address space of the third disk, and writes the target data to the target address space of the third disk. The target data includes the sixth data and / or the seventh data. The second computing device updates the identifier corresponding to the target address space, and the updated identifier corresponding to the target address space indicates that data has been stored.
5. The method according to any one of claims 2 to 4, characterized in that, After inserting the third disk into the first computing device, the method further includes: The first computing device updates the identifier corresponding to the first disk in the RAID configuration information to the identifier corresponding to the third disk, so as to replace the first disk with the third disk.
6. The method according to any one of claims 2-5, characterized in that, The multiple main disks are connected to the disk interface in the first computing device through a port multiplexer.
7. A data recovery device, characterized in that, Applied to a second computing device, the second computing device includes a third disk. The data recovery device includes: A reading module, configured to read first data from the first disk when the first disk in the RAID of the first computing device fails and the first disk is inserted into the second computing device. The first disk also stores second data that cannot be read. A copying module, configured to copy the first data to the third disk.
8. A data recovery device, characterized in that, Applied to a first computing device, the first computing device includes a RAID. The data recovery device includes: A reading module, configured to read fourth data from the multiple second disks in the RAID when the first disk in the RAID fails and the third disk of the second computing device is inserted into the first computing device. The first disk stores first data that can be read and second data that cannot be read. The second computing device is configured to read the first data from the first disk after the first disk is inserted into the second computing device, and copy the first data to the third disk. A reconstructing module, configured to reconstruct the second data based on the fourth data and write the second data to the third disk.
9. A data recovery system, characterized in that, The data recovery system includes the data recovery device according to claim 7 and the data recovery device according to claim 8.
10. A computing device, characterized in that, Including: A processor and a memory, the processor being configured to execute a computer program stored in the memory to implement the method according to any one of claims 1 to 6.
11. A computer-readable storage medium, characterized in that, Comprising instructions which, when run on a computer, cause the computer to implement the method according to any one of claims 1 to 6.