CN102831025A - DBR (DOS boot record) data repairing method of FAT32 file system - Google Patents

DBR (DOS boot record) data repairing method of FAT32 file system Download PDF

Info

Publication number
CN102831025A
CN102831025A CN2012102771457A CN201210277145A CN102831025A CN 102831025 A CN102831025 A CN 102831025A CN 2012102771457 A CN2012102771457 A CN 2012102771457A CN 201210277145 A CN201210277145 A CN 201210277145A CN 102831025 A CN102831025 A CN 102831025A
Authority
CN
China
Prior art keywords
dbr
sector
field
fat
value
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.)
Granted
Application number
CN2012102771457A
Other languages
Chinese (zh)
Other versions
CN102831025B (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 Information Security Research Institute 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 CN201210277145.7A priority Critical patent/CN102831025B/en
Publication of CN102831025A publication Critical patent/CN102831025A/en
Application granted granted Critical
Publication of CN102831025B publication Critical patent/CN102831025B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention relates to a DBR (DOS boot record) data repairing method of an FAT32 file system. The DBR data repairing method comprises the following steps of: opening a disk, positioning a sector where the DBR of the current FAT32 subsection is located in the disk, and searching a back-up DBR; reading information of a field to be repaired in the DBR, and copying the DBR information of other FAT32 subsections to non-BPB (Bios Parameter Block) field information; and for BPB field information, judging which one of the three types the field of which the information is to be repaired is in, and then repairing the different types of fields by using different methods, wherein the three types of fields comprise a field non-relevant to a file storage structure, a field relevant to the file storage structure without need of verification, and a field relevant to the file storage structure and in need of verification. According to the DBR data repairing method provided by the invention, the BPB field information in the DBR is reasonably classified, and different repairing methods are used for the fields with different types, so that the time and the cost for repairing the DBR parameters can be effectively reduced, and the accuracy of repairing the DBR parameter can be improved.

Description

A kind of DBR data recovery method of FAT32 file system
Technical field
The present invention relates to data recovery method, more particularly, relate to a kind of DBR data recovery method of FAT32 file system.
Background technology
Along with the development of information-based and infotech, 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 numerous factors such as virus infections, maloperation, unscheduled event are all threatening the safety of data, and when in a single day some significant datas damage or lose, its loss sometimes is quite serious.Yet, in practical application, be difficult to avoid occurring corrupted data and the phenomenon of losing again.Therefore, those significant datas that wreck are effectively recovered to be quite necessary.
Software and method thereof that data are recovered have a lot, and wherein, subregion reparation class software is a kind of mode of restore data indirectly, promptly through repairing the data that subregion comes finding lost.The advantage of this repair mode is: resume speed is exceedingly fast, in case and subregion reparation success, file wherein also just can both recover thereupon.Yet these subregions reparation softwares or method all can not satisfy the demand of the DBR data repair of FAT32 preferably at present, and wherein FAT32 is a kind of use file system of Windows widely, and a lot of operating platforms are all supported the FAT32 file system.
Current, the method for the DBR data repair of FAT32 generally there are two kinds: the one, to adopt " backup repairing method ", but when backing up DBR and destroyed, the reparation that will cause these class methods is complete failure as a result; The 2nd, different according to divisional type and size to each field of DBR assignment again, and the assignment of some parameter adopted default value or statistical value, obvious like this is incorrect.
Summary of the invention
The technical matters that the present invention will solve is, to the above-mentioned defective of prior art, a kind of DBR data recovery method of FAT32 file system is provided.
The technical solution adopted for the present invention to solve the technical problems is:
Construct a kind of DBR data recovery method of FAT32 file system, wherein, comprising:
Open disk, locate the sector, DBR place of current FAT32 subregion in the said disk, and inquiry backup DBR;
Read the information of field to be repaired among the DBR,, other the DBR information of FAT32 subregion is copied into repairing for non-BPB field information; Judge earlier that for the BPB field information which kind of in three types of fields said field information to be repaired be; Repair respectively to the inhomogeneity field again; Wherein, said three types of fields comprise: with the field of file storage structure-irrelevant, but the field and the field with file storage structure relevant and that needs verify that need not verify relevant with the file storage structure;
When said field to be repaired is the field with the file storage structure-irrelevant, utilize default value to repair said field to be repaired;
In said field to be repaired during for but the field that need not verify relevant, according to the said field to be repaired of file storage structure repair with the file storage structure;
When said field to be repaired is relevant with the file storage structure and needs the field of checking; Whether the field information according to file storage structure verification DBR is correct, correctly then withdraws from, the incorrect backup DBR that then judged whether; If the value that does not have then directly repair DBR according to the file storage structure; If have then whether correct, be the value of then repairing the DBR field, otherwise directly repair the value of DBR according to the file storage structure according to the field information of file storage structure verification backup DBR.
DBR data recovery method of the present invention; Wherein, the said and field file storage structure-irrelevant comprises: every sector byte number field, Media Description symbol field, every magnetic track sector number field, magnetic head digital section, tag field, version field, filesystem information sector number field, reserved field, BIOS drive letter field, expansion leader label field, volume serial number field, label field, file system type field;
The said process of utilizing default value to repair said field to be repaired is specially: in the field of said and file storage structure-irrelevant, insert default value.
DBR data recovery method of the present invention, wherein, said but field that need not verify relevant with the file storage structure comprises: first bunch of number field of the sector number field of subregion and root directory;
When said but field that need not verify relevant with the file storage structure is the sector number field of subregion; Said process according to the said field to be repaired of file storage structure repair comprises: according to the sector sum that the EBR or the partition information among the MBR of said subregion gets access to this subregion, the sector sum of the said subregion that is obtained is filled into the sector number field of said subregion;
When said but field that need not verify relevant with the file storage structure was first bunch number field of root directory, said process according to the said field to be repaired of file storage structure repair comprised: insert " 0x 02 00 00 00 " in first bunch of number field of said root directory.
DBR data recovery method of the present invention; Wherein, said relevant with the file storage structure and need the field of checking to comprise: every bunch of sector number field, DOS reserve sector digital section, a FAT digital section, hiding sector fields, every FAT sector number field and DBR alternate sector field.
DBR data recovery method of the present invention, wherein, said relevant with the file storage structure and when needing the field of checking to be DBR alternate sector field, the data repair process comprises step:
E11, reading DBR alternate sector field value among the DBR, read squint the backward sectors of data of this number of DBR then, judge whether it is DBR, is to represent that then DBR alternate sector field value is correct, thus withdraw from, otherwise execution in step E12;
E12, because DBR alternate sector field information mistake among the DBR can't find the DBR of backup, so do not have the DBR of backup, then direct execution in step E13;
E13, search for backward from DBR, when the sector of finding backup DBR place or search have surpassed this subregion size till, if find sector, backup DBR place, then this sector is exactly DBR alternate sector number to the sector, interval of DBR sector; If do not find the DBR of backup, then insert default value " Ox06 00 ".
DBR data recovery method of the present invention, wherein, when hiding sector fields, the data repair process comprises step in the said and field that needs checking relevant with the file storage structure:
E21, reading among the DBR and to hide the sector number field value, read squint the forward sectors of data of this number of DBR then, judge whether it is EBR or MBR, is that then to represent to hide the sector number field value among the DBR correct, thus withdraw from, otherwise execution in step E22;
Whether E22, judgement backup DBR exist, otherwise execution in step E23; Be then to read among the backup DBR to hide sector number; Read squint the forward sectors of data of this number of DBR then; Judging whether it is EBR or MBR, is to represent then to back up among the DBR that to hide the sector number field value correct, repairs according to this value and hides the sector number field among the DBR; Withdraw from then, otherwise execution in step E23;
E23, search for forward from DBR, the sector up to EBR that finds this subregion or MBR place, this sector is exactly the number of hiding sector to the interval sector number of DBR sector.
DBR data recovery method of the present invention, wherein, said relevant with the file storage structure and when needing the field of checking to be DOS reserve sector digital section, the data repair process comprises step:
E31, read among the DBR DOS reserve sector numeral segment value; Reading squint the backward information of sector of this number of DBR then, judge whether it is the gauge outfit " 0xF8 FF FF 0F FF FF FF FF " of FAT, is to represent that then DOS reserve sector numeral segment value is correct among the DBR; So withdraw from, otherwise carry out E32;
Whether E32, judgement backup DBR exist, otherwise carry out E33, are the numbers that then reads reserve sector among the backup DBR; Read squint the backward information of sector of this number of DBR then; Judging whether it is the gauge outfit " 0xF8 FF FF 0F FF FF FF FF " of FAT, is that then to represent to back up among the DBR DOS reserve sector numeral segment value correct, repairs DOS reserve sector digital section among the DBR according to this value; Withdraw from then, otherwise carry out E33;
E33, search for backward from DBR, up to the sector at the gauge outfit that finds FAT " 0xF8 FF FF 0F FF FF FF FF " place, this sector is exactly a DOS reserve sector number to the sector, interval of DBR sector; If when scanning the subregion end, also do not find the FAT gauge outfit, then finish to repair the flow process of DBR.
DBR data recovery method of the present invention, wherein, said DBR data recovery method also comprises:
After the reparation of accomplishing said DOS reserve sector digital section, said every FAT sector number field is repaired, the repair process of said every FAT sector number field is comprised step:
E41, read every FAT sector number field value among the DBR and repair after the reserve sector field value; And then read squint the backward sector auxiliary information of " after every FAT sector number field value+reparation DOS reserve sector numeral segment value " of DBR; Judge whether it is gauge outfit or the root directory of FAT; Be to represent that then every FAT sector number field value is correct among the DBR, thus withdraw from, otherwise execution in step E42;
Whether E42, judgement backup DBR exist; Otherwise execution in step E43; Be the DOS reserve sector field value after then reading every FAT sector number field value among the backup DBR and repairing, and then read squint the backward sector auxiliary information of " the digital segment value of the reserve sector among the backup DBR after every FAT sector number field value+reparations " of DBR, judge whether it is gauge outfit or the root directory of FAT; Be that then to represent to back up among the DBR every FAT sector number field value correct; Repair every FAT sector number field among the DBR according to this value, withdraw from then, otherwise execution in step E43;
E43, begin search from squint the backward sector of the DOS reserve sector numeral segment value after repairing of DBR, till the sector of finding FAT gauge outfit or root directory place, this sector is exactly every FAT sector number to the sector, interval that the FAT gauge outfit belongs to the sector.
DBR data recovery method of the present invention, wherein, said DBR data recovery method also comprises:
After the reparation of accomplishing said every FAT sector number field, a said FAT digital section is repaired, the repair process of a said FAT digital section is comprised step:
E51, read FAT number field value among the DBR, the DOS reserve sector numeral segment value after repairing and repair after FAT sector number field value; Read squint the backward sector auxiliary information of " the FAT sector number field value * FAT number field value after DOS reserve sector after reparation numeral segment value+reparation " of DBR then; Judge whether it is sector, root directory place; Be to represent that then FAT number field value is correct among the DBR, thus withdraw from, otherwise execution in step E52;
Whether E52, judgement backup DBR exist, otherwise execution in step E53 is the FAT number field value that then reads among the backup DBR; Read squint the backward sector auxiliary information of " the FAT sector number field value * FAT number field value after DOS reserve sector after reparation numeral segment value+reparation " of DBR then; Judging whether it is sector, root directory place, is that the FAT number field value then representing to back up among the DBR is correct, repairs FAT digital section among the DBR according to this value; Withdraw from then, otherwise execution in step E53;
E53, read squint the backward sector auxiliary information of " the FAT sector number field value * 1 after DOS reserve sector after reparation numeral segment value+reparation " of DBR; Judge whether it is sector, root directory place; Be then in DBR FAT digital section insert " 0x01 ", otherwise FAT digital section inserted " 0x02 " in DBR.
DBR data recovery method of the present invention, wherein, said DBR data recovery method also comprises:
After the reparation of accomplishing a said FAT digital section, said every bunch of sector number field is repaired, the repair process of said every bunch of sector number field is comprised step:
E61, obtain every bunch of sector number field value among the DBR, judge whether every bunch of sector number is correct, is then to withdraw from, otherwise execution in step E62;
Whether E62, judgement backup DBR exist, otherwise execution in step E63 is then to obtain every bunch of sector number field value among the backup DBR; Judge whether every bunch of sector number is correct among the backup DBR, if correct, the value of then repairing every bunch of sector number according to this value; Withdraw from then, otherwise execution in step E63;
E63, calculating FAT show the number of clusters order that shared sector can be represented, according to the relation of number of clusters order and subregion sector sum, calculate every bunch of sector number then, and every bunch of sector number value of last gained is for being not less than 2n and ∈ { 1; 2,4,8,16; 32,64, the integer of 128}, wherein said n are integer.
The invention has the beneficial effects as follows: according to the difference of repair mode; Reasonably the field information of the BPB among the DBR is classified; And, reduced effectively and repaired the time overhead of DBR parameter and improved reparation DBR veracity of parameters the dissimilar different restorative procedures of field employing.
Description of drawings
To combine accompanying drawing and embodiment that the present invention is described further below, in the accompanying drawing:
Fig. 1 is the DBR data recovery method process flow diagram of the FAT32 file system of preferred embodiment of the present invention.
Embodiment
Among following each embodiment of the present invention, MBR be behind the computer starting from starting on the medium code of graftabl at first and execution, be commonly used to explain partitioned organization, be example with the hard disk, be generally 0 sector of LBA; EBR, after the notion of MICROSOFT release extended partition, extended partition has just been continued to use the DPT structure that primary partition adopted, and in order to distinguish, people call EBR, EMBR, expansion MBR or virtual MBR to the sector at the partition table of extended partition place usually; DBR is that operating system gets into first sector that can visit after the file system, is commonly used to the instrument of interpretation system, in UNIX class file system, is equal to SUPERBLOCK.
Particularly, DBR mainly is made up of 5 parts: jump instruction, OEM code name, BPB, boot and end mark.Wherein, jump instruction, the OEM code name, the tetrameric information of boot and end mark all is relatively fixing, and it is only repaired and need other the DBR information of FAT32 subregion be copied into accomplishing.Therefore in essence, in fact be exactly reparation to the reparation of DBR to the BPB parameter block among the DBR, the field information of BPB is as shown in table 1 below.
The field information table of table 1BPB
Figure BSA00000760335800081
In the DBR data recovery method of the FAT32 file system of following each embodiment of the present invention; Difference according to restorative procedure; The field information of BPB in the above-mentioned table 1 is divided three classes: with the field of file storage structure-irrelevant; But the field that need not verify relevant with the file storage structure and relevant and need the field of checking with the file storage structure specifically is classified as follows shown in the table 2.
The field information sorted table of table 2BPB
Figure BSA00000760335800082
Figure BSA00000760335800091
In the DBR data recovery method of the FAT32 file system of preferred embodiment of the present invention; Difference according to repair mode; Reasonably the field information with the BPB among the DBR carries out above-mentioned classification; And, reduced effectively and repaired the time overhead of DBR parameter and improved reparation DBR veracity of parameters the dissimilar different restorative procedures of field employing.Specifically may further comprise the steps:
A, open disk, the MBR of current subregion or EBR information in the reading disk are according to divisional type description field information in MBR or the EBR partition table; Judge whether subregion is the FAT32 file system; Be then to begin to seek backward, navigate to the sector, DBR place of subregion, sector, the DBR of current FAT32 subregion place in the positioning disk from the initial sector of subregion; And inquiry backup DBR, otherwise process ends;
Wherein, The process of inquiry backup DBR does; Read among the BPB of DBR DBR alternate sector number, read squint the backward sectors of data of this alternate sector institute corresponding number of DBR then, judge whether it is backup DBR; Be the sector number that then writes down backup DBR place, be convenient to follow-up repair process and read the data message among the backup DBR; Otherwise search for backward from DBR, when the sector of finding backup DBR place or scanning have surpassed said subregion big or small till, if in said subregion, search backup DBR, then write down the sector number at its place; If do not search backup DBR, then record does not back up DBR.
B, read the information of field to be repaired among the DBR,, other the DBR information of FAT32 subregion is copied into accomplishing reparation for non-BPB field information; Judge earlier that for the BPB field information which kind of in three types of fields field information to be repaired be, repairs respectively to the inhomogeneity field again;
Wherein, three types of fields comprise: with the field of file storage structure-irrelevant, but the field and the field with file storage structure relevant and that needs verify that need not verify relevant with the file storage structure;
C, when field to be repaired is the field with the file storage structure-irrelevant, utilize default value to repair field to be repaired;
D, in field to be repaired during for but the field that need not verify relevant, according to file storage structure repair field to be repaired with the file storage structure;
E, when field to be repaired is relevant with the file storage structure and needs the field of checking; File storage structure according to the FAT32 file system; Whether the field value of verifying field to be repaired is correct, for incorrect field to be repaired among the DBR, checks the respective field among the backup DBR; According to the field value of the respective field among the file storage structure verification of the FAT32 file system backup DBR, and correct field value write in the field to be repaired of DBR; For all incorrect field to be repaired among DBR and the backup DBR, again these fields to be repaired are carried out assignment according to the file storage structure of FAT32 file system.
Particularly, the step a-e of above-mentioned DBR data recovery method is divided into step S0-S19, detailed process is as shown in Figure 1, comprises step:
S0, beginning;
S1, open disk, MBR of this subregion or EBR information are carried out S2 then in the reading disk;
S2, according to divisional type description field information in MBR or the EBR partition table, judge whether this subregion is the FAT32 file system, otherwise jump to S19, be then to carry out S3;
S3, begin to seek backward, navigate to the sector, DBR place of this subregion, carry out S4 then from the initial sector of this subregion;
S4, after navigating to the sector of DBR, inquiry backup DBR, the method for wherein searching backup DBR is following: read among the DBR DBR alternate sector number; Read squint the backward sectors of data of this number of DBR then; Judge whether it is DBR, be that just record backs up the sector number at DBR place, otherwise search for backward from DBR; Till when the sector of finding backup DBR place or scanning have surpassed this subregion big or small, if in this subregion, search the DBR of backup then write down the sector at its place; If do not search, then record does not have backup DBR, carries out S5 then;
S5, read the information of field to be repaired among the DBR, carry out S6 then;
S6, judge whether field to be repaired is the BPB field, be then to jump to S8, otherwise carry out S7;
S7, for the non-BPB field among the DBR, comprising: jump instruction, the OEM code name, the information of boot and end mark four fields is copied other the DBR information of FAT32 subregion into getting final product, and is jumped to S14;
S8, judge that whether this field information is relevant with the file storage structure, is then to jump to S10, otherwise jumps to S9;
S9, utilize default value to repair data to be repaired, and jump to S14;
S10, judge that whether field to be repaired need judge its correctness according to the file system storage organization, be then to jump to S11, otherwise jump to S15;
S11, according to the file storage structure, whether verifying field information correct, is then to jump to S14, otherwise jumps to S12;
Whether S12, judgement backup DBR exist, and are then to jump to S13, otherwise jump to S15;
S13, read the information of field to be repaired among the backup DBR, and jump to S16;
S14, judge whether to be the field that is still waiting to repair then to jump to S5, otherwise to jump to S18;
S15, according to the file storage structure, repair the information of field among the DBR, and jump to S14;
S16, according to the file storage structure, whether field information to be repaired is correct among the checking backup DBR, is then to jump to S17, otherwise jumps to S15;
S17, according to backup DBR information, repair field information to be repaired among the DBR, and jump to S14;
S18, amended DBR information is write among the backup DBR,, then DBR information is write skew and be the sector of " 0x06 ", carry out S19 then if do not back up DBR;
S19, end.
Further; Among the step c of above-mentioned DBR data recovery method; As above shown in the table 2; Comprise with the field of file storage structure-irrelevant: every sector byte number field, Media Description symbol field, every magnetic track sector number field, magnetic head digital section, tag field, version field, filesystem information sector number field, reserved field, BIOS drive letter field, expansion leader label field, volume serial number field, label field, file system type field, and comprise a plurality of unused word sections.Wherein, the process of utilizing default value to repair field to be repaired is specially, with the field of file storage structure-irrelevant in insert default value.
Wherein, the default value of inserting for each field is as shown in table 3 below:
Table 3 is repaired default value with the field of file storage structure-irrelevant
Figure BSA00000760335800121
Figure BSA00000760335800131
Further, in the steps d of above-mentioned DBR data recovery method, as above shown in the table 2, but field that need not verify relevant with the file storage structure comprises: first bunch of number field of the sector number field of subregion and root directory.When field relevant with the file storage structure but that need not to verify is the sector number field of subregion; Process according to file storage structure repair field to be repaired comprises: according to the sector sum that the EBR or the partition information among the MBR of subregion gets access to this subregion, the sector sum of the subregion that is obtained is filled into the sector number field of subregion; When field relevant with the file storage structure but that need not to verify is first bunch number field of root directory; The restorative procedure that is adopted is; Because in the FAT32 file system; All be to distribute to root directory to first bunch of data field to use, promptly be exactly No. 2 bunches, can repair so insert " 0x 02 00 00 00 " in first bunch of number field of root directory.
Further; In the above-mentioned DBR data recovery method; As above shown in the table 2, relevant with the file storage structure and need the field of checking to comprise: every bunch of sector number field, DOS reserve sector digital section, a FAT digital section, hiding sector fields, every FAT sector number field and DBR alternate sector field.To relevant with the file storage structure and need the reparation of the field of checking to comprise three steps: 1, whether correct according to the field information of the file storage structure verification DBR of FAT32 file system, correctly then withdraw from incorrect then carrying out for the 2nd step; 2, judged whether backup DBR,,, be the value of then repairing the DBR field, otherwise got into for the 3rd step if having then whether correct according to the field information of the file storage structure verification of FAT32 file system backup DBR if not then carried out for the 3rd step; 3, according to the file storage structure of FAT32 file system, the value of directly repairing DBR.Particularly, for different field more detailed restorative procedure is arranged, details are as follows.
When repairing relevant with the file storage structure and needing the field of checking, concrete data recovery method is following:
1, the repair process of DBR alternate sector field is following:
E11, reading DBR alternate sector field value among the DBR, read squint the backward sectors of data of this number of DBR then, judge whether it is DBR, is to represent that then DBR alternate sector field value is correct, thus withdraw from, otherwise execution in step e12;
E12, because DBR alternate sector field information mistake among the DBR can't find the DBR of backup, so do not have the DBR of backup, then direct execution in step e13;
E13, according to the file storage structure of FAT32 file system; Directly repair DBR alternate sector field among the DBR, specifically comprise: search for backward from DBR, up to the sector of finding backup DBR place or till searching for when surpassing this subregion size; If find sector, backup DBR place; Then this sector is exactly DBR alternate sector number to the sector, interval of DBR sector, if do not find the DBR of backup, then inserts default value " 0,x06 00 ".
2, the repair process of hiding sector number field is following:
E21, reading among the DBR and to hide the sector number field value, read squint the forward sectors of data of this number of DBR then, judge whether it is EBR or MBR, is that then to represent to hide the sector number field value among the DBR correct, thus withdraw from, otherwise execution in step e22;
Whether e22, judgement backup DBR exist, otherwise execution in step e23 is then to read among the backup DBR to hide sector number; Read squint the forward sectors of data of this number of DBR then; Judging whether it is EBR or MBR, is to represent then to back up among the DBR that to hide the sector number field value correct, repairs according to this value and hides the sector number field among the DBR; Withdraw from then, otherwise execution in step e23;
E23, according to the file storage structure of FAT32 file system; Directly repair and hide the sector number field among the DBR; Specifically comprise: search for forward from DBR, the sector up to EBR that finds this subregion or MBR place, this sector is exactly a number of hiding the sector to the interval sector number of DBR sector.
Relevant with the file storage structure and need in the field of checking, the repair process of all the other four fields has property successively, the following step1-step4 of reparation step that it is concrete:
Step1, DOS reserve sector digital section repair process are following:
E31, read among the DBR DOS reserve sector numeral segment value; Reading squint the backward information of sector of this number of DBR then, judge whether it is the gauge outfit " 0xF8 FF FF 0F FF FF FF FF " of FAT, is to represent that then DOS reserve sector numeral segment value is correct among the DBR; So withdraw from, otherwise carry out e32;
Whether e32, judgement backup DBR exist, otherwise carry out e33, are the numbers that then reads reserve sector among the backup DBR; Read squint the backward information of sector of this number of DBR then; Judging whether it is the gauge outfit " 0xF8 FF FF 0F FF FF FF FF " of FAT, is that then to represent to back up among the DBR DOS reserve sector numeral segment value correct, repairs DOS reserve sector digital section among the DBR according to this value; Withdraw from then, otherwise carry out e33;
E33, according to the file storage structure of FAT32 file system; Directly repair DOS reserve sector digital section among the DBR; Specifically comprise: search for backward from DBR; Up to the sector at the gauge outfit that finds FAT " 0xF8 FF FF 0F FF FF FF FF " place, this sector is exactly a DOS reserve sector number to the sector, interval of DBR sector; If when scanning the subregion end, also do not find the FAT gauge outfit, then finish to repair the flow process of DBR.
Step2, after the reparation of accomplishing DOS reserve sector digital section, every FAT sector number field is repaired, following to every FAT sector number field repair process:
E41, read every FAT sector number field value among the DBR and repair after reserve sector numeral segment value; And then read squint the backward sector auxiliary information of " after every FAT sector number field value+reparation DOS reserve sector numeral segment value " of DBR; Judge whether it is gauge outfit or the root directory of FAT; Be to represent that then every FAT sector number field value is correct among the DBR, thus withdraw from, otherwise execution in step e42;
Whether e42, judgement backup DBR exist; Otherwise execution in step e43; Be the DOS reserve sector numeral segment value after then reading every FAT sector number field value among the backup DBR and repairing, and then read squint the backward sector auxiliary information of " the digital segment value of the reserve sector among the backup DBR after every FAT sector number field value+reparations " of DBR, judge whether it is gauge outfit or the root directory of FAT; Be that then to represent to back up among the DBR every FAT sector number field value correct; Repair every FAT sector number field among the DBR according to this value, withdraw from then, otherwise execution in step e43;
E43, according to the file storage structure of FAT32 file system; Directly repair every FAT sector number field among the DBR; Specifically comprise: begin search from squint the backward sector of the DOS reserve sector numeral segment value after repairing of DBR; Till the sector of finding FAT gauge outfit or root directory place, this sector is exactly every FAT sector number to the sector, interval of sector, FAT gauge outfit place; If when scanning the subregion end, also do not find FAT gauge outfit or root directory, then finish to repair the flow process of DBR.
Step3, after the reparation of accomplishing every FAT sector number field, FAT digital section repaired, following to the repair process of FAT digital section:
E51, read FA T number field value among the DBR, the DOS reserve sector numeral segment value after repairing and repair after FAT sector number field value; Read squint the backward sector auxiliary information of " the FAT sector number field value * FAT number field value after DOS reserve sector after reparation numeral segment value+reparation " of DBR then; Judge whether it is sector, root directory place; Be to represent that then FAT number field value is correct among the DBR, thus withdraw from, otherwise carry out e52;
Whether e52, judgement backup DBR exist, otherwise carry out e53, are the FAT number field values that then reads among the backup DBR; Read squint the backward sector auxiliary information of " the FAT sector number field value * after DOS reserve sector after reparation numeral segment value+reparations backs up the FAT number field value among the DBR " of DBR then; Judging whether it is sector, root directory place, is that the FAT number field value then representing to back up among the DBR is correct, repairs FAT digital section among the DBR according to this value; Withdraw from then, otherwise carry out e53;
E53, according to the file storage structure of FAT32 file system; Directly repair FAT digital section among the DBR; Specifically comprise: read squint the backward sector auxiliary information of " the FAT sector number field value * 1 after DOS reserve sector after reparation numeral segment value+reparation " of DBR; Judge whether it is sector, root directory place, be then in DBR FAT digital section insert " 0x01 ", otherwise FAT digital section inserted " 0x02 " in DBR.
Step4, after the reparation of accomplishing FAT digital section, every bunch of sector number field is repaired, following to the repair process of every bunch of sector number field:
E61, obtain every bunch of sector number field value among the DBR, and judge the number of FAT table, if the number of FAT table is 1, then whether correct according to every bunch of sector number among following expression formula (1), (2) and (3) judgement DBR:
(sector number of FAT * 512 ÷ 4-2) * every bunch of sector number >=sector sum-hiding sector number-(1), the sector number of DOS reserve sector number-FAT
Sector number+4 * every bunch sector number of 512 ÷ (2) of (sector number of FAT * 512 ÷ 4-2) * every bunch of sector number >=sector sum-hiding sector number-DOS reserve sector number-FAT,
Bunch sector number whether belong to 1,2,4,8,16,32,64,128} (3),
When above-mentioned expression formula (1), (2) and (3) when satisfying simultaneously, every bunch of sector number is correct among the expression DBR;
If the number of FAT table is 2, then judge according to following expression formula (4), (5) and (6) whether every bunch of sector number is correct:
Sector number * 2 (4) of (sector number of FAT * 512 ÷ 4-2) * every bunch of sector number >=sector sum-hiding sector number-DOS reserve sector number-FAT,
Sector number * 4 * every bunch sector number of 2+512 ÷ (5) of (sector number of FAT * 512 ÷ 4-2) * every bunch of sector number >=sector sum-hiding sector number-DOS reserve sector number-FAT,
Bunch sector number whether ∈ 1,2,4,8,16,32,64,128} (6),
When above-mentioned expression formula (4), (5) and (6) when satisfying simultaneously, every bunch of sector number is correct among the expression DBR;
If above-mentioned judged result is that every bunch of sector number is correct among the DBR, then withdraw from, otherwise execution in step e62;
Wherein, In above-mentioned expression formula (1), (2), (4) and (5); The left side representes that FAT shows the sector number that multipotency is represented; The lower limit and the upper limit of the sector number of its ability mark represented on the right of expression formula (1) and (2) respectively, and be same, and the lower limit and the upper limit of the sector number of its ability mark represented on the right of expression formula (4) and (5) respectively;
Whether e62, judgement backup DBR exist; Otherwise execution in step e63 is then to obtain every bunch of sector number field value among the backup DBR, judges according to the expression formula among the e61 (1), (2), (3), (4), (5) and (6) whether every bunch of sector number field value is correct among the backup DBR; If it is correct; Then repair every bunch of sector number field among the DBR, withdraw from then according to this value, otherwise execution in step e63;
E63, according to the file storage structure of FAT32 file system; Directly repair every bunch of sector number field among the DBR, specifically comprise: calculate FAT and show the number of clusters order that shared sector can be represented, then according to the total relation of number of clusters order and subregion sector; Calculate every bunch of sector number; Wherein, if the number of clusters order is 1, then calculate every bunch of sector number according to following formula (7):
(sector sum-DOS reserve sector number-FAT sector number) ÷ [FAT sector number * (512 ÷ 4)-2] (7), if the number of clusters order is 2, then calculate every bunch of sector number according to following formula (8):
(sector sum-DOS reserve sector number-FAT sector number * 2) ÷ [FAT sector number * (512 ÷ 4)-2] (8),
{ 1,2,4,8,16,32,64, the integer of 128} can be accomplished reparation to last every bunch of sector number value in order to be not less than 2n (n is an integer) and ∈.
To sum up; The present invention is according to the difference of repair mode; Reasonably the field information of the BPB among the DBR is classified, and dissimilar fields is adopted different restorative procedures, reduced effectively and repaired the time overhead of DBR parameter and improved reparation DBR veracity of parameters.
Should be understood that, concerning those of ordinary skills, can improve or conversion, and all these improvement and conversion all should belong to the protection domain of accompanying claims of the present invention according to above-mentioned explanation.

Claims (10)

1. the DBR data recovery method of a FAT32 file system is characterized in that, comprising:
Open disk, locate the sector, DBR place of current FAT32 subregion in the said disk, and inquiry backup DBR;
Read the information of field to be repaired among the DBR,, other the DBR information of FAT32 subregion is copied into repairing for non-BPB field information; Judge earlier that for the BPB field information which kind of in three types of fields said field information to be repaired be; Repair respectively to the inhomogeneity field again; Wherein, said three types of fields comprise: with the field of file storage structure-irrelevant, but the field and the field with file storage structure relevant and that needs verify that need not verify relevant with the file storage structure;
When said field to be repaired is the field with the file storage structure-irrelevant, utilize default value to repair said field to be repaired;
In said field to be repaired during for but the field that need not verify relevant, according to the said field to be repaired of file storage structure repair with the file storage structure;
When said field to be repaired is relevant with the file storage structure and needs the field of checking; Whether the field information according to file storage structure verification DBR is correct, correctly then withdraws from, the incorrect backup DBR that then judged whether; If the value that does not have then directly repair DBR according to the file storage structure; If have then whether correct, be the value of then repairing the DBR field, otherwise directly repair the value of DBR according to the file storage structure according to the field information of file storage structure verification backup DBR.
2. DBR data recovery method according to claim 1; It is characterized in that the said and field file storage structure-irrelevant comprises: every sector byte number field, Media Description symbol field, every magnetic track sector number field, magnetic head digital section, tag field, version field, filesystem information sector number field, reserved field, BIOS drive letter field, expansion leader label field, volume serial number field, label field, file system type field;
The said process of utilizing default value to repair said field to be repaired is specially: in the field of said and file storage structure-irrelevant, insert default value.
3. DBR data recovery method according to claim 1 is characterized in that, said but field that need not verify relevant with the file storage structure comprises: first bunch of number field of the sector number field of subregion and root directory;
When said but field that need not verify relevant with the file storage structure is the sector number field of subregion; Said process according to the said field to be repaired of file storage structure repair comprises: according to the sector sum that the EBR or the partition information among the MBR of said subregion gets access to this subregion, the sector sum of the said subregion that is obtained is filled into the sector number field of said subregion;
When said but field that need not verify relevant with the file storage structure was first bunch number field of root directory, said process according to the said field to be repaired of file storage structure repair comprised: insert " 0x 02 00 00 00 " in first bunch of number field of said root directory.
4. DBR data recovery method according to claim 1; It is characterized in that, said relevant with the file storage structure and need the field of checking to comprise: every bunch of sector number field, DOS reserve sector digital section, a FAT digital section, hiding sector fields, every FAT sector number field and DBR alternate sector field.
5. DBR data recovery method according to claim 4 is characterized in that, said relevant with the file storage structure and when needing the field of checking to be DBR alternate sector field, the data repair process comprises step:
E11, reading DBR alternate sector field value among the DBR, read squint the backward sectors of data of this number of DBR then, judge whether it is DBR, is to represent that then DBR alternate sector field value is correct, thus withdraw from, otherwise execution in step E12;
E12, because DBR alternate sector field information mistake among the DBR can't find the DBR of backup, so do not have the DBR of backup, then direct execution in step E13;
E13, search for backward from DBR, when the sector of finding backup DBR place or search have surpassed this subregion size till, if find sector, backup DBR place, then this sector is exactly DBR alternate sector number to the sector, interval of DBR sector; If do not find the DBR of backup, then insert default value " 0,x06 00 ".
6. DBR data recovery method according to claim 4 is characterized in that, when hiding sector fields, the data repair process comprises step in the said and field that needs checking relevant with the file storage structure:
E21, reading among the DBR and to hide the sector number field value, read squint the forward sectors of data of this number of DBR then, judge whether it is EBR or MBR, is that then to represent to hide the sector number field value among the DBR correct, thus withdraw from, otherwise execution in step E22;
Whether E22, judgement backup DBR exist, otherwise execution in step E23; Be then to read among the backup DBR to hide sector number; Read squint the forward sectors of data of this number of DBR then; Judging whether it is EBR or MBR, is to represent then to back up among the DBR that to hide the sector number field value correct, repairs according to this value and hides the sector number field among the DBR; Withdraw from then, otherwise execution in step E23;
E23, search for forward from DBR, the sector up to EBR that finds this subregion or MBR place, this sector is exactly the number of hiding sector to the interval sector number of DBR sector.
7. DBR data recovery method according to claim 4 is characterized in that, said relevant with the file storage structure and when needing the field of checking to be DOS reserve sector digital section, the data repair process comprises step:
E31, read among the DBR DOS reserve sector numeral segment value; Reading squint the backward information of sector of this number of DBR then, judge whether it is the gauge outfit " 0xF8 FF FF 0F FF FF FF FF " of FAT, is to represent that then DOS reserve sector numeral segment value is correct among the DBR; So withdraw from, otherwise carry out E32;
Whether E32, judgement backup DBR exist, otherwise carry out E33, are the numbers that then reads reserve sector among the backup DBR; Read squint the backward information of sector of this number of DBR then; Judging whether it is the gauge outfit " 0xF8FF FF 0F FF FF FF FF " of FAT, is that then to represent to back up among the DBR DOS reserve sector numeral segment value correct, repairs DOS reserve sector digital section among the DBR according to this value; Withdraw from then, otherwise carry out E33;
E33, search for backward from DBR, up to the sector at the gauge outfit that finds FAT " 0xF8FF FF 0F FF FF FF FF " place, this sector is exactly a DOS reserve sector number to the sector, interval of DBR sector; If when scanning the subregion end, also do not find the FAT gauge outfit, then finish to repair the flow process of DBR.
8. DBR data recovery method according to claim 7 is characterized in that, said DBR data recovery method also comprises:
After the reparation of accomplishing said DOS reserve sector digital section, said every FAT sector number field is repaired, the repair process of said every FAT sector number field is comprised step:
E41, read every FAT sector number field value among the DBR and repair after the reserve sector field value; And then read squint the backward sector auxiliary information of " after every FAT sector number field value+reparation DOS reserve sector numeral segment value " of DBR; Judge whether it is gauge outfit or the root directory of FAT; Be to represent that then every FAT sector number field value is correct among the DBR, thus withdraw from, otherwise execution in step E42;
Whether E42, judgement backup DBR exist; Otherwise execution in step E43; Be the DOS reserve sector field value after then reading every FAT sector number field value among the backup DBR and repairing, and then read squint the backward sector auxiliary information of " the digital segment value of the reserve sector among the backup DBR after every FAT sector number field value+reparations " of DBR, judge whether it is gauge outfit or the root directory of FAT; Be that then to represent to back up among the DBR every FAT sector number field value correct; Repair every FAT sector number field among the DBR according to this value, withdraw from then, otherwise execution in step E43;
E43, begin search from squint the backward sector of the DOS reserve sector numeral segment value after repairing of DBR, till the sector of finding FAT gauge outfit or root directory place, this sector is exactly every FAT sector number to the sector, interval that the FAT gauge outfit belongs to the sector.
9. DBR data recovery method according to claim 8 is characterized in that, said DBR data recovery method also comprises:
After the reparation of accomplishing said every FAT sector number field, a said FAT digital section is repaired, the repair process of a said FAT digital section is comprised step:
E51, read FAT number field value among the DBR, the DOS reserve sector numeral segment value after repairing and repair after FAT sector number field value; Read squint the backward sector auxiliary information of " the FAT sector number field value * FAT number field value after DOS reserve sector after reparation numeral segment value+reparation " of DBR then; Judge whether it is sector, root directory place; Be to represent that then FAT number field value is correct among the DBR, thus withdraw from, otherwise execution in step E52;
Whether E52, judgement backup DBR exist, otherwise execution in step E53 is the FAT number field value that then reads among the backup DBR; Read squint the backward sector auxiliary information of " the FAT sector number field value * FAT number field value after DOS reserve sector after reparation numeral segment value+reparation " of DBR then; Judging whether it is sector, root directory place, is that the FAT number field value then representing to back up among the DBR is correct, repairs FAT digital section among the DBR according to this value; Withdraw from then, otherwise execution in step E53;
E53, read squint the backward sector auxiliary information of " the FAT sector number field value * 1 after DOS reserve sector after reparation numeral segment value+reparation " of DBR; Judge whether it is sector, root directory place; Be then in DBR FAT digital section insert " 0x01 ", otherwise FAT digital section inserted " 0x02 " in DBR.
10. DBR data recovery method according to claim 9 is characterized in that, said DBR data recovery method also comprises:
After the reparation of accomplishing a said FAT digital section, said every bunch of sector number field is repaired, the repair process of said every bunch of sector number field is comprised step:
E61, obtain every bunch of sector number field value among the DBR, judge whether every bunch of sector number is correct, is then to withdraw from, otherwise execution in step E62;
Whether E62, judgement backup DBR exist, otherwise execution in step E63 is then to obtain every bunch of sector number field value among the backup DBR; Judge whether every bunch of sector number is correct among the backup DBR, if correct, the value of then repairing every bunch of sector number according to this value; Withdraw from then, otherwise execution in step E63;
E63, calculating FAT show the number of clusters order that shared sector can be represented, according to the relation of number of clusters order and subregion sector sum, calculate every bunch of sector number then, and every bunch of sector number value of last gained is for being not less than 2n and ∈ { 1; 2,4,8,16; 32,64, the integer of 128}, wherein said n are integer.
CN201210277145.7A 2012-08-06 2012-08-06 A kind of DBR data recovery method of FAT32 file system Active CN102831025B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210277145.7A CN102831025B (en) 2012-08-06 2012-08-06 A kind of DBR data recovery method of FAT32 file system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210277145.7A CN102831025B (en) 2012-08-06 2012-08-06 A kind of DBR data recovery method of FAT32 file system

Publications (2)

Publication Number Publication Date
CN102831025A true CN102831025A (en) 2012-12-19
CN102831025B CN102831025B (en) 2015-09-23

Family

ID=47334174

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210277145.7A Active CN102831025B (en) 2012-08-06 2012-08-06 A kind of DBR data recovery method of FAT32 file system

Country Status (1)

Country Link
CN (1) CN102831025B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103761156A (en) * 2013-12-13 2014-04-30 北京同有飞骥科技股份有限公司 Online repair method aimed at file system
CN106328171A (en) * 2015-07-01 2017-01-11 四川效率源信息安全技术有限责任公司 Data analysis and extraction method based on Hiklife embedded security protection equipment
CN107632774A (en) * 2016-07-13 2018-01-26 深圳市大迈科技有限公司 Repair the method and device of disk carry

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1858714A (en) * 2005-11-07 2006-11-08 珠海金山软件股份有限公司 Method for preventing and resolving data from lossing
CN102314490A (en) * 2011-08-16 2012-01-11 晨星软件研发(深圳)有限公司 Method and device for recovering Linux FAT (File Allocation Table) file system
US20120011177A1 (en) * 2002-10-22 2012-01-12 Microsoft Corporation Transaction-safe fat file system improvements

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120011177A1 (en) * 2002-10-22 2012-01-12 Microsoft Corporation Transaction-safe fat file system improvements
CN1858714A (en) * 2005-11-07 2006-11-08 珠海金山软件股份有限公司 Method for preventing and resolving data from lossing
CN102314490A (en) * 2011-08-16 2012-01-11 晨星软件研发(深圳)有限公司 Method and device for recovering Linux FAT (File Allocation Table) file system

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
崔崧: "基于WINDOWS FAT的数据恢复系统的设计与实现", 《成都教育学院学报》 *
高志鹏等: "基于文件系统数据结构互补的NTFS引导扇区智能修复系统", 《信息网络安全》 *

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103761156A (en) * 2013-12-13 2014-04-30 北京同有飞骥科技股份有限公司 Online repair method aimed at file system
CN103761156B (en) * 2013-12-13 2016-09-21 北京同有飞骥科技股份有限公司 A kind of online restorative procedure for file system
CN106328171A (en) * 2015-07-01 2017-01-11 四川效率源信息安全技术有限责任公司 Data analysis and extraction method based on Hiklife embedded security protection equipment
CN106328171B (en) * 2015-07-01 2020-04-10 四川效率源信息安全技术股份有限公司 Data analysis and extraction method based on Haikang embedded security equipment
CN107632774A (en) * 2016-07-13 2018-01-26 深圳市大迈科技有限公司 Repair the method and device of disk carry
CN107632774B (en) * 2016-07-13 2020-10-20 深圳市大迈科技有限公司 Method and device for repairing disk mount

Also Published As

Publication number Publication date
CN102831025B (en) 2015-09-23

Similar Documents

Publication Publication Date Title
US7613946B2 (en) Apparatus, system, and method for recovering a multivolume data set
EP1744246B1 (en) File system having deferred verification of data integrity
EP1744247B1 (en) Optimized startup verification of file system integrity
EP2637101B1 (en) Electronic device to restore master boot record (MBR), method thereof, and computer-readable medium
KR100550288B1 (en) Method for recovering data in ext2 file system, and computer-readable storage medium recorded with data-recover program
US20150261619A1 (en) Cascade ordering
US7774566B2 (en) Physical tape interchange format
JP2007012058A (en) File system for storing transaction records in flash-like media
US8291149B2 (en) Storage device and storage system having a hard disk drive and flash memory
JP2007012060A (en) File system having inverted hierarchical structure
CN106970856B (en) Data management system and method for backing up, recovering and mounting data
CN108874321A (en) A kind of raid-array data reconstruction method, device and equipment
US7689626B2 (en) System and method for locating log records in multiplexed transactional logs
CN102831025B (en) A kind of DBR data recovery method of FAT32 file system
WO2017143843A1 (en) Metadata recovery method and device
CN106155589A (en) A kind of virtual dynamic partition image file generates method and system
CN102253938B (en) Method and device for writing and restoring file
CN1156763C (en) Method for protecting and restoring data on hard disk
CN110825712B (en) Method for recovering disk cluster data managed by logical volume
US9026500B1 (en) Restoring virtual machine data
US7266657B2 (en) Data protection device and method of securing data
CN110008064A (en) A kind of RAID restoration methods, device, equipment and medium
JP2000353118A (en) Data backup/restoration method
CN100389396C (en) FAT file system error treating method and device
CN112286718B (en) Method for restoring deleted data after enabling TRIM command by solid state disk controlled by PS3111

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
TR01 Transfer of patent right

Effective date of registration: 20170330

Address after: View of the road Xiamen city Fujian province 361000 Software Park No. 14

Patentee after: Xiamen Information Security Research Institute Co., Ltd.

Address before: 361008 Fujian province Xiamen software park two sunrise Road No. 12 102-402 unit

Patentee before: Xiamen Meiya Pico Information Co., Ltd.

TR01 Transfer of patent right