CN102831025B - A kind of DBR data recovery method of FAT32 file system - Google Patents

A kind of DBR data recovery method of FAT32 file system Download PDF

Info

Publication number
CN102831025B
CN102831025B CN201210277145.7A CN201210277145A CN102831025B CN 102831025 B CN102831025 B CN 102831025B CN 201210277145 A CN201210277145 A CN 201210277145A CN 102831025 B CN102831025 B CN 102831025B
Authority
CN
China
Prior art keywords
dbr
sector
field
fat
backup
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
CN201210277145.7A
Other languages
Chinese (zh)
Other versions
CN102831025A (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

Landscapes

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

Abstract

The present invention relates to a kind of DBR data recovery method of FAT32 file system, comprise step: open disk, locate the sector, DBR place of current FAT32 subregion in described disk, and inquiry backup DBR; Reading the information of field to be repaired in DBR, for non-BPB field information, the DBR information of other FAT32 subregion being copied into repairing; For BPB field information, first judge which kind of in three class fields field information to be repaired be, adopt distinct methods to repair for inhomogeneity field again, wherein three class fields comprise: the field had nothing to do with file storage structure, with file storage structure about but without the need to the field verified and with file storage structure about and the field verified of needs.Like this by reasonably being classified by the BPB field information in DBR, and different restorative procedures being adopted to dissimilar field, effectively reducing the time overhead repairing DBR parameter, and improve the accuracy of repairing DBR parameter.

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 development that is 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 the many factors such as virus infections, maloperation, unscheduled event are all threaten the safety of data, and when some significant datas once damage or lose, its loss is sometimes quite serious.But, in actual applications, be difficult to again the phenomenon avoiding occurring corrupted data and loss.Therefore, it is quite necessary for carrying out effective recovery to those significant datas wrecked.
The software recover data and method thereof have a lot, and wherein, divisional reconstruction class software is that one recovers data mode indirectly, namely give the data of loss for change by repairing subregion.The advantage of this repair mode is: resume speed is exceedingly fast, and once divisional reconstruction success, file wherein also just can recover thereupon.But these divisional reconstruction softwares or method all can not meet the demand of the DBR data restore of FAT32 preferably at present, and wherein FAT32 is a kind of file system using Windows widely, and FAT32 file system all supported by a lot of operating platform.
Current, generally have two kinds: one to be adopt " backup repairing method " to the method for the DBR data restore of FAT32, but when backing up DBR and being destroyed, will the reparation result complete failure of these class methods be caused; Two is according to the difference of divisional type and size to each field of DBR assignment again, and adopts default value or statistical value to the assignment of some parameter, and obvious is like this incorrect.
Summary of the invention
The technical problem to be solved in the present invention is, for the above-mentioned defect of prior art, provides a kind of DBR data recovery method of FAT32 file system.
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 described disk, and inquiry backup DBR;
Reading the information of field to be repaired in DBR, for non-BPB field information, the DBR information of other FAT32 subregion being copied into repairing; BPB field information is first judged which kind of in three class fields described field information to be repaired be, repair respectively for inhomogeneity field again, wherein, described three class fields comprise: the field had nothing to do with file storage structure, with file storage structure about but without the need to the field verified and with file storage structure about and the field verified of needs;
When described field to be repaired is with the field that file storage structure is irrelevant, default value is utilized to repair described field to be repaired;
Described field to be repaired be with file storage structure about but without the need to verify field time, according to file storage structure repair described field to be repaired;
Described field to be repaired be with file storage structure about and need the field verified time, whether correct according to the field information of file storage structure checking DBR, correct then exit, incorrect, judge whether backup DBR, if do not had, directly repair the value of DBR according to file storage structure, if had, whether correct according to the field information of file storage structure checking backup DBR, be repair the value of DBR field, otherwise directly repair the value of DBR according to file storage structure.
DBR data recovery method of the present invention, wherein, the described field irrelevant with file storage structure comprises: every sector byte number field, Media Description accord with field, every magnetic track sector number field, magnetic head digital section, tag field, version field, file system information sector field, reserved field, BIOS drive letter field, expand leader label field, volume serial number field, label field, file system type field;
The described process utilizing default value to repair described field to be repaired is specially: in the described field irrelevant with file storage structure, insert default value.
DBR data recovery method of the present invention, wherein, described with file storage structure about but field without the need to verifying comprise: the sector number field of subregion and root directory first bunch of number field;
Described with file storage structure about but field without the need to verifying is the sector number field of subregion time, the described process according to the described field to be repaired of file storage structure reparation comprises: the sector sum getting this subregion according to the partition information in EBR or MBR of described subregion, is filled into the sector number field of described subregion by the sector of obtained described subregion sum;
Described with file storage structure about but field without the need to verifying is root directory first bunch number field time, described process of repairing described field to be repaired according to file storage structure comprises: insert " 0x 02 00 00 00 " in described root directory first bunch of number field.
DBR data recovery method of the present invention, wherein, described with file storage structure about and need the field verified to comprise: every bunch of sector number field, DOS reserve sector digital section, a FAT digital section, hide sector fields, every FAT sector number field and DBR alternate sector field.
DBR data recovery method of the present invention, wherein, described with file storage structure about and when needing the field verified to be DBR alternate sector field, data restore process comprises step:
DBR alternate sector field value in E11, reading DBR, then reads the data that DBR offsets this number destination sector backward, judges whether it is DBR, be, represents that DBR alternate sector field value is correct, therefore exits, otherwise perform step e 12;
E12, due to DBR alternate sector field information mistake in DBR, the DBR of backup cannot be found, therefore without the DBR of backup, then directly perform step e 13;
E13, to search for backward from DBR, until when finding the sector at backup DBR place or search to exceed this partition size, if find backup sector, 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, described with file storage structure about and when needing the field verified for hiding sector fields, data restore process comprises step:
Hide sector number field value in E21, reading DBR, then read the data of this number destination sector of DBR biased forwards, judge whether it is EBR or MBR, be, represent in DBR and hide sector number field value correctly, therefore exit, otherwise perform step e 22;
E22, judge backup DBR whether exist, otherwise perform step e 23; Read in backup DBR and hide sector number, then the data of this number destination sector of DBR biased forwards are read, judge whether it is EBR or MBR, represent that in backup DBR, hiding sector number field value is correct, repair in DBR according to this value and hide sector number field, then exit, otherwise perform step e 23;
E23, from DBR straight line, until find the sector at EBR or the MBR place of this subregion, 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, described with file storage structure about and when needing the field verified to be DOS reserve sector digital section, data restore process comprises step:
DOS reserve sector field value in E31, reading DBR, then read DBR and offset the information of this number destination sector backward, judging whether it is the gauge outfit " 0xF8 FF FF 0F FF FF FF FF " of FAT, is represent that in DBR, DOS reserve sector field value is correct, therefore exit, otherwise perform E32;
E32, judge backup DBR whether exist, otherwise perform E33, read the number of reserve sector in backup DBR, then the information that DBR offsets this number destination sector is backward read, judge whether it is the gauge outfit " 0xF8 FF FF 0F FF FF FF FF " of FAT, be, represent that in backup DBR, DOS reserve sector field value is correct, repairs DOS reserve sector digital section in DBR according to this value, then exit, otherwise perform E33;
E33, search for backward from DBR, until find the sector at gauge outfit " the 0xF8 FF FF 0F FF FF FF FF " place of FAT, this sector is exactly DOS reserve sector number to the sector, interval of DBR sector; If when scanning subregion end, also do not find FAT gauge outfit, then terminate the flow process of repairing DBR.
DBR data recovery method of the present invention, wherein, described DBR data recovery method also comprises:
After completing the reparation to described DOS reserve sector digital section, described every FAT sector number field is repaired, step is comprised to the repair process of described every FAT sector number field:
Every FAT sector number field value and the reserve sector field value after repairing in E41, reading DBR, and then read the sector auxiliary information that DBR offsets " the DOS reserve sector field value after every FAT sector number field value+reparation " backward, judge whether it is gauge outfit or the root directory of FAT, represent that in DBR, every FAT sector number field value is correct, therefore exit, otherwise perform step e 42;
E42, judge backup DBR whether exist, otherwise perform step e 43, read every FAT sector number field value and the DOS reserve sector field value after repairing in backup DBR, and then read the sector auxiliary information that DBR offsets " the reserve sector field value in backup DBR after every FAT sector number field value+reparation " backward, judge whether it is gauge outfit or the root directory of FAT, represent that in backup DBR, every FAT sector number field value is correct, every FAT sector number field in DBR is repaired according to this value, then exit, otherwise perform step e 43;
E43, search from the sector that DBR offsets the DOS reserve sector field value after reparation backward, until find the sector at 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.
DBR data recovery method of the present invention, wherein, described DBR data recovery method also comprises:
After completing the reparation to described every FAT sector number field, a described FAT digital section is repaired, step is comprised to the repair process of a described FAT digital section:
E51, to read in DBR FAT field value, repair after DOS reserve sector field value and FAT sector number field value after reparation, then the sector auxiliary information that DBR offsets " FAT sector number field value * FAT the field value after the DOS reserve sector field value+reparation after reparation " is backward read, judge whether it is sector, root directory place, represent that in DBR, FAT field value is correct, therefore exit, otherwise perform step e 52;
E52, judge backup DBR whether exist, otherwise perform step e 53, read FAT field value in backup DBR, then the sector auxiliary information that DBR offsets " FAT sector number field value * FAT the field value after the DOS reserve sector field value+reparation after reparation " is backward read, judge whether it is sector, root directory place, be, represent that FAT field value in backup DBR is correct, repair FAT digital section in DBR according to this value, then exit, otherwise perform step e 53;
E53, reading DBR offset the sector auxiliary information of " the FAT sector number field value * 1 after the DOS reserve sector field value+reparation after reparation " backward, judge whether it is sector, root directory place, be that FAT digital section is inserted " 0x01 " in DBR, otherwise FAT digital section is inserted " 0x02 " in DBR.
DBR data recovery method of the present invention, wherein, described DBR data recovery method also comprises:
After completing the reparation to a described FAT digital section, described every bunch of sector number field is repaired, step is comprised to the repair process of described every bunch of sector number field:
Every bunch of sector number field value in E61, acquisition DBR, judges that whether every bunch of sector number is correct, is exit, otherwise performs step e 62;
E62, judge backup DBR whether exist, otherwise perform step e 63, be, obtain backup DBR in every bunch of sector number field value, judge that in backup DBR, whether every bunch of sector number is correct, if correctly, then according to the value of this value reparation every bunch of sector number, then exit, otherwise perform step e 63;
E63, calculate the number of clusters order that the shared sector of FAT table can represent, then according to the relation of number of clusters order and subregion sector sum, calculate every bunch of sector number, every bunch of sector number value of last gained is for being not less than 2n and ∈ { 1,2,4,8,16, the integer of 32,64,128}, wherein said n is integer.
The invention has the beneficial effects as follows: according to the difference of repair mode, reasonably the field information of the BPB in DBR is classified, and different restorative procedures is adopted to dissimilar field, effectively reduce the time overhead repairing DBR parameter and the accuracy that improve reparation DBR parameter.
Accompanying drawing explanation
Below in conjunction with drawings and Examples, the invention will be further described, in accompanying drawing:
Fig. 1 is the DBR data recovery method process flow diagram of the FAT32 file system of present pre-ferred embodiments.
Embodiment
In the following each embodiment of the present invention, MBR be after computer starting from first graftabl and the code performed can be started medium, be commonly used to explain partitioned organization, for hard disk, be generally 0 sector of LBA; EBR, release the concept of extended partition from MICROSOFT after, the DPT structure that primary partition adopts just has been continued to use in extended partition, and in order to be distinguished, people call EBR, EMBR, expansion MBR or virtual MBR the sector at the partition table place of extended partition usually; DBR is first sector can accessed after operating system enters file system, is commonly used to instrument of interpretation system, in UNIX class file system, is equal to SUPERBLOCK.
Particularly, DBR is formed primarily of 5 parts: jump instruction, OEM code name, BPB, boot and end mark.Wherein, jump instruction, OEM code name, boot and the tetrameric information of end mark are all relatively fixed, and only need the DBR information of other FAT32 subregion to copy into completing to its reparation.Therefore in essence, be in fact exactly the reparation to the BPB parameter block in DBR to the reparation of DBR, the field information of BPB is as shown in table 1 below.
The field information table of table 1BPB
In the DBR data recovery method of the FAT32 file system of the following embodiment of the present invention, according to the difference of restorative procedure, the field information of the BPB in above-mentioned table 1 is divided three classes: with the field that file storage structure is irrelevant, with file storage structure about but without the need to the field verified and with file storage structure about and need the field verified, be specifically classified as follows shown in table 2.
The field information sorted table of table 2BPB
In the DBR data recovery method of the FAT32 file system of present pre-ferred embodiments, according to the difference of repair mode, reasonably the field information of the BPB in DBR is carried out above-mentioned classification, and different restorative procedures is adopted to dissimilar field, effectively reduce the time overhead repairing DBR parameter and the accuracy that improve reparation DBR parameter.Specifically comprise the following steps:
A, open disk, MBR or the EBR information of current bay in reading disk, according to divisional type description field information in MBR or EBR partition table, judge whether subregion is FAT32 file system, be find backward from the initial sector of subregion, navigate to the sector, DBR place of subregion, the sector, DBR place of current FAT32 subregion in positioning disk, and inquiry backup DBR, otherwise process ends;
Wherein, the process of inquiry backup DBR is, read DBR alternate sector number in the BPB of DBR, then the data that DBR offsets number destination sector corresponding to this alternate sector number are backward read, judge whether it is backup DBR, be record the sector number at backup DBR place, be convenient to follow-up repair process and read the data message backed up in DBR; Otherwise search for backward from DBR, until when finding the sector at backup DBR place or scanning to exceed the size of described subregion, if search backup DBR in described subregion, then record the sector number at its place; If do not search backup DBR, then record and do not back up DBR.
In b, reading DBR, the information of field to be repaired, for non-BPB field information, copies the DBR information of other FAT32 subregion into completing reparation; BPB field information is first judged which kind of in three class fields field information to be repaired be, then repairs respectively for inhomogeneity field;
Wherein, three class fields comprise: the field had nothing to do with file storage structure, with file storage structure about but without the need to the field verified and with file storage structure about and the field verified of needs;
C, when field to be repaired is the field irrelevant with file storage structure, default value is utilized to repair field to be repaired;
D, field to be repaired be with file storage structure about but without the need to verify field time, repair field to be repaired according to file storage structure;
E, field to be repaired be with file storage structure about and need the field verified time, according to the file storage structure of FAT32 file system, verify that whether the field value of field to be repaired is correct, for field to be repaired incorrect in DBR, check the respective field in backup DBR, according to the field value of the respective field in the file storage structure checking backup DBR of FAT32 file system, and by the field to be repaired of correct field value write DBR; For all incorrect field to be repaired in DBR and backup DBR, the file storage structure according to FAT32 file system carries out assignment to these fields to be repaired again.
Particularly, the step a-e of above-mentioned DBR data recovery method is divided into step S0-S19, and detailed process as shown in Figure 1, comprises step:
S0, beginning;
S1, open disk, in reading disk, MBR or the EBR information of this subregion, then performs S2;
S2, according to divisional type description field information in MBR or EBR partition table, judging whether this subregion is FAT32 file system, otherwise jump to S19, is perform S3;
S3, to find backward from the initial sector of this subregion, navigate to the sector, DBR place of this subregion, then perform S4;
S4, after navigating to the sector of DBR, inquiry backup DBR, the method of wherein searching backup DBR is as follows: read DBR alternate sector number in DBR, then the data that DBR offsets this number destination sector are backward read, judge whether it is DBR, be the sector number at just record backup DBR place, otherwise search for backward from DBR, until when finding the sector at backup DBR place or scanning to exceed the size of this subregion, if search the DBR of backup in this subregion, record the sector at its place; If do not searched, then record backup DBR, then performed S5;
In S5, reading DBR, the information of field to be repaired, then performs S6;
S6, judge whether field to be repaired is BPB field, is jump to S8, otherwise perform S7;
S7, for the non-BPB field in DBR, to comprise: jump instruction, OEM code name, the information of boot and end mark four field, the DBR information of other FAT32 subregion is copied into, and jump to S14;
S8, judge that whether this field information is relevant with file storage structure, be jump to S10, otherwise jump to S9;
S9, utilize default value to repair data to be repaired, and jump to S14;
S10, judge that field to be repaired judges its correctness the need of according to file system storage organization, be jump to S11, otherwise jump to S15;
S11, according to file storage structure, whether verifying field information is correct, is jump to S14, otherwise jumps to S12;
S12, judge backup DBR whether exist, be jump to S13, otherwise jump to S15;
The information of field to be repaired in S13, reading backup DBR, and jump to S16;
S14, judge whether to need the field of repairing, be jump to S5, otherwise jump to S18;
S15, according to file storage structure, repair the information of field in DBR, and jump to S14;
S16, according to file storage structure, in checking backup DBR, whether field information to be repaired is correct, is jump to S17, otherwise jumps to S15;
S17, according to backup DBR information, repair field information to be repaired in DBR, and jump to S14;
S18, by amended DBR information write backup DBR, if do not back up DBR, then by the sector that DBR information write skew is " 0x06 ", then perform S19;
S19, end.
Further, in the step c of above-mentioned DBR data recovery method, as above shown in table 2, comprise with the field that file storage structure is irrelevant: every sector byte number field, Media Description accord with field, every magnetic track sector number field, magnetic head digital section, tag field, version field, file system information sector field, reserved field, BIOS drive letter field, expand leader label field, volume serial number field, label field, file system type field, and comprise multiple unused word section.Wherein, the process utilizing default value to repair field to be repaired is specially, in the field irrelevant with file storage structure, insert default value.
Wherein, the default value inserted to each field is as shown in table 3 below:
The field that table 3 has nothing to do with file storage structure repairs default value
Further, in the steps d of above-mentioned DBR data recovery method, as above shown in table 2, with file storage structure about but field without the need to verifying comprise: the sector number field of subregion and root directory first bunch of number field.With file storage structure about but field without the need to verifying is the sector number field of subregion time, the process of repairing field to be repaired according to file storage structure comprises: the sector sum getting this subregion according to the partition information in EBR or MBR of subregion, is filled into the sector number field of subregion by the sector of obtained subregion sum; With file storage structure about but field without the need to verifying is root directory first bunch number field time, the restorative procedure adopted is, because in FAT32 file system, all distribute to root directory the first bunch of data field to use, namely be exactly No. 2 bunches, therefore insert " 0x 02 00 00 00 " in root directory first bunch of number field and can repair.
Further, in above-mentioned DBR data recovery method, as above shown in table 2, with file storage structure about and need the field verified to comprise: every bunch of sector number field, DOS reserve sector digital section, a FAT digital section, hide sector fields, every FAT sector number field and DBR alternate sector field.To with file storage structure about and need the reparation of the field verified to comprise three steps: 1, verify that the field information of DBR is whether correct according to the file storage structure of FAT32 file system, correctly then exit, incorrect, carry out the 2nd step; 2, judge whether backup DBR, if not, carry out the 3rd step, if had, whether correct according to the field information of the file storage structure checking backup DBR of FAT32 file system, be repair the value of DBR field, otherwise enter the 3rd step; 3, according to the file storage structure of FAT32 file system, the value of DBR is directly repaired.Particularly, have more detailed restorative procedure for different field, details are as follows.
Reparation with file storage structure about and when needing the field verified, concrete data recovery method is as follows:
1, the repair process of DBR alternate sector field is as follows:
DBR alternate sector field value in e11, reading DBR, then reads the data that DBR offsets this number destination sector backward, judges whether it is DBR, be, represents that DBR alternate sector field value is correct, therefore exits, otherwise perform step e12;
E12, due to DBR alternate sector field information mistake in DBR, the DBR of backup cannot be found, therefore without the DBR of backup, then directly perform step e13;
E13, file storage structure according to FAT32 file system, directly repair DBR alternate sector field in DBR, specifically comprise: search for backward from DBR, until when finding the sector at backup DBR place or search to exceed this partition size, if find backup sector, 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 hiding sector number field is as follows:
Hide sector number field value in e21, reading DBR, then read the data of this number destination sector of DBR biased forwards, judge whether it is EBR or MBR, be, represent in DBR and hide sector number field value correctly, therefore exit, otherwise perform step e22;
E22, judge backup DBR whether exist, otherwise perform step e23, read in backup DBR and hide sector number, then the data of this number destination sector of DBR biased forwards are read, judge whether it is EBR or MBR, be, represent in backup DBR and hide sector number field value correctly, repair in DBR according to this value and hide sector number field, then exit, otherwise perform step e23;
E23, file storage structure according to FAT32 file system, directly repair in DBR and hide sector number field, specifically comprise: from DBR straight line, until find the sector at EBR or the MBR place of this subregion, this sector is exactly the number of hiding sector to the interval sector number of DBR sector.
With file storage structure about and need in the field verified, the repair process of all the other four fields has successively property, its concrete following step1-step4 of reparation step:
Step1, DOS reserve sector digital section repair process is as follows:
DOS reserve sector field value in e31, reading DBR, then read DBR and offset the information of this number destination sector backward, judging whether it is the gauge outfit " 0xF8 FF FF 0F FF FF FF FF " of FAT, is represent that in DBR, DOS reserve sector field value is correct, therefore exit, otherwise perform e32;
E32, judge backup DBR whether exist, otherwise perform e33, read the number of reserve sector in backup DBR, then the information that DBR offsets this number destination sector is backward read, judge whether it is the gauge outfit " 0xF8 FF FF 0F FF FF FF FF " of FAT, be, represent that in backup DBR, DOS reserve sector field value is correct, repairs DOS reserve sector digital section in DBR according to this value, then exit, otherwise perform e33;
E33, file storage structure according to FAT32 file system, directly repair DOS reserve sector digital section in DBR, specifically comprise: search for backward from DBR, until find the sector at gauge outfit " the 0xF8 FF FF 0FFF FF FF FF " place of FAT, this sector is exactly DOS reserve sector number to the sector, interval of DBR sector; If when scanning subregion end, also do not find FAT gauge outfit, then terminate the flow process of repairing DBR.
Step2, after completing the reparation to DOS reserve sector digital section, every FAT sector number field to be repaired, as follows to every FAT sector number field repair process:
Every FAT sector number field value and the reserve sector field value after repairing in e41, reading DBR, and then read the sector auxiliary information that DBR offsets " the DOS reserve sector field value after every FAT sector number field value+reparation " backward, judge whether it is gauge outfit or the root directory of FAT, represent that in DBR, every FAT sector number field value is correct, therefore exit, otherwise perform step e42;
E42, judge backup DBR whether exist, otherwise perform step e43, read every FAT sector number field value and the DOS reserve sector field value after repairing in backup DBR, and then read the sector auxiliary information that DBR offsets " the reserve sector field value in backup DBR after every FAT sector number field value+reparation " backward, judge whether it is gauge outfit or the root directory of FAT, represent that in backup DBR, every FAT sector number field value is correct, every FAT sector number field in DBR is repaired according to this value, then exit, otherwise perform step e43;
E43, file storage structure according to FAT32 file system, directly repair every FAT sector number field in DBR, specifically comprise: search for from the sector that DBR offsets the DOS reserve sector field value after reparation backward, until find the sector at 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 subregion end, also do not find FAT gauge outfit or root directory, then terminate the flow process of repairing DBR.
Step3, after completing the reparation to every FAT sector number field, FAT digital section to be repaired, as follows to the repair process of FAT digital section:
DOS reserve sector field value in e51, reading DBR after a FA T field value, reparation and the FAT sector number field value after repairing, then the sector auxiliary information that DBR offsets " FAT sector number field value * FAT the field value after the DOS reserve sector field value+reparation after reparation " is backward read, judge whether it is sector, root directory place, represent that in DBR, FAT field value is correct, therefore exit, otherwise perform e52;
E52, judge backup DBR whether exist, otherwise perform e53, read FAT field value in backup DBR, then the sector auxiliary information that DBR offsets " the FAT sector number field value * after the DOS reserve sector field value+reparation after reparation backs up FAT field value in DBR " is backward read, judge whether it is sector, root directory place, be, represent that FAT field value in backup DBR is correct, repair FAT digital section in DBR according to this value, then exit, otherwise perform e53;
E53, file storage structure according to FAT32 file system, directly repair FAT digital section in DBR, specifically comprise: read the sector auxiliary information that DBR offsets " the FAT sector number field value * 1 after the DOS reserve sector field value+reparation after reparation " backward, judge whether it is sector, root directory place, be that FAT digital section is inserted " 0x01 " in DBR, otherwise FAT digital section is inserted " 0x02 " in DBR.
Step4, after completing the reparation to FAT digital section, every bunch of sector number field to be repaired, as follows to the repair process of every bunch of sector number field:
Every bunch of sector number field value in e61, acquisition DBR, and judge the number that FAT shows, if the number of FAT table is 1, then judge that in DBR, whether every bunch of sector number is correct according to following expression (1), (2) and (3):
(sector number × 512 ÷ 4-2 of FAT) × every bunch of sector number >=sector sum-hiding sector number-(1), the sector number of DOS reserve sector number-FAT
Sector number+512 ÷ 4 × every bunch sector number (2) of (sector number × 512 ÷ 4-2 of FAT) × 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) meet simultaneously, represent that in DBR, every bunch of sector number is correct;
If the number of FAT table is 2, then judge that whether every bunch of sector number is correct according to following expression (4), (5) and (6):
Sector number × 2 (4) of (sector number × 512 ÷ 4-2 of FAT) × every bunch of sector number >=sector sum-hiding sector number-DOS reserve sector number-FAT,
Sector number × 2+512 ÷ 4 × every bunch sector number (5) of (sector number × 512 ÷ 4-2 of FAT) × 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) meet simultaneously, represent that in DBR, every bunch of sector number is correct;
If above-mentioned judged result is that in DBR, every bunch of sector number is correct, then exits, otherwise perform step e62;
Wherein, in above-mentioned expression formula (1), (2), (4) and (5), the left side represents the sector number that FAT shows most multipotency and represents, the right of expression formula (1) and (2) represents lower limit and the upper limit of its sector number that can mark respectively, equally, the right of expression formula (4) and (5) represents lower limit and the upper limit of its sector number that can mark respectively;
E62, judge backup DBR whether exist, otherwise perform step e63, obtain every bunch of sector number field value in backup DBR, judge that in backup DBR, whether every bunch of sector number field value is correct according to the expression formula (1) in e61, (2), (3), (4), (5) and (6), if correct, then repair every bunch of sector number field in DBR according to this value, then exit, otherwise perform step e63;
E63, file storage structure according to FAT32 file system, directly repair every bunch of sector number field in DBR, specifically comprise: calculate the number of clusters order that the shared sector of FAT table can represent, then according to the relation of number of clusters order and subregion sector sum, calculate every bunch of sector number, wherein, if number of clusters order is 1, then every bunch of sector number is calculated according to following formula (7):
(sector sum-DOS reserve sector number-FAT sector number) ÷ [FAT sector number × (512 ÷ 4)-2] (7), if number of clusters order is 2, then calculates every bunch of sector number according to following formula (8):
(sum-DOS reserve sector number-FAT sector number × 2, sector) ÷ [FAT sector number × (512 ÷ 4)-2] (8),
Finally every bunch of sector number value for be not less than 2n (n is integer) and ∈ { integer of 1,2,4,8,16,32,64,128} can complete reparation.
To sum up, the present invention is according to the difference of repair mode, reasonably the field information of the BPB in DBR is classified, and different restorative procedures is adopted to dissimilar field, effectively reduce the time overhead repairing DBR parameter and the accuracy that improve reparation DBR parameter.
Should be understood that, for those of ordinary skills, can be improved according to the above description or convert, and all these improve and convert the protection domain that all should belong to claims of the present invention.

Claims (10)

1. a DBR data recovery method for FAT32 file system, is characterized in that, comprising:
Open disk, locate the sector, DBR place of current FAT32 subregion in described disk, and inquiry backup DBR;
Reading the information of field to be repaired in DBR, for non-BPB field information, the DBR information of other FAT32 subregion being copied into repairing; BPB field information is first judged which kind of in three class fields described field information to be repaired be, repair respectively for inhomogeneity field again, wherein, described three class fields comprise: the field had nothing to do with file storage structure, with file storage structure about but without the need to the field verified and with file storage structure about and the field verified of needs;
When described field to be repaired is with the field that file storage structure is irrelevant, default value is utilized to repair described field to be repaired;
Described field to be repaired be with file storage structure about but without the need to verify field time, according to file storage structure repair described field to be repaired;
Described field to be repaired be with file storage structure about and need the field verified time, whether correct according to the field information of file storage structure checking DBR, correct then exit, incorrect, judge whether backup DBR, if do not had, directly repair the value of DBR according to file storage structure, if had, whether correct according to the field information of file storage structure checking backup DBR, be then repair field information to be repaired in DBR according to backup DBR information, otherwise directly repair the information of field in DBR according to file storage structure.
2. DBR data recovery method according to claim 1, it is characterized in that, the described field irrelevant with file storage structure comprises: every sector byte number field, Media Description accord with field, every magnetic track sector number field, magnetic head digital section, tag field, version field, file system information sector field, reserved field, BIOS drive letter field, expand leader label field, volume serial number field, label field, file system type field;
The described process utilizing default value to repair described field to be repaired is specially: in the described field irrelevant with file storage structure, insert default value.
3. DBR data recovery method according to claim 1, is characterized in that, described with file storage structure about but field without the need to verifying comprise: the sector number field of subregion and root directory first bunch of number field;
Described with file storage structure about but field without the need to verifying is the sector number field of subregion time, the described process according to the described field to be repaired of file storage structure reparation comprises: the sector sum getting this subregion according to the partition information in EBR or MBR of described subregion, is filled into the sector number field of described subregion by the sector of obtained described subregion sum;
Described with file storage structure about but field without the need to verifying is root directory first bunch number field time, described process of repairing described field to be repaired according to file storage structure comprises: insert " 0x 02 00 00 00 " in described root directory first bunch of number field.
4. DBR data recovery method according to claim 1, it is characterized in that, described with file storage structure about and need the field verified to comprise: every bunch of sector number field, DOS reserve sector digital section, a FAT digital section, hide 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, described with file storage structure about and when needing the field verified to be DBR alternate sector field, data restore process comprises step:
DBR alternate sector field value in E11, reading DBR, then read the data that DBR offsets the sector of DBR alternate sector field value corresponding number in DBR backward, judge whether it is DBR, be, represent that DBR alternate sector field value is correct, therefore exit, otherwise perform step e 12;
E12, due to DBR alternate sector field information mistake in DBR, the DBR of backup cannot be found, therefore without the DBR of backup, then directly perform step e 13;
E13, to search for backward from DBR, until when finding the sector at backup DBR place or search to exceed this partition size, if find backup sector, 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, described with file storage structure about and when needing the field verified for hiding sector fields, data restore process comprises step:
Sector number field value is hidden in E21, reading DBR, then read the data hiding the sector of sector number field value corresponding number in DBR biased forwards DBR, judge whether it is EBR or MBR, be, represent that in DBR, hiding sector number field value is correct, therefore exit, otherwise perform step e 22;
E22, judge backup DBR whether exist, otherwise perform step e 23; Read in backup DBR and hide sector number, then the data hiding the sector of sector number corresponding number in DBR biased forwards backup DBR are read, judge whether it is EBR or MBR, represent that in backup DBR, hiding sector number field value is correct, hiding sector number field in DBR is repaired according to hiding sector number field value in backup DBR, then exit, otherwise perform step e 23;
E23, from DBR straight line, until find the sector at EBR or the MBR place of this subregion, the sector at EBR or the MBR place of this subregion 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, described with file storage structure about and when needing the field verified to be DOS reserve sector digital section, data restore process comprises step:
DOS reserve sector field value in E31, reading DBR, then the information that DBR offsets the sector of DOS reserve sector field value corresponding number in DBR is backward read, judge whether it is the gauge outfit " 0xF8FF FF 0F FF FF FF FF " of FAT, represent that in DBR, DOS reserve sector field value is correct, therefore exit, otherwise perform E32;
E32, judge backup DBR whether exist, otherwise perform E33, read the number of reserve sector in backup DBR, then the information that DBR offsets this number destination sector is backward read, judge whether it is the gauge outfit " 0xF8 FF FF 0F FF FF FF FF " of FAT, be, represent that in backup DBR, DOS reserve sector field value is correct, repair DOS reserve sector digital section in DBR according to DOS reserve sector field value in backup DBR, then exit, otherwise perform E33;
E33, search for backward from DBR, until find the sector at gauge outfit " the 0xF8 FF FF 0F FF FF FF FF " place of FAT, this sector is exactly DOS reserve sector number to the sector, interval of DBR sector; If when scanning subregion end, also do not find FAT gauge outfit, then terminate the flow process of repairing DBR.
8. DBR data recovery method according to claim 7, is characterized in that, described DBR data recovery method also comprises:
After completing the reparation to described DOS reserve sector digital section, described every FAT sector number field is repaired, step is comprised to the repair process of described every FAT sector number field:
Every FAT sector number field value and the reserve sector field value after repairing in E41, reading DBR, and then read the sector auxiliary information that DBR offsets " the DOS reserve sector field value after every FAT sector number field value+reparation " backward, judge whether it is gauge outfit or the root directory of FAT, represent that in DBR, every FAT sector number field value is correct, therefore exit, otherwise perform step e 42;
E42, judge backup DBR whether exist, otherwise perform step e 43, read every FAT sector number field value and the DOS reserve sector field value after repairing in backup DBR, and then read the sector auxiliary information that DBR offsets " the reserve sector field value in backup DBR after every FAT sector number field value+reparation " backward, judge whether it is gauge outfit or the root directory of FAT, represent that in backup DBR, every FAT sector number field value is correct, every FAT sector number field in DBR is repaired according to FAT sector number field value every in backup DBR, then exit, otherwise perform step e 43;
E43, search from the sector that DBR offsets the DOS reserve sector field value after reparation backward, until find the sector at 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.
9. DBR data recovery method according to claim 8, is characterized in that, described DBR data recovery method also comprises:
After completing the reparation to described every FAT sector number field, a described FAT digital section is repaired, step is comprised to the repair process of a described FAT digital section:
E51, to read in DBR FAT field value, repair after DOS reserve sector field value and FAT sector number field value after reparation, then the sector auxiliary information that DBR offsets " FAT sector number field value * FAT the field value after the DOS reserve sector field value+reparation after reparation " is backward read, judge whether it is sector, root directory place, represent that in DBR, FAT field value is correct, therefore exit, otherwise perform step e 52;
E52, judge backup DBR whether exist, otherwise perform step e 53, read FAT field value in backup DBR, then the sector auxiliary information that DBR offsets " the FAT sector number field value * after the DOS reserve sector field value+reparation after reparation backs up FAT field value in DBR " is backward read, judge whether it is sector, root directory place, represent that FAT field value in backup DBR is correct, FAT digital section in DBR is repaired according to FAT field value in backup DBR, then exit, otherwise perform step e 53;
E53, reading DBR offset the sector auxiliary information of " the FAT sector number field value * 1 after the DOS reserve sector field value+reparation after reparation " backward, judge whether it is sector, root directory place, be that FAT digital section is inserted " 0x01 " in DBR, otherwise FAT digital section is inserted " 0x02 " in DBR.
10. DBR data recovery method according to claim 9, is characterized in that, described DBR data recovery method also comprises:
After completing the reparation to a described FAT digital section, described every bunch of sector number field is repaired, step is comprised to the repair process of described every bunch of sector number field:
Every bunch of sector number field value in E61, acquisition DBR, judges that whether every bunch of sector number is correct, is exit, otherwise performs step e 62;
E62, judge backup DBR whether exist, otherwise perform step e 63, obtain every bunch of sector number field value in backup DBR, judge that in backup DBR, whether every bunch of sector number is correct, if correct, then according to the value of every bunch of sector number reparation every bunch of sector number in backup DBR, then exit, otherwise perform step e 63;
E63, calculate the number of clusters order that the shared sector of FAT table can represent, then according to the relation of number of clusters order and subregion sector sum, calculate every bunch of sector number, every bunch of sector number value of last gained is for being not less than 2 nand ∈ { integer of 1,2,4,8,16,32,64,128}, wherein said n is 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 CN102831025A (en) 2012-12-19
CN102831025B true 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)

Families Citing this family (3)

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

Citations (2)

* 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

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7363540B2 (en) * 2002-10-22 2008-04-22 Microsoft Corporation Transaction-safe FAT file system improvements

Patent Citations (2)

* 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

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
基于WINDOWS FAT的数据恢复系统的设计与实现;崔崧;《成都教育学院学报》;20060420(第04期);74-77 *
基于文件系统数据结构互补的NTFS引导扇区智能修复系统;高志鹏等;《信息网络安全》;20110910(第09期);197-200 *

Also Published As

Publication number Publication date
CN102831025A (en) 2012-12-19

Similar Documents

Publication Publication Date Title
EP1744246B1 (en) File system having deferred verification of data integrity
EP1744247B1 (en) Optimized startup verification of file system integrity
US8959125B2 (en) File system having inverted hierarchical structure
US7613946B2 (en) Apparatus, system, and method for recovering a multivolume data set
JP2007012058A (en) File system for storing transaction records in flash-like media
CN106557266B (en) Method and apparatus for redundant array of independent disks RAID
US7774566B2 (en) Physical tape interchange format
TW201131351A (en) System and method for optimizing redundancy restoration in distributed data layout environments
CN112463724B (en) Data processing method and system for lightweight file system
US20090089628A1 (en) File system error detection and recovery framework
CN108874321A (en) A kind of raid-array data reconstruction method, device and equipment
CN102831025B (en) A kind of DBR data recovery method of FAT32 file system
KR20050053094A (en) Method for recovering data in ext2 file system, and computer-readable storage medium recorded with data-recover program
CN109710455A (en) Deletion file access pattern method and system based on FAT32 file system
US9858287B2 (en) Storage system
US7689626B2 (en) System and method for locating log records in multiplexed transactional logs
CN104318960B (en) The restorative procedure and device of a kind of bad track of hard disk
CN1156763C (en) Method for protecting and restoring data on hard disk
TWI461904B (en) Recovery method and device for linux using fat file system
CN104991926A (en) File system recovery method and system
JP2002318732A (en) Device and method for processing file in case of recovery
US20030200391A1 (en) Method for managing critial data in an N-way mirrored storage device
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

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
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.