CN102819462B - Repair method for Window system disk partition - Google Patents

Repair method for Window system disk partition Download PDF

Info

Publication number
CN102819462B
CN102819462B CN201210277142.3A CN201210277142A CN102819462B CN 102819462 B CN102819462 B CN 102819462B CN 201210277142 A CN201210277142 A CN 201210277142A CN 102819462 B CN102819462 B CN 102819462B
Authority
CN
China
Prior art keywords
dbr
subregion
ebr
current
jump
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201210277142.3A
Other languages
Chinese (zh)
Other versions
CN102819462A (en
Inventor
王大彬
徐吉兵
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Xiamen Meiya Pico Information Co Ltd
Original Assignee
Xiamen Meiya Pico Information Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Xiamen Meiya Pico Information Co Ltd filed Critical Xiamen Meiya Pico Information Co Ltd
Priority to CN201210277142.3A priority Critical patent/CN102819462B/en
Publication of CN102819462A publication Critical patent/CN102819462A/en
Application granted granted Critical
Publication of CN102819462B publication Critical patent/CN102819462B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Signal Processing For Digital Recording And Reproducing (AREA)

Abstract

The invention provides a repair method for a Window disk partition. The method comprises the following steps of: sequentially scanning unscanned sectors of a disk backward and searching MBR (Master Boot Record), EBR (Extended Boot Record) or DBR (Dos Boot Record) information in the unscanned sectors; if a DBR is scanned currently, judging whether the DBR is a DBR which is incorrectly matched with a MBR/EBR and if yes, abandoning the DBR; if judging that the DBR is not the DBR which is incorrectly matched with the MBR/EBR, judging whether the DBR is a standby DBR and if yes, abandoning the DBR; if judging that the DBR is not the standby DBR, judging whether partition information recorded by the DBR is correct, if yes, reconstructing the MBR/EBR matched with the partition information according to the DBR and storing the correct partition information, if no, judging and storing the correct partition information recorded by the MBR/EBR; and finally, after scanning all the sectors, writing all the correct partition information into the disk. According to the invention, the disk of which the partition information is seriously damaged can be rapidly and accurately repaired.

Description

A kind of restorative procedure of Window system disk partition
Technical field
The present invention relates to computer safety field, particularly relate to a kind of restorative procedure of Window system disk partition.
Background technology
Along with the high speed development of information age, government, enterprise and individual pay close attention to the safety of information more and more.The core of information security is the safety of data, and the many factors such as virus infections, maloperation, unscheduled event are all threaten the safety of data, once significant data is destroyed and lose, its loss is often quite serious, is even difficult to make up.But, in actual applications, be difficult to again the phenomenon avoiding occurring corrupted data and loss.Therefore, effectively recover to be quite necessary to those significant datas wrecked.
At present, have a lot for the software of date restoring and method thereof, wherein, divisional reconstruction class software is that one recovers data mode indirectly, namely gives the data of loss for change by repairing subregion.The advantage of this divisional reconstruction mode is: resume speed is exceedingly fast, and also just can recover once the file that divisional reconstruction success is wherein lost thereupon.But, current divisional reconstruction software is lost for the subregion that GHOST, by mistake format etc. cause by mistake, and can only scan partial-partition information, even some information scanned is wrong, when utilizing the information of these mistakes to recover partition information, the secondary damage to disk will be caused; And traditional divisional reconstruction software cannot repair the disk again destroyed for subzone or other modes again after by mistake GHOST.Therefore, a kind of method still repairing disk partition when partition information is seriously damaged is badly in need of at present.
Summary of the invention
The invention provides a kind of restorative procedure of Window system disk partition, the problem of the disk partition that the partition information cannot repairing the widely used FAT32 of Windows system and new technology file system for solving existing divisional reconstruction technology is seriously damaged, the restorative procedure of disk partition provided by the invention can be repaired accurately to the disk that FAT32/NTFS partition information is seriously damaged, reparation speed is fast, and applicability is wide.
A kind of Windows disk partition restorative procedure provided by the invention, the method comprises the following steps:
S1: judge whether the disk sector do not scanned? if not, then S4 is performed; If then successively backward scanning disk do not scan sector, find Master Boot Record, extended partition record EBR or dos boot record DBR, if Current Scan to be DBR, then perform S2, if Current Scan to be MBR or EBR, then perform S3;
S2: judge that current DBR is the DBR that incorrect MBR/EBR mates? if then abandon current DBR; Otherwise then judge whether current DBR is backup DBR, if it is abandon, otherwise the information such as size, divisional type according to this subregion recorded in current DBR judges that whether this divisional description information correct? reconstruct according to current DBR the MBR/EBR that mates with it and preserve this correct partition information, return and perform S1, otherwise directly return execution S1;
S3: form subregion chain according to the partition table information in MBR/EBR, if the subregion chain formed correctly, preserve this subregion chain information, otherwise judge that whether this divisional description information that the Article 1 subregion list item in current MBR/EBR records is correct, preserve this correct partition information and return execution S1, otherwise directly returning execution S1;
S4: by all correct partition information write disk preserved.
Preferably, in above-mentioned Windows disk partition restorative procedure, also comprise step before described S1: open disk, obtain the sector sum SUM of described disk, and make the end sector number of last subregion be 0;
Described S1 specifically comprises the following steps:
Steps A 1: judge that the current disk sector number N scanned is more than or equal to described SUM? jump to S4; Otherwise jump to steps A 2; Wherein the initial value of N is set to 0;
Steps A 2: make OFFSET=OFFSET+1, continues to perform steps A 5; Wherein, OFFSET is the sector number of the MBR/EBR of the sector distance of the Current Scan previous mistake nearest with it, and the initial value of described OFFSET is 0;
Steps A 3: the information reading last two bytes in N number of sector of described disk, and judge that it is " 55AA "? perform steps A 5; Otherwise perform steps A 4;
Steps A 4: make N=N+1, and return execution steps A 1;
Steps A 5: the N number of sector judging described disk is MBR or EBR? be perform S3, otherwise perform steps A 6;
Steps A 6: the N number of sector judging described disk is DBR? continue to perform S2, otherwise jump to steps A 4.
Preferably, in above-mentioned Windows disk partition restorative procedure, described S2 specifically comprises:
Step B1: judge whether current OFFSET is less than 70, is, performs step B2, otherwise perform step B3;
Step B2: read incorrect MBR/EBR record, has judged whether that incorrect MBR/EBR mates with current DBR, if there is incorrect MBR/EBR to mate with current DBR, jumps to steps A 4; Otherwise jump to step B4;
Step B3: judging that whether current DBR is the DBR of NTFS subregion, is perform step B5, otherwise performs step B4;
Step B4: judging that in current DBR, whether " the sector sum of this subregion " field value is correct, is jump to step B6; Otherwise jump to steps A 4;
Step B5: read incorrect MBR/EBR record, judges whether current DBR can mate with incorrect MBR/EBR as the backup DBR of NTFS subregion, is perform steps A 4; Otherwise perform step B4;
Step B6: reconstruct the MBR/EBR mated with it according to current DBR, continues to perform step B7;
Step B7: judge that the MBR/EBR mated with current DBR reconstructs successfully? if then the partition information that the successful MBR/EBR of reconstruct records is regarded as correct partition information, and jumps to step B8; Otherwise jump to steps A 4;
Step B8: preserve the partition information that this is correct, and continue to perform step B9;
Step B9: the sector sum+1 making this subregion recorded in this correct partition information of N=N+, continues to perform step B10;
Step B10: the end sector number recording this subregion corresponding to correct partition information, jumps to steps A 1.
Preferably, in above-mentioned Windows disk partition restorative procedure, the detailed determination methods of described step B2 is:
Step B201: the end sector number inputting current N and previous subregion;
Step B202: the flag F lag arranging backup DBR is flase, and calculates the value hiding sector number field in the current DBR of MBR/EBR place sector number SSN:SSN=N-mated with current DBR;
Step B203: judge that SSN equals 0? be jump to step B204, otherwise jump to step B207;
Step B204: judged whether incorrect MBR record? if so, then step B205 is jumped to; If not, then step B215 is jumped to;
Step B205: " sector number used before this subregion " field value reading the Article 1 subregion list item in described incorrect MBR, and judge whether to equal N? be jump to step B206, otherwise jump to step B215;
Step B206: judge in the Article 1 subregion list item in described incorrect MBR whether identical with sector sum with this divisional type described in current DBR? be jump to step B214, otherwise jump to step B215;
Step B207: judge that SSN is less than or equal to the end sector number of previous subregion? jump to step B214; Otherwise perform step B208;
Step B208: inquire about incorrect EBR record, judges whether the incorrect EBR being numbered SSN, has and then performs step B209; Otherwise perform step B210;
Step B209: judge current queries to incorrect EBR and current DBR in the divisional type that describes whether identical? be jump to step B213, otherwise jump to step B211;
Step B210: judge that the flag F lag of described backup DBR is True? jump to step B215; Otherwise perform step B211;
Step B211: judge that current DBR is the DBR of FAT32 subregion? perform step B212; Otherwise jump to step B215;
Step B212: make alternate sector number in the value-current DBR hiding sector number field in the current DBR of SSN=N-, the flag F lag of order backup DBR is True, and returns execution step B207;
Step B213: judge described current queries to incorrect EBR in record self residing for subregion sector sum and current DBR in record self residing for the sector sum of subregion whether identical, be jump to step B214, otherwise jump to step B211;
Step B214: the judged result returning " having incorrect MBR/EBR to mate with current DBR ", and redirect performs steps A 4;
Step B215: the judged result returning " not having incorrect MBR/EBR to mate with current DBR ", and redirect performs step B4.
Preferably, in above-mentioned Windows disk partition restorative procedure, the detailed determination methods of described step B5 is:
Step B501: the end sector number inputting current N and previous subregion;
Step B502: the sector number SSN:SSN=N-(hiding the value+1 of sector number field in the sector sum+current DBR of subregion residing for current DBR) calculating the EBR place of subregion residing for current DBR;
Step B503: judge that SSN is less than the end sector number of previous subregion? jump to step B507; Otherwise jump to step B504;
Step B504: inquire about incorrect MBR/EBR record, judges whether the incorrect MBR/EBR record being numbered SSN; Jump to step B505; Otherwise jump to step B508;
Step B505: judge current queries to incorrect MBR/EBR and current DBR in the divisional type that describes whether identical, be jump to step B506; Otherwise jump to step B508;
Step B506: judge current queries to incorrect MBR/EBR in record self residing for subregion sector sum whether than record in current DBR self residing for the sector sum large 1 of subregion, be jump to step B507; Otherwise jump to step B508;
Step B507: the judged result returning " having incorrect MBR/EBR to mate with current DBR ", and redirect performs steps A 4;
Step B508: the judged result returning " not having incorrect MBR/EBR to mate with current DBR ", and redirect performs step B4.
Preferably, in above-mentioned Windows disk partition restorative procedure, described step B6-step B7 comprises:
Step B601: calculate the value hiding sector number field in the current DBR of sector number SSN:SSN=N-at the MBR/EBR place of mating with current DBR to be reconstructed according to current DBR and current N;
Step B602: judge that SSN equals 0? be jump to step B603, otherwise jump to step B607;
Step B603: change the value of " sector number used before this subregion " of the subregion list item of this subregion in the to be reconstructed MBR mated with current DBR into N;
Step B604: judge that current DBR is the DBR of FAT32 subregion? be jump to step B605, otherwise jump to step B606;
Step B605: the sector Total no field value of this subregion in the subregion list item of described the to be reconstructed MBR mated with current DBR is changed into: record in current DBR self residing for the sector sum of subregion, and jump to step B613;
Step B606: the sector Total no field value of this subregion in the subregion list item of described the to be reconstructed MBR mated with current DBR is changed into: record in current DBR self residing for the sector sum+1 of subregion, and jump to step B613;
Step B607: judging that whether current DBR is the DBR of FAT32 subregion, is jump to step B608; Otherwise jump to step B610;
Step B608: the sector total value of this subregion in the to be reconstructed EBR mated with current DBR is set to record in current DBR self residing for the sector sum of subregion, and perform step B609;
Step B609: the end sector number of this subregion in described the to be reconstructed EBR mated with current DBR is set to: record in the current DBR of N+ self residing for the sector sum of subregion, and jump to step B613:
Step B610: judge that current DBR is the DBR of NTFS subregion? jump to step B611; Otherwise jump to step B614;
Step B611: the sector total value of this subregion in the to be reconstructed EBR mated with current DBR is set to: record in current DBR self residing for subregion sector sum+1;
Step B612: the end sector number of this subregion in the to be reconstructed EBR mated with current DBR is set to: record in the current DBR of N+ self residing for subregion sector sum+1;
Step B613: the information returning " reconstruct MBR/EBR success ", regards as correct partition information by the partition information that the successful MBR/EBR of reconstruct records, and jump to step B8;
Step B614: the information returning " reconstruct MBR/EBR failure ", and jump to steps A 4.
Preferably, in any one above-mentioned Windows disk partition restorative procedure, described S3 comprises:
Step C1: reading the partition table information in MBR/EBR, and judge whether to form subregion chain, is jump to step C2; Otherwise jump to step C5;
Step C2: judge that whether the subregion chain formed is correct, be perform step C3, otherwise perform step C5;
Step C3: the information of preserving described subregion chain, and make the sector number+1 that described in N=N+, subregion chain strides across, and continue to perform step C4;
Step C4: the end sector number recording described last subregion of subregion chain, and jump to steps A 1;
Step C5: judging that whether the partition information that the Article 1 subregion list item in current MBR/EBR records is correct, be perform step C6, otherwise redirect performs step C9;
Step C6: preserve the partition information that this is correct, and continue to perform step C7;
Step C7: the sector sum+1 making this subregion recorded in this correct partition information of N=N+, continues to perform step C8;
Step C8: the end sector number recording this subregion corresponding to correct partition information, jumps to steps A 1;
Step C9: record this incorrect MBR/EBR and it is numbered N, and performing step C10;
Step C10: make N=N+1, OFFSET=0, and return execution steps A 1.
Preferably, in above-mentioned Windows disk partition restorative procedure, does is the detailed determination methods of described steps A 5: first judge that current N is 0? that N number of sector of described disk is MBR; Otherwise whether the first two byte information judging N number of sector of described disk is again " 00 00 ", if then N number of sector of described disk is EBR, otherwise N number of sector of described disk is neither MBR neither EBR.
Preferably, in above-mentioned Windows disk partition restorative procedure, the determination methods of described steps A 6 is: first three byte reading N number of sector of described disk, if first three byte of N number of sector of described disk is " EB 52 90 " or " EB 58 90 ", then N number of sector of described disk is DBR; Otherwise N number of sector of described disk is not DBR.
The invention has the beneficial effects as follows: MBR/EBR and the DBR information having fully utilized Window system disk partition, different according to these information, different repair modes is adopted to repair Windows disk partition, when partition information MBR/EBR and DBR is seriously damaged, also disk partition can be repaired more accurately, have and repair accurately and advantage fast, in date restoring field, there is applicability widely.
Accompanying drawing explanation
Fig. 1 is the detail flowchart of a kind of Windows disk partition restorative procedure that the embodiment of the present invention provides;
Fig. 2 is the detailed determination methods process flow diagram of S110 in Fig. 1;
Fig. 3 is the detailed determination methods process flow diagram of S113 in Fig. 1;
Fig. 4 is the specific implementation method process flow diagram of S114-S115 in Fig. 1.
Embodiment
Below in conjunction with accompanying drawing, illustrate the embodiment of the present invention.
A kind of Windows disk partition restorative procedure that the embodiment of the present invention provides, the method comprises the following steps:
S1: judge whether the disk sector do not scanned? if not, then S4 is performed; If then scanning disk does not scan sector backward successively, find Master Boot Record, extended partition record EBR or dos boot record DBR, if Current Scan to be DBR, then perform S2, if Current Scan to be MBR or EBR, then perform S3.This step is the scanning carried out for the disk of FAT32 common under Windows and new technology file system subregion.
S2: judge that current DBR is the DBR that incorrect MBR/EBR mates? if then abandon current DBR; Otherwise then judge whether this DBR is backup DBR, if it is abandon, otherwise judge that whether this divisional description information correct according to the size of this subregion recorded in current DBR, divisional type information? reconstruct according to current DBR the MBR/EBR that mates with it and preserve this correct partition information, return and perform S1, otherwise directly return execution S1.
S3: according to partition table (the Disk Partition Table in MBR/EBR, DPT) information structure subregion chain, judge that whether the subregion chain formed is correct, if correct, preserve this subregion chain information, otherwise judge that whether this divisional description information that the Article 1 subregion list item in current MBR/EBR records is correct, preserve this correct partition information and return execution S1, otherwise directly returning execution S1.
S4: by all correct partition information write disk preserved.
The detail flowchart of a kind of Windows disk partition restorative procedure that Fig. 1 provides for the embodiment of the present invention, in Fig. 1: S103-S108 is the detailed process of S1 in said method provided by the invention; The flow process that S109-S115 and S121-S123 forms is the detailed implementation methods of the S2 in said method provided by the invention; The flow process that S116-S125 forms is the detailed implementation methods of the S3 in said method provided by the invention.Particularly, shown in Fig. 1, method comprises the following steps:
S101: open disk.
S102: the sector sum SUM obtaining disk, and make the end sector number ESN=0 of last subregion.
S103: judge whether the current disk sector number N scanned is more than or equal to the sector sum SUM of disk, is jump to S4; Otherwise jump to S104.Wherein the initial value of N is set to 0; This step is equivalent to " judging whether the disk sector do not scanned " in step S1.
S104: make OFFSET=OFFSET+1, wherein OFFSET is the sector number of the MBR/EBR of the sector distance of the Current Scan previous mistake nearest with it, and initial value is 0.
S105: the information of last two bytes in N number of sector of reading disk, and judge whether it is " 55
AA "? be perform S107; Otherwise perform S106.In this step, because the end mark of MBR/EBR/DBR information is " 55AA ", this two byte is therefore adopted to judge.
S106: make N=N+1, and return execution S103.This step makes to scan sector number N and adds 1, namely continues the next sector of scanning disk.
S107: whether the N number of sector judging disk is MBR or EBR, is jump to S116, otherwise jumps to S108.The process of the concrete judgement of this step is: first judging whether current N is 0, is that N number of sector of 0 disk is MBR; Otherwise whether the first two byte information judging N number of sector of disk is again " 00 00 ", is, N number of sector of disk is EBR, otherwise N number of sector of disk is neither MBR neither EBR.
S108: whether the N number of sector judging disk is DBR, is, continues to perform S109, otherwise jumps to S106.Wherein, the determination methods of DBR is first three byte information of N number of sector of reading disk, if " EB 52 90 " or " EB 58 90 ", is then DBR; If not, then not DBR.
S109: judge whether current OFFSET is less than 70, is, jumps to S110, otherwise jump to S111.Wherein, the sector number that generally can offset this subregion MBR/EBR due to same subregion DBR is less than/equals 63, thus the sector number that the backup DBR of FAT32 generally offsets the EBR of subregion should be less than/equal 69, offset the sector number of DBR be generally 6 because FAT32 backs up DBR, so it is likely the judgment basis that the DBR/ belonging to certain incorrect MBR/EBR above backs up DBR that place adopts OFFSET to be less than 70 as current DBR.When OFFSET is not less than 70, then current DBR is likely the backup DBR of new technology file system.
S110: read incorrect MBR/EBR record, has judged whether that incorrect MBR/EBR mates with current DBR, if there is incorrect MBR/EBR to mate with current DBR, jumps to S106; Otherwise jump to S112.Wherein, when not having incorrect MBR/EBR to record at present, thinking and not having incorrect MBR/EBR to mate with current DBR.The specific implementation process of this step as shown in Figure 2, after be described in detail again.
S111: judging that whether current DBR is the DBR of NTFS subregion, is perform S113, otherwise performs S112.
S112: judging that in current DBR, whether " the sector sum of this subregion " field value is correct, is jump to S114; Otherwise jump to S106.
S113: read incorrect MBR/EBR record, judges whether current DBR can mate with incorrect MBR/EBR as the backup DBR of NTFS subregion, is jump to S106; Otherwise jump to S112.Wherein, when not having incorrect MBR/EBR to record at present, think that current DBR can not mate with incorrect MBR/EBR as the backup DBR of NTFS subregion, redirect performs step S112.The specific implementation process of this step as shown in Figure 3, after be described in detail again.
S114: reconstruct the MBR/EBR mated with it according to current DBR.
S115: judge whether the MBR/EBR mated with current DBR reconstructs successfully, is, regards as correct partition information by the partition information that the successful MBR/EBR of reconstruct records, and jumps to S121; Otherwise jump to S106.Wherein restructuring procedure as shown in Figure 5.
S116: reading the partition table information in MBR/EBR, and judge whether to form subregion chain, is jump to S117; Otherwise jump to S120.
S117: judge that whether the subregion chain formed is correct, be perform S118, otherwise perform S120.
S118: preserve described subregion chain information, and the sector number+1 making that this subregion chain of N=N+ strides across, and continue to perform S119.
S119: the end sector number ESN recording described last subregion of subregion chain, and jump to S103.
S120: judging that whether the partition information that the Article 1 subregion list item (this subregion list item describes the partition information of this subregion) in current MBR/EBR records is correct, be perform S121, otherwise redirect performs S124.
S121: preserve the partition information that this is correct, and continue to perform S122.
S122: the sector sum+1 making this subregion recorded in this correct partition information of N=N+, continues to perform S123.
S123: the end sector number ESN recording this subregion corresponding to correct partition information, jumps to S103.
S124: record this incorrect MBR/EBR and it is numbered N, and performing S125.
S125: make N=N+1, OFFSET=0, and return execution S103.
Fig. 2 is the detailed determination methods process flow diagram of S110 in Fig. 1, namely judges to comprise the following steps the process flow diagram whether current DBR mates with incorrect MBR/EBR:
S201: the end sector number ESN inputting the current total N in the sector scanned and previous subregion;
S202: the flag F lag=flase that backup DBR is set, and calculate the value hiding sector number field in the current DBR of MBR/EBR place sector number SSN:SSN=N-mated with current DBR;
S203: judge that SSN equals 0? be jump to S204, otherwise jump to S207;
S204: judged whether incorrect MBR record? if not, then S215 is jumped to; If so, then S205 is jumped to;
S205: " sector number used before this subregion " field value reading the Article 1 subregion list item in incorrect MBR, and judge whether to equal N? be jump to S206, otherwise jump to S215;
Does S206: read the Article 1 subregion list item in incorrect MBR, judge that whether this subregion list item identical with sector sum with this divisional type described in current DBR? be jump to S214, otherwise jump to S215;
S207: judge whether SSN is less than or equal to ESN, is, jumps to S214; Otherwise jump to S208.
S208: inquire about incorrect EBR record, judges whether the incorrect EBR being numbered SSN, if then perform S209; Otherwise perform S210;
S209: judge current queries to incorrect EBR and current DBR in the divisional type that describes whether identical, be jump to S213, otherwise jump to S211.
S210: judge whether the flag F lag backing up DBR is True, is jump to S215; Otherwise jump to S211.
S211: judging that whether current DBR is the DBR of FAT32 subregion, is jump to S212; Otherwise jump to S215.
S212: calculate alternate sector number in the value-current DBR hiding sector number field in the current DBR of sector number SSN:SSN=N-of the EBR that may mate with current DBR, and the flag F lag=True of order backup DBR, jump to S207.SSN in this step is the sector position at the EBR possibility place of mating with current DBR.
S213: judge current queries to incorrect EBR in record self residing for subregion sector sum and current DBR in record self residing for the sector sum of subregion whether identical, be jump to S214, otherwise jump to S211.Wherein, if new technology file system, the sector of subregion adds up to: describe in current DBR self residing for the sector total value+1 of subregion because last sector of subregion leaves backup for, DBR employs.
S214: the judged result returning " having incorrect MBR/EBR to mate with current DBR ", and redirect performs S106.
S215: the judged result returning " not having incorrect MBR/EBR to mate with current DBR ", and redirect performs S112.
Fig. 3 is the detailed determination methods process flow diagram of S113 in Fig. 1, namely judges that whether current DBR is the process flow diagram of the backup DBR of the MBR/EBR of incorrect NTFS, specifically comprises the following steps:
S301: the end sector number ESN inputting the current total N in the sector scanned and previous subregion.
S302: the sector number SSN:SSN=N-(hiding the value+1 of sector number field in the sector sum+current DBR of subregion residing for current DBR) calculating the EBR place of mating with current DBR;
S303: judge whether SSN is less than the end sector number ESN of previous subregion, is jump to S307; Otherwise jump to S304;
S304: inquire about incorrect MBR/EBR record, judges whether the incorrect MBR/EBR record being numbered SSN; Jump to S305; Otherwise jump to S308;
S305: judge current queries to incorrect MBR/EBR and current DBR in the divisional type that describes whether identical, be jump to S306; Otherwise jump to S308;
S306: judge described current queries to incorrect MBR/EBR in record self residing for subregion sector sum whether than record in current DBR self residing for the sector sum large 1 of subregion, be jump to S307; Otherwise jump to S308;
S307: the judged result returning " having incorrect MBR/EBR to mate with current DBR ", and redirect performs S106;
S308: the judged result returning " not having incorrect MBR/EBR to mate with current DBR ", and redirect performs S112.
Fig. 4 is the specific implementation method process flow diagram of S114-S115 in Fig. 1, and the process flow diagram of the MBR/EBR namely mated with it according to current DBR signal reconstruct, comprises the following steps:
S401: calculate the value hiding sector number field in the current DBR of sector number SSN:SSN=N-at the MBR/EBR place of mating with current DBR to be reconstructed according to current DBR and the current sector sum N scanned;
S402: judge whether SSN equals 0, is, jumps to S403, otherwise jump to S407;
S403: change the value of " sector number used before this subregion " of the subregion list item of this subregion in the to be reconstructed MBR mated with current DBR into N;
S404: judge that whether current DBR is the DBR of FAT32 subregion, be jump to S405, otherwise jump to S406;
S405: the sector Total no field value of this subregion in the subregion list item of the to be reconstructed MBR mated with current DBR is changed into: record in current DBR self residing for the sector sum of subregion, and jump to S413;
S406: the sector Total no field value of this subregion in the subregion list item of the to be reconstructed MBR mated with current DBR is changed into: record in current DBR self residing for the sector sum+1 of subregion, and jump to S413;
S407: judging that whether current DBR is the DBR of FAT32 subregion, is jump to S408; Otherwise jump to S410;
S408: the sector total value of this subregion in the to be reconstructed EBR mated with current DBR is set to record in current DBR self residing for the sector sum of subregion;
S409: the end sector number ESN of this subregion in the to be reconstructed EBR mated with current DBR is set to: record in the current DBR of ESN=N+ self residing for the sector sum of subregion, and jump to S413;
S410: judge that current DBR is the DBR of NTFS subregion? jump to S411; Otherwise jump to S414;
S411: the sector total value of this subregion in the to be reconstructed EBR mated with current DBR is set to: record in current DBR self residing for subregion sector sum+1;
S412: the end sector number ESN of this subregion in the to be reconstructed EBR mated with current DBR is set to: record in the current DBR of ESN=N+ self residing for subregion sector sum+1;
S413: the information returning " reconstruct MBR/EBR success ", regards as correct partition information by the partition information that the successful MBR/EBR of reconstruct records, and jump to S121;
S414: the information returning " reconstruct MBR/EBR failure ", and jump to S106.
Above-mentioned Windows disk partition restorative procedure provided by the invention has fully utilized MBR/EBR and the DBR information of Window system disk partition, different according to these information, different repair modes is adopted to repair Windows disk partition, when partition information MBR/EBR and DBR is seriously damaged, also disk partition can be repaired more accurately, have and repair accurately and advantage fast, in date restoring field, there is applicability widely.
Obviously, those skilled in the art can carry out various change and modification to the present invention and not depart from the spirit and scope of the present invention.Like this, if these amendments of the present invention and modification belong within the scope of the claims in the present invention and equivalent technologies thereof, then the present invention is also intended to comprise these change and modification.

Claims (8)

1. a Windows disk partition restorative procedure, is characterized in that, the method comprises the following steps:
S1: judge whether the disk sector do not scanned? if not, then S4 is performed; If then successively backward scanning disk do not scan sector, find Master Boot Record, extended partition record EBR or dos boot record DBR, if Current Scan to be DBR, then perform S2, if Current Scan to be MBR or EBR, then perform S3;
S2: judge that current DBR is the DBR that incorrect MBR/EBR mates? if then abandon current DBR; Otherwise then judge whether current DBR is backup DBR, if it is abandon, otherwise the information such as size, divisional type according to this subregion recorded in current DBR judges that whether this divisional description information correct? reconstruct according to current DBR the MBR/EBR that mates with it and preserve this correct partition information, return and perform S1, otherwise directly return execution S1;
S3: form subregion chain according to the partition table information in MBR/EBR, if the subregion chain formed correctly, preserve this subregion chain information, otherwise judge that whether this divisional description information that the Article 1 subregion list item in current MBR/EBR records is correct, preserve this correct partition information and return execution S1, otherwise directly returning execution S1;
S4: by all correct partition information write disk preserved;
Also comprise step before described S1: open disk, obtain the sector sum SUM of described disk, and make the end sector number of last subregion be 0;
Described S1 comprises the following steps:
Steps A 1: judge that the current disk sector number N scanned is more than or equal to described SUM? jump to S4; Otherwise jump to steps A 2; Wherein the initial value of N is set to 0;
Steps A 2: make OFFSET=OFFSET+1, continues to perform steps A 5; Wherein, OFFSET is the sector number of the MBR/EBR of the sector distance of the Current Scan previous mistake nearest with it, and the initial value of described OFFSET is 0;
Steps A 3: the information reading last two bytes in N number of sector of described disk, and judge that it is " 55AA "? perform steps A 5; Otherwise perform steps A 4;
Steps A 4: make N=N+1, and return execution steps A 1;
Steps A 5: the N number of sector judging described disk is MBR or EBR? be perform S3, otherwise perform steps A 6;
Steps A 6: the N number of sector judging described disk is DBR? continue to perform S2, otherwise jump to steps A 4.
2. a kind of Windows disk partition restorative procedure as claimed in claim 1, it is characterized in that, described S2 comprises:
Step B1: judge whether current OFFSET is less than 70, is, performs step B2, otherwise perform step B3;
Step B2: read incorrect MBR/EBR record, has judged whether that incorrect MBR/EBR mates with current DBR, if there is incorrect MBR/EBR to mate with current DBR, jumps to steps A 4; Otherwise jump to step B4;
Step B3: judging that whether current DBR is the DBR of NTFS subregion, is perform step B5, otherwise performs step B4;
Step B4: judging that in current DBR, whether " the sector sum of this subregion " field value is correct, is jump to step B6; Otherwise jump to steps A 4;
Step B5: read incorrect MBR/EBR record, judges whether current DBR can mate with incorrect MBR/EBR as the backup DBR of NTFS subregion, is perform steps A 4; Otherwise perform step B4;
Step B6: reconstruct the MBR/EBR mated with it according to current DBR, continues to perform step B7;
Step B7: judge that the MBR/EBR mated with current DBR reconstructs successfully? if then the partition information that the successful MBR/EBR of reconstruct records is regarded as correct partition information, and jumps to step B8; Otherwise jump to steps A 4;
Step B8: preserve the partition information that this is correct, and continue to perform step B9;
Step B9: the sector sum+1 making this subregion recorded in this correct partition information of N=N+, continues to perform step B10;
Step B10: the end sector number recording this subregion corresponding to correct partition information, jumps to steps A 1.
3. a kind of Windows disk partition restorative procedure as claimed in claim 2, it is characterized in that, the detailed determination methods of described step B2 is:
Step B201: the end sector number inputting current N and previous subregion;
Step B202: the flag F lag arranging backup DBR is flase, and calculates the value hiding sector number field in the current DBR of MBR/EBR place sector number SSN:SSN=N-mated with current DBR;
Step B203: judge that SSN equals 0? be jump to step B204, otherwise jump to step B207;
Step B204: judged whether incorrect MBR record? if so, then step B205 is jumped to; If not, then step B215 is jumped to;
Step B205: " sector number used before this subregion " field value reading the Article 1 subregion list item in described incorrect MBR, and judge whether to equal N? be jump to step B206, otherwise jump to step B215;
Step B206: judge in the Article 1 subregion list item in described incorrect MBR whether identical with sector sum with this divisional type described in current DBR? be jump to step B214, otherwise jump to step B215;
Step B207: judge that SSN is less than or equal to the end sector number of previous subregion? jump to step B214; Otherwise perform step B208;
Step B208: inquire about incorrect EBR record, judges whether the incorrect EBR being numbered SSN, has and then performs step B209; Otherwise perform step B210;
Step B209: judge current queries to incorrect EBR and current DBR in the divisional type that describes whether identical? be jump to step B213, otherwise jump to step B211;
Step B210: judge that the flag F lag of described backup DBR is True? jump to step B215; Otherwise perform step B211;
Step B211: judge that current DBR is the DBR of FAT32 subregion? perform step B212; Otherwise jump to step B215;
Step B212: make alternate sector number in the value-current DBR hiding sector number field in the current DBR of SSN=N-, the flag F lag of order backup DBR is True, and returns execution step B207;
Step B213: judge described current queries to incorrect EBR in record self residing for subregion sector sum and current DBR in record self residing for the sector sum of subregion whether identical, be jump to step B214, otherwise jump to step B211;
Step B214: the judged result returning " having incorrect MBR/EBR to mate with current DBR ", and redirect performs steps A 4;
Step B215: the judged result returning " not having incorrect MBR/EBR to mate with current DBR ", and redirect performs step B4.
4. a kind of Windows disk partition restorative procedure as claimed in claim 3, it is characterized in that, the detailed determination methods of described step B5 is:
Step B501: the end sector number inputting current N and previous subregion;
Step B502: the sector number SSN:SSN=N-(hiding the value+1 of sector number field in the sector sum+current DBR of subregion residing for current DBR) calculating the EBR place of subregion residing for current DBR;
Step B503: judge that SSN is less than the end sector number of previous subregion? jump to step B507; Otherwise jump to step B504;
Step B504: inquire about incorrect MBR/EBR record, judges whether the incorrect MBR/EBR record being numbered SSN; Jump to step B505; Otherwise jump to step B508;
Step B505: judge current queries to incorrect MBR/EBR and current DBR in the divisional type that describes whether identical, be jump to step B506; Otherwise jump to step B508;
Step B506: judge current queries to incorrect MBR/EBR in record self residing for subregion sector sum whether than record in current DBR self residing for the sector sum large 1 of subregion, be jump to step B507; Otherwise jump to step B508;
Step B507: the judged result returning " having incorrect MBR/EBR to mate with current DBR ", and redirect performs steps A 4;
Step B508: the judged result returning " not having incorrect MBR/EBR to mate with current DBR ", and redirect performs step B4.
5. a kind of Windows disk partition restorative procedure as claimed in claim 4, it is characterized in that, described step B6-step B7 comprises:
Step B601: calculate the value hiding sector number field in the current DBR of sector number SSN:SSN=N – at the MBR/EBR place of mating with current DBR to be reconstructed according to current DBR and current N;
Step B602: judge that SSN equals 0? be jump to step B603, otherwise jump to step B607;
Step B603: change the value of " sector number used before this subregion " of the subregion list item of this subregion in the to be reconstructed MBR mated with current DBR into N;
Step B604: judge that current DBR is the DBR of FAT32 subregion? be jump to step B605, otherwise jump to step B606;
Step B605: the sector Total no field value of this subregion in the subregion list item of described the to be reconstructed MBR mated with current DBR is changed into: record in current DBR self residing for the sector sum of subregion, and jump to step B613;
Step B606: the sector Total no field value of this subregion in the subregion list item of described the to be reconstructed MBR mated with current DBR is changed into: record in current DBR self residing for the sector sum+1 of subregion, and jump to step B613;
Step B607: judging that whether current DBR is the DBR of FAT32 subregion, is jump to step B608; Otherwise jump to step B610;
Step B608: the sector total value of this subregion in the to be reconstructed EBR mated with current DBR is set to record in current DBR self residing for the sector sum of subregion, and perform step B609;
Step B609: the end sector number of this subregion in described the to be reconstructed EBR mated with current DBR is set to: record in the current DBR of N+ self residing for the sector sum of subregion, and jump to step B613; Step B610: judge that current DBR is the DBR of NTFS subregion? jump to step B611; Otherwise jump to step B614;
Step B611: the sector total value of this subregion in the to be reconstructed EBR mated with current DBR is set to: record in current DBR self residing for subregion sector sum+1;
Step B612: the end sector number of this subregion in the to be reconstructed EBR mated with current DBR is set to: record in the current DBR of N+ self residing for subregion sector sum+1;
Step B613: the information returning " reconstruct MBR/EBR success ", regards as correct partition information by the partition information that the successful MBR/EBR of reconstruct records, and jump to step B8;
Step B614: the information returning " reconstruct MBR/EBR failure ", and jump to steps A 4.
6. a kind of Windows disk partition restorative procedure as described in any one of claim 1 to 5, it is characterized in that, described S3 comprises:
Step C1: reading the partition table information in MBR/EBR, and judge whether to form subregion chain, is jump to step C2; Otherwise jump to step C5;
Step C2: judge that whether the subregion chain formed is correct, be perform step C3, otherwise perform step C5;
Step C3: the information of preserving described subregion chain, and make the sector number+1 that described in N=N+, subregion chain strides across, and continue to perform step C4;
Step C4: the end sector number recording described last subregion of subregion chain, and jump to steps A 1;
Step C5: judging that whether the partition information that the Article 1 subregion list item in current MBR/EBR records is correct, be perform step C6, otherwise redirect performs step C9;
Step C6: preserve the partition information that this is correct, and continue to perform step C7;
Step C7: the sector sum+1 making this subregion recorded in this correct partition information of N=N+, continues to perform step C8;
Step C8: the end sector number recording this subregion corresponding to correct partition information, jumps to steps A 1;
Step C9: record this incorrect MBR/EBR and it is numbered N, and performing step C10;
Step C10: make N=N+1, OFFSET=0, and return execution steps A 1.
7. a kind of Windows disk partition restorative procedure as claimed in claim 6, it is characterized in that, does is the detailed determination methods of described steps A 5: first judge that current N is 0? that N number of sector of described disk is MBR; Otherwise whether the first two byte information judging N number of sector of described disk is again " 0000 ", if then N number of sector of described disk is EBR, otherwise N number of sector of described disk is neither MBR neither EBR.
8. a kind of Windows disk partition restorative procedure as claimed in claim 7, it is characterized in that, the determination methods of described steps A 6 is: first three byte reading N number of sector of described disk, if first three byte of N number of sector of described disk is " EB 52 90 " or " EB 58 90 ", then N number of sector of described disk is DBR; Otherwise N number of sector of described disk is not DBR.
CN201210277142.3A 2012-08-06 2012-08-06 Repair method for Window system disk partition Active CN102819462B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210277142.3A CN102819462B (en) 2012-08-06 2012-08-06 Repair method for Window system disk partition

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210277142.3A CN102819462B (en) 2012-08-06 2012-08-06 Repair method for Window system disk partition

Publications (2)

Publication Number Publication Date
CN102819462A CN102819462A (en) 2012-12-12
CN102819462B true CN102819462B (en) 2015-02-18

Family

ID=47303586

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210277142.3A Active CN102819462B (en) 2012-08-06 2012-08-06 Repair method for Window system disk partition

Country Status (1)

Country Link
CN (1) CN102819462B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103294960A (en) * 2013-06-06 2013-09-11 国家电网公司 Portable data wiping device based on U disk
CN105278881A (en) * 2015-10-23 2016-01-27 云南大学 Method for recovering GPT of NTFS
CN107632774B (en) * 2016-07-13 2020-10-20 深圳市大迈科技有限公司 Method and device for repairing disk mount
CN106407034A (en) * 2016-10-08 2017-02-15 四川秘无痕信息安全技术有限责任公司 Method for parsing catalogue of defect hard disk for data recovery
CN107491362A (en) * 2017-08-04 2017-12-19 云南大学 It is a kind of while recover GPT partition tables and NTFS_DBR method
CN108776577A (en) * 2018-05-04 2018-11-09 新华三技术有限公司成都分公司 Disk management method, device, electronic equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1103895A2 (en) * 1999-11-17 2001-05-30 Finaldata Inc. Disk data recovery method
CN1858714A (en) * 2005-11-07 2006-11-08 珠海金山软件股份有限公司 Method for preventing and resolving data from lossing
CN101763296A (en) * 2010-01-14 2010-06-30 常熟理工学院 Fast reverse search restructuring and recovery method of hard disk partition table

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1103895A2 (en) * 1999-11-17 2001-05-30 Finaldata Inc. Disk data recovery method
CN1858714A (en) * 2005-11-07 2006-11-08 珠海金山软件股份有限公司 Method for preventing and resolving data from lossing
CN101763296A (en) * 2010-01-14 2010-06-30 常熟理工学院 Fast reverse search restructuring and recovery method of hard disk partition table

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
数据恢复技术中分区表恢复的研究与实现;冯云鹏等;《计算机与信息技术》;20101231(第12期);第10-13页 *
硬盘分区手动恢复的实现;金兰;《内蒙古科技与经济》;20110131(第2期);第93-94页 *

Also Published As

Publication number Publication date
CN102819462A (en) 2012-12-12

Similar Documents

Publication Publication Date Title
CN102819462B (en) Repair method for Window system disk partition
JP5479265B2 (en) System and method for optimizing redundancy restoration in a distributed data layout environment
US7418550B2 (en) Methods and structure for improved import/export of raid level 6 volumes
Schindler et al. Automated disk drive characterization
US6993679B2 (en) System and method for inhibiting reads to non-guaranteed data in remapped portions of a storage medium
US8285679B2 (en) Creating a buffer point-in-time copy relationship for a point-in-time copy function executed to create a point-in-time copy relationship
CN103177127A (en) Jukebox-based database storage system and method using same
CN103034592B (en) Data processing method and device
CN107391333A (en) A kind of OSD disk failures method of testing and system
WO2013030730A1 (en) Transferring de-duplicated data organized in virtual volumes to a target set of physical media
US9858287B2 (en) Storage system
CN1277209C (en) Hard disk data controlling method
US20010049776A1 (en) Method and apparatus for inter-disk copy processing, and a computer product
CN107273449B (en) Breakpoint processing method and system based on memory database
CN103020510A (en) Method and device for identifying illegal writing in portable storage equipment
CN105892954A (en) Data storage method and device based on multiple copies
CN105808385A (en) Anti-loss method of hard disk data
CN107832455A (en) A kind of data capture method of storage object, system, equipment and storage medium
CN102831025B (en) A kind of DBR data recovery method of FAT32 file system
CN113190179B (en) Method for prolonging service life of mechanical hard disk, storage device and system
Fairbanks et al. Column: Factors affecting data decay
CN111931255A (en) Automatic destroying and copying system
CN111221801A (en) Database migration method, system and related device
CN106611364A (en) Storage fragmentation arrangement method and device
CN102981935B (en) A kind of method strengthening memory apparatus system dish reliability

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant