Background technology
Raid-array RAID (Redundant Array of Independent Disk) be a kind of polylith independently hard disk (physical hard disk) combine by different modes and form a hard disk groups (logic hard disk), be used to the memory property and the data backup ability that provide higher than single hard disk.According to the various combination mode of disk array, can RAID be divided into different ranks.RAID rank commonly used has: RAID0, RAID1, RAID2, RAID3, RAID4, RAID5, RAID6, RAID01, RAID10 etc., different RAID ranks are corresponding to different performances, capacity and reliability.
For the RAID type is that the disk array of RAID5 is the memory technology solution that a kind of memory property, data security and carrying cost are taken into account.RAID5 does not back up the data of storage; But store data and corresponding parity information in each disk of forming RAID5 into; And parity information is stored in respectively on the different disks with corresponding data, in redundancy check data equiblibrium mass distribution and all disks.After a data disks among the RAID5 is damaged, still can normal read-write service be provided to the external world, this moment, RAID was in degradation or critical conditions.If after having a data disks to lose efficacy again, then whole array will be in disabled state.For avoiding the appearance of down state; RAID5 generally can add one or more extra data disks as subsequent use dish; After certain data disks lost efficacy; Can log-on data dish process of reconstruction, according to the data in the data computation inefficacy dish in the normal data dish, and with the data storage in the inefficacy dish in subsequent use dish.After data were rebuild, subsequent use dish can replace the data disks that lost efficacy automatically and carry out work, reaches the state the same with former array.
Fig. 1 is that RAID5 data of the prior art are rebuild structural representation.As shown in Figure 1, RAID5 has comprised 4 blocks of data dishes and 1 subsequent use dish.Wherein, 4 blocks of data dishes are respectively Disk1, Disk2, Disk3 and Disk4; Subsequent use dish is Disk5.When data disks Disk1, Disk2, Disk3 and Disk4 operate as normal, there are not data on the subsequent use dish Disk5, this moment, subsequent use dish Disk5 was in idle condition; After the blocks of data dish among the RAID5 is damaged; For example after data disks Disk4 lost efficacy, subsequent use dish Disk5 just can replace Disk4 work, and rebuild array; After promptly recomputating the data and check correctly among the Disk4, the data among the Disk4 are written among the subsequent use dish Disk5.
In realizing process of the present invention, the inventor finds that there are the following problems at least in the prior art:
In present RAID5 data re-establishing method, if the data in the normal data dish make a mistake, the data in then can't the calculating failure dish, thus cause RAID5 data reconstruction failure.
Summary of the invention
In view of this, fundamental purpose of the present invention is to provide a kind of method of RAID5 data reconstruction, can guarantee when the data in the normal data dish make a mistake, and can accomplish the data of RAID5 and rebuild.
Another object of the present invention is to provide a kind of device of RAID5 data reconstruction, can guarantee when the data in the normal data dish make a mistake, can accomplish the data of RAID5 and rebuild.
For achieving the above object, technical scheme of the present invention is achieved in that
The method that a kind of RAID5 data are rebuild, this method comprises:
A, in the data reconstruction processes of raid-array RAID5; When wrong data take place in the normal data dish; Judge whether strip data corresponding with said misdata in the corrupt data dish among the said RAID5 can carry out read operation; If then in said corrupt data dish, read the said strip data corresponding with said misdata;
B, strip data corresponding with said misdata in the said corrupt data dish is stored in the preliminary data dish.
A kind of RAID5 data repair device comprises:
Judging unit; Be used for data reconstruction processes at raid-array RAID5; When wrong data take place in the normal data dish; Judge whether strip data corresponding with said misdata in the corrupt data dish among the said RAID5 can carry out read operation,, send one first reading command to reading unit if the said strip data corresponding with said misdata can be carried out read operation in the said corrupt data dish; If said strip data corresponding with said misdata in the said corrupt data dish cannot be carried out read operation, downwards electricity is gone up electric unit and is sent the instruction that powers on of a following electricity;
Said reading unit; Be used for after receiving said first reading command; In said corrupt data dish, read the said strip data corresponding, send to reparation unit and storage unit reading the said strip data corresponding in the said corrupt data dish with said misdata with said misdata;
Said reparation unit; Be used for based on the strip data corresponding in said RAID5 other normal data dishes except that the normal data dish of the data that make a mistake with said misdata; And the strip data corresponding with said misdata in the said corrupt data dish, repair said misdata;
Said storage unit is used for the said corrupt data dish strip data corresponding with said misdata that receives stored in the preliminary data dish.
It is thus clear that; Adopt technical scheme of the present invention, in the data reconstruction processes of RAID5, when wrong data take place in the normal data dish; Judge whether strip data corresponding with misdata in the corrupt data dish among the RAID5 can carry out read operation; If then in the corrupt data dish, read the strip data corresponding, and strip data corresponding with misdata in the corrupt data dish stored in the preliminary data dish with misdata.Method and device that the RAID5 data that the present invention proposes are rebuild can be guaranteed when the data in the normal data dish make a mistake, and can accomplish the data of RAID5 and rebuild; Have, the method for the invention implements simple and convenient again, is convenient to popularize.
Embodiment
To the problem that exists in the prior art, the RAID5 data repair scheme among the present invention after a kind of improvement of proposition can be guaranteed when the data in the normal data dish make a mistake, can accomplish the data repair of RAID5.
For make technical scheme of the present invention clearer, understand, below with reference to the accompanying drawing embodiment that develops simultaneously, scheme according to the invention is done to specify further.
The method flow diagram that Fig. 2 rebuilds for RAID5 data of the present invention.As shown in Figure 2, may further comprise the steps:
Step 201 in the data reconstruction processes of raid-array RAID5, when wrong data take place in the normal data dish, judges whether strip data corresponding with misdata in the corrupt data dish among the RAID5 can carry out read operation.
In this step; As shown in Figure 1; For example the data disks Disk3 among the RAID5 is damaged; In the data reconstruction processes of RAID5, when supposing that data D1 among the normal data dish Disk1 makes a mistake, judge whether strip data D3 corresponding with misdata D1 among the corrupt data dish Disk3 can carry out read operation.
Step 202 is if then read the strip data corresponding with misdata in the corrupt data dish.
In this step,, then in corrupt data dish Disk3, read the strip data D3 corresponding with misdata D1 if the strip data D3 corresponding with misdata D1 can carry out read operation among the corrupt data dish Disk3.
Step 203 stores strip data corresponding with misdata in the corrupt data dish in the preliminary data dish into.
In this step, as shown in Figure 1, in corrupt data dish Disk3, read after the strip data D3 corresponding with misdata D1, D3 is stored among the preliminary data dish Disk5.
Further, in practical implementation example of the present invention, after step 201 and before step 203, also comprise the steps:
Step 204 if the strip data corresponding with misdata cannot be carried out read operation in the corrupt data dish among the RAID5, is descended the electricity operation that powers on to the corrupt data dish.
As shown in Figure 1, when the corrupt data dish Disk3 among the RAID5 can not do any read-write operation, many times afterwards can carry out read-write operation once more to this corrupt data dish again through the corrupt data dish being descended again electricity power on and operating.Therefore, in this step,, corrupt data dish Disk3 is descended the electricity operation that powers on if the strip data D3 corresponding with misdata D1 cannot carry out read operation among the corrupt data dish Disk3.
Step 205 judges whether strip data corresponding with misdata in the corrupt data dish can carry out read operation.
Step 206 is if then read the said strip data corresponding with misdata in the corrupt data dish.
In addition, if when the strip data corresponding with misdata cannot be carried out read operation in the corrupt data dish, RAID5 data reconstruction failure then.
Step 207 stores strip data corresponding with misdata in the corrupt data dish in the preliminary data dish into.
Can know according to above-mentioned description,, can be implemented in the data reconstruction processes of RAID5, when the data in the normal data dish make a mistake, thereby rebuild through the data that read the data completion RAID5 in the corrupt data dish through above-mentioned step 201~207.
Preferably; After step 203 or step 207; The strip data corresponding with misdata in other normal data dishes except that the normal data dish of the data that make a mistake of in technical scheme of the present invention, further giving chapter and verse among the RAID5, and the strip data corresponding with misdata in the corrupt data dish are repaired the data that make a mistake in the normal data dish; Can after accomplishing the reconstruction of RAID5 data, further repair the data that make a mistake in the normal data dish.Fig. 3 repairs the method flow diagram of the data that make a mistake in the normal data dish for the present invention.As shown in Figure 3, the method for the data that make a mistake in the said reparation normal data dish can comprise the step that is described below:
Step 301; With the strip data corresponding in other normal data dishes except that the normal data dish of the data that make a mistake among the RAID5 with misdata; And the strip data corresponding with misdata carried out XOR calculating in the corrupt data dish, obtains the correct data corresponding with misdata.
Particularly; With strip data D2 and P1 corresponding among other normal data dish Disk2 except that the normal data dish Disk1 of the data that make a mistake and the Disk4 among the RAID5 with misdata D1; And the strip data D3 corresponding with misdata D1 carries out XOR calculating among the corrupt data dish Disk3, obtains the correct data corresponding with misdata D1.In RAID5 as shown in Figure 1, P1, P2, P3 and P4 are the data check position.Wherein,
For example, in specific embodiment of the present invention, D1=101, D2=011, D3=110,
In the data reconstruction processes of RAID5; Suppose that the data D1 among the Disk1 makes a mistake; If strip data D3 corresponding with misdata D1 among the corrupt data dish Disk3 can carry out read operation, then in corrupt data dish Disk3, read the strip data D3 corresponding with misdata D1, D2, D3 and P1 are carried out XOR calculate; Obtain the correct data D1 ' corresponding, promptly with misdata D1
Step 302 is replaced misdata with correct data in the normal data dish of the data that make a mistake.
Particularly, calculating the correct data D1 ' corresponding afterwards with misdata D1 according to D2, D3 and P1, in the normal data dish of the data that make a mistake with correct data D1 ' replacement misdata D1.
The method that the RAID5 data that the present invention proposes are rebuild; In the data reconstruction processes of RAID5; When wrong data take place in the normal data dish, judge whether strip data corresponding with misdata in the corrupt data dish can carry out read operation, if; Then in the corrupt data dish, read the strip data corresponding, and strip data corresponding with misdata in the corrupt data dish is stored in the preliminary data dish with misdata.The method that the RAID5 data that the present invention proposes are rebuild can be guaranteed when the data in the normal data dish make a mistake, and can accomplish the data of RAID5 and rebuild; Have, the method for the invention implements simple and convenient again, is convenient to popularize.
The apparatus structure synoptic diagram that Fig. 4 rebuilds for RAID5 data of the present invention.As shown in Figure 4, comprising:
Judging unit 401; Be used for data reconstruction processes, when wrong data take place in the normal data dish, judge whether strip data corresponding with said misdata in the corrupt data dish among the said RAID5 can carry out read operation at raid-array RAID5; If; Send one first reading command to reading unit 402, if not, electricity is gone up electric unit 403 and is sent the instruction that powers on of a following electricity downwards;
Said reading unit 402; Be used for after receiving said first reading command; In said corrupt data dish, read the said strip data corresponding, said strip data corresponding with said misdata in the said corrupt data dish is sent to storage unit 404 with said misdata;
Said storage unit 404 is used for the said corrupt data dish strip data corresponding with said misdata that receives stored in the preliminary data dish.
Further, said down electricity is gone up electric unit 403, is used for powering on after the instruction receiving said electricity down, and said corrupt data dish descend the electricity operation that powers on, and to decision instruction of said judging unit 401 transmissions;
Said judging unit 401; Also be used for after receiving said decision instruction; Judge whether strip data corresponding with said misdata in the said corrupt data dish can carry out read operation, if then send a second reading instruction fetch to said reading unit 402;
Said reading unit 402; Also be used for after receiving said second reading instruction fetch; In said corrupt data dish, read the said strip data corresponding, said strip data corresponding with said misdata in the said corrupt data dish is sent to said storage unit 404 with said misdata;
Said storage unit 404 is used for the said corrupt data dish strip data corresponding with said misdata that receives stored in the preliminary data dish.
Further, said device also comprises reparation unit 405;
Said reading unit 402 also is used for the said strip data that said corrupt data dish is corresponding with said misdata and sends to said reparation unit 405;
Said reparation unit 405; Be used for according to the strip data corresponding in said RAID5 other normal data dishes except that the normal data dish of the data that make a mistake with said misdata; And the strip data corresponding with said misdata in the said corrupt data dish, repair said misdata.
Further, said reparation unit 405 comprises:
Computation subunit 4051; Be used for the strip data corresponding in said RAID5 other normal data dishes except that the normal data dish of the data that make a mistake with said misdata; And the strip data corresponding with said misdata carried out XOR calculating in the said corrupt data dish; Obtain the correct data corresponding, and said correct data is sent to replacement subelement 4052 with said misdata;
Said replacement subelement 4052 is used at the normal data dish of the said data that make a mistake said correct data being replaced said misdata.
The device that the RAID5 data that the present invention proposes are rebuild; In the data reconstruction processes of RAID5; When wrong data took place in the normal data dish, whether strip data corresponding with misdata in the judgment unit judges corrupt data dish can carry out read operation, if; Reading unit reads the strip data corresponding with misdata in the corrupt data dish, and through storage unit strip data corresponding with misdata in the corrupt data dish is stored in the preliminary data dish.The device that the RAID5 data that the present invention proposes are rebuild can be guaranteed when the data in the normal data dish make a mistake, and can accomplish the data of RAID5 and rebuild; Have, the method for the invention implements simple and convenient again, is convenient to popularize.
The concrete workflow of device embodiment shown in Figure 4 repeats no more please with reference to the respective description among the method embodiment shown in Figure 2.
The above is merely preferred embodiment of the present invention, and is in order to restriction the present invention, not all within spirit of the present invention and principle, any modification of being made, is equal to replacement, improvement etc., all should be included within the scope that the present invention protects.