CN102117316B - FAT (file allocation table) file system formatting method and device - Google Patents

FAT (file allocation table) file system formatting method and device Download PDF

Info

Publication number
CN102117316B
CN102117316B CN 201010620012 CN201010620012A CN102117316B CN 102117316 B CN102117316 B CN 102117316B CN 201010620012 CN201010620012 CN 201010620012 CN 201010620012 A CN201010620012 A CN 201010620012A CN 102117316 B CN102117316 B CN 102117316B
Authority
CN
China
Prior art keywords
auxiliary information
district
sector auxiliary
sector
fat
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.)
Expired - Fee Related
Application number
CN 201010620012
Other languages
Chinese (zh)
Other versions
CN102117316A (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.)
Huawei Digital Technologies Chengdu Co Ltd
Huawei Digital Technologies Co Ltd
Original Assignee
Huawei Digital Technologies Chengdu 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 Huawei Digital Technologies Chengdu Co Ltd filed Critical Huawei Digital Technologies Chengdu Co Ltd
Priority to CN 201010620012 priority Critical patent/CN102117316B/en
Publication of CN102117316A publication Critical patent/CN102117316A/en
Application granted granted Critical
Publication of CN102117316B publication Critical patent/CN102117316B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

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

Abstract

The embodiment of the invention provides an FAT file system formatting method and device. The method comprises: acquiring a formatting instruction for formatting an FAT file system to an FAT format; acquiring first sector information corresponding to an MBR (main boot record) region, second sector information corresponding to a DBR (dos boot record) region, third sector information corresponding to an FAT region, fourth sector information corresponding an FDT (file directory table) region, and fifth sector information corresponding to a DATA region according to the corresponding relationship between the regions of the storage medium and the sector information; and formatting the sectors marked by the first sector information and the second sector information, and not formatting the sectors marked by the third sector information, the fourth sector information and the fifth sector information.

Description

FAT file system format method and device
Technical field
The embodiment of the invention relates to the information processing technology, relates in particular to a kind of file allocation table (FileAllocation Table is called for short FAT) file system format method and device.
Background technology
Fig. 1 is the storage organization synoptic diagram of file allocation table (File Allocation Table, be called for short FAT) file system, and is as shown in Figure 1, and data (DATA) district is used to store the data of FAT file system, and this data unit is bunch; FDT (File Directory Table; Abbreviation FDT) district has another name called the ROOT district; Refer in particular to root directory here, be the catalogue of the data of the FAT file system of DATA district storage, comprise the filename, file size, change date, file starting cluster of the data of FAT file system etc. in this catalogue; The FAT district is used to store the chained list of all bunches of FAT file system, the situation of the data occupancy of expression FAT file system bunch; MBR (Main BootRecord is called for short MBR) district and Dos leader record (Dos Boot Record is called for short DBR) district are two important boot sectors, and the initialization that is used for the FAT file system is used with normal.
In the prior art, if break down in M BR district and/or DBR district, then storage medium can't be initialized as the FAT file system once more, then must recover through format.Formative usual method is that MBR district, DBR district, FAT district and FDT district are carried out format manipulation, promptly rewrites MBR district and DBR district, and deletes FAT district and FDT district simultaneously.Because FAT district and FDT district are the index of the data of FAT file system, delete the data of the FAT file system that FAT district and FDT district can cause storing in the storage medium and all lose, thereby reduced reliability of data storage.
Summary of the invention
The embodiment of the invention provides a kind of FAT file system format method and device; Break down FAT district and FDT district are carried out the problem that the data of the FAT file system that format manipulation causes are all lost owing to MBR district and/or DBR district in order to avoiding, improve reliability of data storage.
The embodiment of the invention provides a kind of FAT file system format method, comprising:
Obtain the format instruction that the FAT file system format is turned to the FAT form;
According to the zone of storage medium and the corresponding relation of sector auxiliary information, obtain first sector auxiliary information corresponding with the MBR district, with corresponding second sector auxiliary information in DBR district, with corresponding the 3rd sector auxiliary information in FAT district, with corresponding the 4th sector auxiliary information in FDT district and five sector auxiliary information corresponding with the DATA district;
Format manipulation is carried out in sector to said first sector auxiliary information and said second sector auxiliary information are identified, and format manipulation is not carried out in the sector that said the 3rd sector auxiliary information, said the 4th sector auxiliary information and said the 5th sector auxiliary information are identified;
Said method also comprises:
Set up the zone of said storage medium and the corresponding relation of sector auxiliary information;
The step of the corresponding relation of the said zone of setting up said storage medium and sector auxiliary information specifically comprises:
Algorithm according to the FAT file system is realized, divides the zone of storage medium;
Set up the zone of the storage medium of dividing and the corresponding relation of sector auxiliary information.
The embodiment of the invention also provides a kind of FAT file system format makeup to put, and comprising:
The instruction acquisition module is used to obtain the format instruction that the FAT file system format is turned to the FAT form;
The information acquisition module; Be used for according to the zone of storage medium and the corresponding relation of sector auxiliary information, obtain first sector auxiliary information corresponding with the MBR district, with corresponding second sector auxiliary information in DBR district, with corresponding the 3rd sector auxiliary information in FAT district, with corresponding the 4th sector auxiliary information in FDT district and five sector auxiliary information corresponding with the DATA district;
The instruction execution module; Be used for format manipulation is carried out in the sector that said first sector auxiliary information and said second sector auxiliary information are identified, format manipulation is not carried out in the sector that said the 3rd sector auxiliary information, said the 4th sector auxiliary information and said the 5th sector auxiliary information are identified;
Relation is set up module, is used to set up the zone of said storage medium and the corresponding relation of sector auxiliary information;
Wherein, said relation is set up module and specifically is used for realizing according to the algorithm of FAT file system, divides the zone of storage medium, sets up the zone of the storage medium of dividing and the corresponding relation of sector auxiliary information.
Can know by technique scheme; The embodiment of the invention turns to the FAT file system format after the format instruction of FAT form through obtaining; According to the zone of storage medium and the corresponding relation of sector auxiliary information; Obtain first sector auxiliary information corresponding with M BR district, with corresponding second sector auxiliary information in DBR district, with corresponding the 3rd sector auxiliary information in FAT district, with corresponding the 4th sector auxiliary information in FDT district and five sector auxiliary information corresponding with the DATA district; Thereby make it possible to format manipulation is carried out in the sector that said first sector auxiliary information and said second sector auxiliary information are identified; Format manipulation is not carried out in sector to said the 3rd sector auxiliary information, said the 4th sector auxiliary information and said the 5th sector auxiliary information are identified; Can avoid breaking down FAT district and FDT district being carried out the problem that the data of the FAT file system that format manipulation causes are all lost, thereby improve reliability of data storage owing to MBR district and/or DBR district.
Description of drawings
In order to be illustrated more clearly in the embodiment of the invention or technical scheme of the prior art; To do one to the accompanying drawing of required use in embodiment or the description of the Prior Art below introduces simply; Obviously, the accompanying drawing in describing below is some embodiments of the present invention, for those of ordinary skills; Under the prerequisite of not paying creative work, can also obtain other accompanying drawing according to these accompanying drawings.
Fig. 1 is the storage organization synoptic diagram of FAT file system;
The schematic flow sheet of the FAT file system format method that Fig. 2 provides for the embodiment of the invention one;
The schematic flow sheet of the FAT file system format method that Fig. 3 provides for the embodiment of the invention two;
The structural representation that the FAT file system format makeup that Fig. 4 provides for the embodiment of the invention three is put;
Another structural representation that the FAT file system format makeup that Fig. 5 provides for the embodiment of the invention three is put;
Another structural representation that the FAT file system format makeup that Fig. 6 provides for the embodiment of the invention three is put.
Embodiment
For the purpose, technical scheme and the advantage that make the embodiment of the invention clearer; To combine the accompanying drawing in the embodiment of the invention below; Technical scheme in the embodiment of the invention is carried out clear, intactly description; Obviously, described embodiment is the present invention's part embodiment, rather than whole embodiment.Based on the embodiment among the present invention, those of ordinary skills are not making the every other embodiment that is obtained under the creative work prerequisite, all belong to the scope of the present invention's protection.
The schematic flow sheet of the FAT file system format method that Fig. 2 provides for the embodiment of the invention one, as shown in Figure 2, the FAT file system format method of present embodiment can may further comprise the steps:
Step 201, obtain the format instruction that the FAT file system format is turned to the FAT form;
Step 202, according to the zone of storage medium and the corresponding relation of sector auxiliary information, obtain first sector auxiliary information corresponding with the MBR district, with corresponding second sector auxiliary information in DBR district, with corresponding the 3rd sector auxiliary information in FAT district, with corresponding the 4th sector auxiliary information in FDT district and five sector auxiliary information corresponding with the DATA district;
Particularly; Can realize according to the algorithm of FAT file system, divide the zone of storage medium, promptly be divided into MBR district, DBR district, FAT district, FDT district, DATA district; Then can set up the zone of the storage medium of dividing and the corresponding relation of sector auxiliary information according to the zone of the storage medium of dividing.
Format manipulation is carried out in step 203, the sector that above-mentioned first sector auxiliary information and above-mentioned second sector auxiliary information are identified, and format manipulation is not carried out in the sector that above-mentioned the 3rd sector auxiliary information, above-mentioned the 4th sector auxiliary information and above-mentioned the 5th sector auxiliary information are identified.
In this step; Format manipulation is carried out in first sector auxiliary information corresponding with the MBR district and the sector (being MBR district and DBR district) that identified with the second corresponding sector auxiliary information of DBR district promptly rewrite MBR district and DBR district, to three sector auxiliary information corresponding, do not carry out format manipulation with corresponding the 4th sector auxiliary information in FDT district and the sector (being FAT district, FDT district and DATA district) that identified with the 5th corresponding sector auxiliary information of DATA district and promptly do not delete the information in FAT district, FDT district and the DATA district with the FAT district.
In the present embodiment, because the dividing region of storage medium is relevant with the capacity of storage medium, therefore, each storage medium is when each format, and dividing region is identical, and promptly each shared sector, zone is identical.Because the data of the FAT file system in the DATA district remain unchanged; Therefore; The catalogue of the data of the FAT file system in the FDT district also is changeless, and the corresponding relation in the FAT district bunch number also is to keep changeless, that is to say; Can need not to carry out format manipulation to FAT district and FDT district, also can correctly characterize the relevant information of the data of FAT file system.
In the present embodiment; Through obtaining the FAT file system format is turned to after the format instruction of FAT form; According to the zone of storage medium and the corresponding relation of sector auxiliary information; Obtain first sector auxiliary information corresponding with the MBR district, with corresponding second sector auxiliary information in DBR district, with corresponding the 3rd sector auxiliary information in FAT district, with corresponding the 4th sector auxiliary information in FDT district and five sector auxiliary information corresponding with the DATA district; Thereby make it possible to format manipulation is carried out in the sector that said first sector auxiliary information and said second sector auxiliary information are identified; Format manipulation is not carried out in sector to said the 3rd sector auxiliary information, said the 4th sector auxiliary information and said the 5th sector auxiliary information are identified; Can avoid breaking down FAT district and FDT district being carried out the problem that the data of the FAT file system that format manipulation causes are all lost, thereby improve reliability of data storage owing to MBR district and/or DBR district.
The schematic flow sheet of the FAT file system format method that Fig. 3 provides for the embodiment of the invention two, as shown in Figure 3, compare with a last embodiment, before step 201, the FAT file system format method of present embodiment can further include following steps:
The executing state in step 301, detection MBR district and/or DBR district, above-mentioned executing state comprises normal condition and malfunction;
Step 302, when the executing state in above-mentioned MBR district of detecting and/or DBR district is malfunction, show corresponding fault information, need format above-mentioned FAT file system with indication.
In the present embodiment, when the executing state that detects MBR district and/or DBR district is malfunction (being to break down in MBR district and/or DBR district), then storage medium can't be initialized as the FAT file system once more, then need recover through format.Through the FAT file system format method that adopts the embodiment of the invention to provide; Can avoid breaking down FAT district and FDT district being carried out the problem that the data of the FAT file system that format manipulation causes are all lost, thereby improve reliability of data storage owing to MBR district and/or DBR district.
Need to prove: for aforesaid each method embodiment; For simple description; So it all is expressed as a series of combination of actions, but those skilled in the art should know that the present invention does not receive the restriction of described sequence of movement; Because according to the present invention, some step can adopt other orders or carry out simultaneously.Secondly, those skilled in the art also should know, the embodiment described in the instructions all belongs to preferred embodiment, and related action and module might not be that the present invention is necessary.
In the above-described embodiments, the description of each embodiment is all emphasized particularly on different fields, do not have the part that details among certain embodiment, can be referring to the associated description of other embodiment.
The structural representation that the FAT file system format makeup that Fig. 4 provides for the embodiment of the invention three is put, as shown in Figure 4, the FAT file system format makeup of present embodiment is put and can be comprised instruction acquisition module 41, information acquisition module 42 and instruction execution module 43.Wherein, Instruction acquisition module 41 obtains the format instruction that the FAT file system format is turned to the FAT form; Information acquisition module 42 is according to the zone of storage medium and the corresponding relation of sector auxiliary information; Obtain first sector auxiliary information corresponding with the MBR district, with corresponding second sector auxiliary information in DBR district, with corresponding the 3rd sector auxiliary information in FAT district, with corresponding the 4th sector auxiliary information in FDT district and five sector auxiliary information corresponding with the DATA district; Format manipulation is carried out in the sector that instruction 43 pairs of said first sector auxiliary information of execution module and said second sector auxiliary information are identified, and format manipulation is not carried out in the sector that said the 3rd sector auxiliary information, said the 4th sector auxiliary information and said the 5th sector auxiliary information are identified.
Method all can be put realization by the FAT file system format makeup that the embodiment of the invention provides among the invention described above embodiment one, two.
In the present embodiment; Obtain through the instruction acquisition module FAT file system format is turned to after the format instruction of FAT form; The information acquisition module is according to the zone of storage medium and the corresponding relation of sector auxiliary information; Obtain first sector auxiliary information corresponding with the MBR district, with corresponding second sector auxiliary information in DBR district, with corresponding the 3rd sector auxiliary information in FAT district, with corresponding the 4th sector auxiliary information in FDT district and five sector auxiliary information corresponding with the DATA district; Thereby make the call instruction execution module carry out format manipulation to the sector that said first sector auxiliary information and said second sector auxiliary information are identified; Format manipulation is not carried out in sector to said the 3rd sector auxiliary information, said the 4th sector auxiliary information and said the 5th sector auxiliary information are identified; Can avoid breaking down FAT district and FDT district being carried out the problem that the data of the FAT file system that format manipulation causes are all lost, thereby improve reliability of data storage owing to MBR district and/or DBR district.
As shown in Figure 5; The FAT file system format makeup of present embodiment is put the relation of can further include and is set up module 44; Can be used to set up the zone of said storage medium and the corresponding relation of sector auxiliary information, obtain the corresponding sector auxiliary information in zone (MBR district, DBR district, FAT district, FDT district, DATA district) with storage medium for said information acquisition module.Particularly, relation is set up module 44 and specifically can be realized according to the algorithm of FAT file system, divides the zone of storage medium, sets up the zone of the storage medium of dividing and the corresponding relation of sector auxiliary information.
As shown in Figure 6; The FAT file system format makeup of present embodiment is put and can further include state detection module 45; Can be used to detect the executing state in MBR district and/or DBR district, said executing state comprises normal condition and malfunction, when the executing state in said MBR district of detecting and/or DBR district is malfunction; Show corresponding fault information, need format said FAT file system with indication.
In the present embodiment; When the executing state that detects MBR district and/or DBR district when state detection module is malfunction (being to break down in MBR district and/or DBR district); Then storage medium can't be initialized as the FAT file system once more, then need recover through format.FAT file system format makeup through adopting the embodiment of the invention to provide is put; Can avoid breaking down FAT district and FDT district being carried out the problem that the data of the FAT file system that format manipulation causes are all lost, thereby improve reliability of data storage owing to MBR district and/or DBR district.
One of ordinary skill in the art will appreciate that: all or part of step that realizes said method embodiment can be accomplished through the relevant hardware of programmed instruction; Aforesaid program can be stored in the computer read/write memory medium; This program the step that comprises said method embodiment when carrying out; And aforesaid storage medium comprises: various media that can be program code stored such as ROM, RAM, magnetic disc or CD.
What should explain at last is: above embodiment is only in order to explaining technical scheme of the present invention, but not to its restriction; Although with reference to previous embodiment the present invention has been carried out detailed explanation, those of ordinary skill in the art is to be understood that: it still can be made amendment to the technical scheme that aforementioned each embodiment put down in writing, and perhaps part technical characterictic wherein is equal to replacement; And these are revised or replacement, do not make the spirit and the scope of the essence disengaging various embodiments of the present invention technical scheme of relevant art scheme.

Claims (4)

1. a FAT file system format method is characterized in that, comprising:
Obtain the format instruction that the FAT file system format is turned to the FAT form;
According to the zone of storage medium and the corresponding relation of sector auxiliary information, obtain first sector auxiliary information corresponding with the MBR district, with corresponding second sector auxiliary information in DBR district, with corresponding the 3rd sector auxiliary information in FAT district, with corresponding the 4th sector auxiliary information in FDT district and five sector auxiliary information corresponding with the DATA district;
Format manipulation is carried out in sector to said first sector auxiliary information and said second sector auxiliary information are identified, and format manipulation is not carried out in the sector that said the 3rd sector auxiliary information, said the 4th sector auxiliary information and said the 5th sector auxiliary information are identified;
Said method also comprises:
Set up the zone of said storage medium and the corresponding relation of sector auxiliary information;
The step of the corresponding relation of the said zone of setting up said storage medium and sector auxiliary information specifically comprises:
Algorithm according to the FAT file system is realized, divides the zone of storage medium;
Set up the zone of the storage medium of dividing and the corresponding relation of sector auxiliary information.
2. method according to claim 1 is characterized in that, said obtaining also comprises before the FAT file system format turned to the step of format instruction of FAT form:
Detect the executing state in MBR district and/or DBR district, said executing state comprises normal condition and malfunction;
When the executing state in said MBR district of detecting and/or DBR district is malfunction, show corresponding fault information, need format said FAT file system with indication.
3. a FAT file system format makeup is put, and it is characterized in that, comprising:
The instruction acquisition module is used to obtain the format instruction that the FAT file system format is turned to the FAT form;
The information acquisition module; Be used for according to the zone of storage medium and the corresponding relation of sector auxiliary information, obtain first sector auxiliary information corresponding with the MBR district, with corresponding second sector auxiliary information in DBR district, with corresponding the 3rd sector auxiliary information in FAT district, with corresponding the 4th sector auxiliary information in FDT district and five sector auxiliary information corresponding with the DATA district;
The instruction execution module; Be used for format manipulation is carried out in the sector that said first sector auxiliary information and said second sector auxiliary information are identified, format manipulation is not carried out in the sector that said the 3rd sector auxiliary information, said the 4th sector auxiliary information and said the 5th sector auxiliary information are identified;
Relation is set up module, is used to set up the zone of said storage medium and the corresponding relation of sector auxiliary information;
Wherein, said relation is set up module and specifically is used for realizing according to the algorithm of FAT file system, divides the zone of storage medium, sets up the zone of the storage medium of dividing and the corresponding relation of sector auxiliary information.
4. device according to claim 3; It is characterized in that, also comprise state detection module, be used to detect the executing state in MBR district and/or DBR district; Said executing state comprises normal condition and malfunction; When the executing state in said MBR district of detecting and/or DBR district is malfunction, show corresponding fault information, need format said FAT file system with indication.
CN 201010620012 2010-12-31 2010-12-31 FAT (file allocation table) file system formatting method and device Expired - Fee Related CN102117316B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 201010620012 CN102117316B (en) 2010-12-31 2010-12-31 FAT (file allocation table) file system formatting method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 201010620012 CN102117316B (en) 2010-12-31 2010-12-31 FAT (file allocation table) file system formatting method and device

Publications (2)

Publication Number Publication Date
CN102117316A CN102117316A (en) 2011-07-06
CN102117316B true CN102117316B (en) 2012-11-21

Family

ID=44216087

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 201010620012 Expired - Fee Related CN102117316B (en) 2010-12-31 2010-12-31 FAT (file allocation table) file system formatting method and device

Country Status (1)

Country Link
CN (1) CN102117316B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108008908B (en) * 2016-10-31 2020-08-07 比亚迪股份有限公司 Method and device for controlling data on SD card

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1266224A (en) * 1999-03-04 2000-09-13 英业达股份有限公司 Method for formatted disc
US6233105B1 (en) * 1999-03-29 2001-05-15 Inventec Corporation Method of disk formatting
CN101673242A (en) * 2008-09-10 2010-03-17 中兴通讯股份有限公司 Method and device for formatting hard disk

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20090031102A (en) * 2007-09-21 2009-03-25 삼성전자주식회사 Method and apparatus for formatting for a potable storage device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1266224A (en) * 1999-03-04 2000-09-13 英业达股份有限公司 Method for formatted disc
US6233105B1 (en) * 1999-03-29 2001-05-15 Inventec Corporation Method of disk formatting
CN101673242A (en) * 2008-09-10 2010-03-17 中兴通讯股份有限公司 Method and device for formatting hard disk

Also Published As

Publication number Publication date
CN102117316A (en) 2011-07-06

Similar Documents

Publication Publication Date Title
CN109542342B (en) Metadata management and data reconstruction method, equipment and storage medium
US8312554B2 (en) Method of hiding file at data protecting mode for non-volatile memory module, memory controller and portable memory storage apparatus
CN101645043B (en) Methods for reading and writing data and memory device
CN102136290A (en) Method for storing embedded real-time video files
CN102682012A (en) Method and device for reading and writing data in file system
CN104699417A (en) Data storage device and data access method thereof
US9798761B2 (en) Apparatus and method for fsync system call processing using ordered mode journaling with file unit
CN103729149A (en) Data storage method
CN102024060B (en) Method for memorizing files and restoring error deleted files
CN105589733B (en) A kind of data processing method and device
CN110147203A (en) A kind of file management method, device, electronic equipment and storage medium
CN103473258A (en) Cloud storage file system
CN102541969A (en) File protection method and system based on file allocation table (FAT) file system, and memory
CN103092849A (en) File system cluster management method
RU2017104408A (en) COMPONENT DATA STORAGE TOPOLOGIES FOR DATA OBJECTS
CN107967118A (en) A kind of method and apparatus realized hard disc data high speed dump and checked
CN102117316B (en) FAT (file allocation table) file system formatting method and device
CN102253938A (en) Method and device for writing and restoring file
CN105830067A (en) Document information processing method, apparatus, and document processing apparatus and system
KR101474285B1 (en) Fat file system and log data storage method of the same
CN105573862B (en) Method and equipment for recovering file system
CN107229664B (en) Indirect data structure for managing file system metadata
CN104504349B (en) A kind of Video data safe storage device and method
US20190354306A1 (en) Available-space management method for nonvolatile memory, access device which stores data to information storage device with nonvolatile memory, information storage device, and information storage system
CN102969026B (en) Based on movable storage device detection method and the device of data handling system

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
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20121121

Termination date: 20171231

CF01 Termination of patent right due to non-payment of annual fee