CN108763371A - A kind of Exfat file system power-off protection and file detect restoration methods - Google Patents

A kind of Exfat file system power-off protection and file detect restoration methods Download PDF

Info

Publication number
CN108763371A
CN108763371A CN201810475518.9A CN201810475518A CN108763371A CN 108763371 A CN108763371 A CN 108763371A CN 201810475518 A CN201810475518 A CN 201810475518A CN 108763371 A CN108763371 A CN 108763371A
Authority
CN
China
Prior art keywords
file
value
directory
directory entry
field
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
CN201810475518.9A
Other languages
Chinese (zh)
Other versions
CN108763371B (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.)
Shanghai V-Kool Information Technology Ltd By Share Ltd
Original Assignee
Shanghai V-Kool Information Technology Ltd By Share 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 Shanghai V-Kool Information Technology Ltd By Share Ltd filed Critical Shanghai V-Kool Information Technology Ltd By Share Ltd
Priority to CN201810475518.9A priority Critical patent/CN108763371B/en
Publication of CN108763371A publication Critical patent/CN108763371A/en
Application granted granted Critical
Publication of CN108763371B publication Critical patent/CN108763371B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1458Management of the backup or restore process

Abstract

The present invention provides a kind of Exfat file system power-off protections and file to detect restoration methods, including:Determination will carry out the file directory item of write operation;Data are written into the data field of file;It is unfinished that mode of operation, which is arranged,;It is other values to change this document attribute directory item or the type feature value of stream extension directory entry or file-name extension directory entry any one;The value of 1 file size of file size, 2 field in update stream extension directory entry successively;Update corresponding cluster bitmap file and FAT table item;The verification of calculation document directory entry and, and the value update of sum will be verified in the checksum field in attribute directory item;Change back the value that step 4 is changed to original correctly value;It is to complete that mode of operation, which is arranged,.Meanwhile providing the restoration methods of corresponding document.The present invention solves the problems, such as that Exfat file system leads to file system corruption during write operation by accident power-off, and can realize the fast quick-recovery function of not writing file data.

Description

A kind of Exfat file system power-off protection and file detect restoration methods
Technical field
The present invention relates to field of computer technology, especially in terms of file system storage, specifically, the present invention relates to A kind of Exfat file system power-off protection and file detect restoration methods.
Background technology
In field of computer technology, it is related to a large amount of file storage work, needs to carry out write operation to file, if literary Part system by accident power-off, then can cause part critical data in file system endless during to file write operation It is whole, cause file system corruption, operating system that can not carry out normal operating to this document system.
Existing file system power-off protection method is to carry out double copies to data and daily record, or take and change to hardware It makes, the method powered by backup power supply in accident power-off.It can reach file system power-off using the method for data backup to protect The function of shield, but Backup Data can occupy disk space, and disk utilization is caused to reduce.Using the method for hardware modification, It just cannot achieve under the environment that some hardware have been fixed.
Invention content
For deficiency present in existing file system cut-off guard method, the present invention provides a kind of Exfat files systems Unite power-off protection and file detects restoration methods, can accident power-off causes file system during write operation to avoid file system The problem of system damage, meanwhile, the file not operated when power is off can be restored.The present invention solves Exfat file system and exists The problem of leading to file system corruption by accident power-off during write operation, and can realize the quick of the file data not write Restore function.Technical scheme of the present invention is described as follows:
When carrying out write operation to Exfat file system, a very important item data is exactly file directory item.File directory Xiang Yousan part forms, these three parts are referred to as attribute directory item, stream extension directory entry, file-name extension catalogue ?.The key message for including in attribute directory item has:The type feature value (0x85) of attribute directory item, attached catalogue item number, text Part directory entry verifies and file attribute, file creation time, last modification time, last access time.In stream extension directory entry Including key message have:The type feature value (0xC0) of stream extension directory entry, file fragmentation mark, filename number of characters, text Part name hash value, file size 1, file size 2, starting cluster number.The key message for including in file-name extension directory entry has:Text Part name extends the type feature value (0xC1) of directory entry, filename.
Exfat file system power-off protection method provided by the invention includes the following steps the write operation of file system:
1. the corresponding file directory item of file that determination will be operated records the initial address of this document directory entry.
2. the data of one section of designated length are written into the data field of this document.
3. it is unfinished that mode of operation, which is arranged,.
4. changing the type feature value of attribute directory item or stream extension directory entry or file-name extension directory entry any one For other values.
5. the file size 1 in update stream extension directory entry, the value of 2 field of file size successively.
6. the corresponding cluster bitmap file of update and FAT table item.
7. the verification of calculation document directory entry and, and the value update of sum will be verified to the checksum field in attribute directory item In.
8. changeing back the value that step 4 is changed to original correctly value.
9. it is to complete that mode of operation, which is arranged,.
10. step 2~9 are repeated, until operating writing-file terminates.
The mode of operation is stored in the reserved area of file system;The starting point of the corresponding file directory item of file of operation Location is recorded in the reservation region of file system.
It after file system accident power-off re-powers, needs to be detected file system, detecting step includes:
1. the value of read operation state.
2. if mode of operation is to complete, file access pattern need not be carried out.
3. if the value of mode of operation is unfinished, illustrate the file for having operation unfinished when power-off.
4. reading the file directory item initial address of the file operated when power-off, file directory item information is obtained.
5. judging whether file directory item information is correct.
6. if this file directory item information is correct, illustrate that in just setting mode of operation be " unfinished ", also not to file It is powered off when directory entry is modified, as long as mode of operation is revised as " completing ".
7. if this file directory item information is incorrect, illustrate when this corresponding file of file directory item is just powered off The file of operation needs to restore this file.
File access pattern includes the following steps:
1. whether sentence file size 1 and the value of 2 field of file size in stream extension directory entry consistent.
2. if the value of 2 field of file size 1 and file size is inconsistent, the value of 1 field of file size is copied into text 2 field of part size continues following steps;If file size 1 is consistent with the value of 2 field of file size, continue directly to following Step;
3. the verification of calculation document directory entry and, and the value update of sum will be verified to the checksum field in attribute directory item In.
4. the characteristic value for the directory entry type changed is revised as correctly being worth.
5. mode of operation is revised as " completing ".
Beneficial effects of the present invention:Exfat file system power-off protection method provided by the invention need not carry out excessive Data backup, so that it may with realize to file system power-off protection, and can quickly to power off before do not operate completion file progress Restore, even if file can guarantee that the part having been written into can be read if a part is only written.
Description of the drawings
Fig. 1 is file system power-off protection file write operation flow chart of the present invention;
Fig. 2 is that accident power-off of the present invention re-powers file system overhaul flow chart;
Fig. 3 is file access pattern flow chart of the present invention.
Specific implementation mode
Below by specific implementation mode, the present invention is described in further detail:
In Windows operating system, for Exfat file system, if the attribute of the file directory item of some file The type feature value that directory entry or stream extend any one of directory entry or file-name extension directory entry is incorrect, Windows systems This would not be identified as a file by system, but still can carry out other operations to this document system.If this document mesh It is all correct to record the attribute directory item in item, flow extension directory entry and the type feature value of file-name extension directory entry, and is flowed Extend 2 field of 1 field of file size and file size in directory entry value is inconsistent or the verification of attribute directory item and not just Really, file system is just damaged at this time, and Windows systems just can not carry out other operations to this document system.
Therefore, a kind of Exfat file system power-off protection method provided by the invention, is exactly utilized above-mentioned principle. When carrying out operating writing-file to file system, it is first determined to carry out the file directory item of write operation file.If it is creating A new file is built, first establishment file directory entry is needed, in establishment file directory entry, first by the attribute directory of file directory item The type feature value of any one of item, stream extension directory entry, file-name extension directory entry is revised as other values.The present invention is with attribute For directory entry, the type feature value of attribute directory item is set as 0x75, other fields of question paper directory entry all write as work(it Afterwards, then by the type feature value of attribute directory item 0x85 is changed back.It is as follows:
1. the corresponding file directory item of file that determination will be operated, the initial address of this document directory entry is recorded in In the reservation region of file system;
2. the data of one section of designated length are written into this document;
3. mode of operation is set as unfinished, mode of operation is stored in the reserved area of file system;
4. the type feature value of attribute directory item is changed to 0x75;
5. file size 1, the value of 2 field of file size in update stream extension directory entry;
6. the corresponding cluster bitmap file of update and FAT table item;
7. the verification of calculation document directory entry and, and the value update of sum will be verified to the checksum field in attribute directory item In;
8. the type feature value for the attribute directory item changed in step 4 to be changed back to original value 0x85.
9. mode of operation is set as completing, mode of operation is stored in the reserved area of file system.
10. 2~9 steps are repeated, until file write operation terminates.
After file system accident power-off re-powers, it is necessary first to the file for whether having operation unfinished when detection power-off, Detecting step includes:
1. read operation status information judges whether mode of operation is unfinished;
2. if mode of operation is to complete, file access pattern need not be carried out;
3. if mode of operation is unfinished, read the initial address of the operation file directory entry of record;
4. reading the file directory item letter for not completing operation file according to the initial address of the operation file directory entry of record Breath, judges whether the directory entry of this document is complete;
5. if this file directory item information is correct, illustrate that in just setting mode of operation be " unfinished ", also not to file It is powered off when directory entry is modified, as long as mode of operation is revised as " completing ";
6. if this file directory item information is incorrect, illustrate when this corresponding file of file directory item is just powered off The file of operation needs to restore this file.
File recovery step is:
1. whether sentence file size 1 and the value of 2 field of file size in stream extension directory entry consistent;
2. if the value of 2 field of file size 1 and file size is inconsistent, the value of 1 field of file size is copied to 2 field of file size continues following steps;If file size 1 is consistent with the value of 2 field of file size, continue directly to Lower step;
3. the verification of calculation document directory entry and, the type feature value of attribute directory item is by 0x85 progress when calculating, then It will be in the value update to the checksum field of attribute directory item that sum be verified;
4. the type feature value for the attribute directory item changed is changed to correct value 0x85;
5. mode of operation is revised as " completing ".

Claims (3)

1. a kind of Exfat file system power-off protection method, which is characterized in that include the following steps:
1) determination will carry out the file directory item corresponding to the file of write operation, and the initial address of this document directory entry is recorded in In the reservation region of file system;
2) data of one section of designated length are written into the data field of this document;
3) setting mode of operation is unfinished, and mode of operation is stored in the reserved area of file system;
4) this document attribute directory item, or the type spy of stream extension directory entry or file-name extension directory entry any one are changed Value indicative is other values;
5) update stream extends file size 1, the value of 2 field of file size in directory entry successively;
6) corresponding cluster bitmap file and FAT table item are updated;
7) verification of calculation document directory entry and, and the value update of sum will be verified in the checksum field in attribute directory item;
8) value that step 4 is changed is changeed back to original correctly value;
9) setting mode of operation is to complete, and mode of operation is stored in the reserved area of file system;
10) step 2 is repeated to 9, until this document write operation is completed.
2. a kind of Exfat file system power-off protection file test method, which is characterized in that include the following steps:
1) value of read operation state;
2) if mode of operation is to complete, file access pattern need not be carried out;
If 3) value of mode of operation is unfinished, illustrate the file for having operation unfinished when power-off, continues following steps;
4) the file directory item initial address of the file operated when reading power-off obtains file directory item information;
5) judge whether file directory item information is correct;
If 6) this file directory item information is correct, illustrate that in just setting mode of operation be " unfinished ", also not to file directory Item powers off when modifying, as long as mode of operation is revised as " completing ";
If 7) this file directory item information is incorrect, illustrate operating when this corresponding file of file directory item is just powered off File, need to restore this file.
3. a kind of Exfat file system power-off protection file access pattern method, which is characterized in that include the following steps:
1) whether consistent sentence file size 1 and the value of 2 field of file size in stream extension directory entry;
If 2) value of 2 field of file size 1 and file size is inconsistent, the value of 1 field of file size is copied into file 2 field of size continues following steps;If file size 1 is consistent with the value of 2 field of file size, following step is continued directly to Suddenly;
3) verification of calculation document directory entry and, and the value update of sum will be verified in the checksum field in attribute directory item;
4) characteristic value for the directory entry type changed is revised as correctly being worth;
5) mode of operation is revised as " completing ".
CN201810475518.9A 2018-05-17 2018-05-17 Exfat file system power-off protection and file detection recovery method Active CN108763371B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810475518.9A CN108763371B (en) 2018-05-17 2018-05-17 Exfat file system power-off protection and file detection recovery method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810475518.9A CN108763371B (en) 2018-05-17 2018-05-17 Exfat file system power-off protection and file detection recovery method

Publications (2)

Publication Number Publication Date
CN108763371A true CN108763371A (en) 2018-11-06
CN108763371B CN108763371B (en) 2021-06-18

Family

ID=64008176

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810475518.9A Active CN108763371B (en) 2018-05-17 2018-05-17 Exfat file system power-off protection and file detection recovery method

Country Status (1)

Country Link
CN (1) CN108763371B (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030028765A1 (en) * 2001-07-31 2003-02-06 Cromer Daryl Carvis Protecting information on a computer readable medium
CN101515276A (en) * 2008-12-29 2009-08-26 北京握奇数据系统有限公司 Method for write operation of file data, and recovery method and recovery system for file data
CN101876927A (en) * 2009-11-30 2010-11-03 北京握奇数据系统有限公司 Power-off protection method for realizing FAT32 file system, and device thereof
CN102226893A (en) * 2011-05-21 2011-10-26 浙江工业大学 FAT (file allocation table) file system repairing method in embedded system
CN102254048A (en) * 2011-08-24 2011-11-23 深圳市万兴软件有限公司 Data recovering method and system
CN104794025A (en) * 2015-04-27 2015-07-22 四川效率源信息安全技术有限责任公司 Method for quick verification on storage device
CN105512056A (en) * 2014-09-24 2016-04-20 中兴通讯股份有限公司 Method and device for data storage, and terminal
CN107908967A (en) * 2017-10-30 2018-04-13 上海威固信息技术股份有限公司 A kind of file hiding and restoration methods of Exfat file system
CN107992763A (en) * 2017-11-06 2018-05-04 北京东土科技股份有限公司 The power-off protection method and device of a kind of file system

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030028765A1 (en) * 2001-07-31 2003-02-06 Cromer Daryl Carvis Protecting information on a computer readable medium
CN101515276A (en) * 2008-12-29 2009-08-26 北京握奇数据系统有限公司 Method for write operation of file data, and recovery method and recovery system for file data
CN101876927A (en) * 2009-11-30 2010-11-03 北京握奇数据系统有限公司 Power-off protection method for realizing FAT32 file system, and device thereof
CN102226893A (en) * 2011-05-21 2011-10-26 浙江工业大学 FAT (file allocation table) file system repairing method in embedded system
CN102254048A (en) * 2011-08-24 2011-11-23 深圳市万兴软件有限公司 Data recovering method and system
CN105512056A (en) * 2014-09-24 2016-04-20 中兴通讯股份有限公司 Method and device for data storage, and terminal
CN104794025A (en) * 2015-04-27 2015-07-22 四川效率源信息安全技术有限责任公司 Method for quick verification on storage device
CN107908967A (en) * 2017-10-30 2018-04-13 上海威固信息技术股份有限公司 A kind of file hiding and restoration methods of Exfat file system
CN107992763A (en) * 2017-11-06 2018-05-04 北京东土科技股份有限公司 The power-off protection method and device of a kind of file system

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
ROBERT SHULLICH: "Reverse engineering the Microsoft exFAT file system", 《THE SANS INSTITUTE》 *
钱镜洁: "exFAT文件系统的解析和数据恢复", 《电信科学》 *

Also Published As

Publication number Publication date
CN108763371B (en) 2021-06-18

Similar Documents

Publication Publication Date Title
US9910735B1 (en) Generating an application-consistent snapshot
US8856469B2 (en) Apparatus and method for logging optimization using non-volatile memory
KR101301828B1 (en) Method and apparatus for power-off recovery in flash memory-based solid state drive
CN102792276A (en) Buffer disk in flashcopy cascade
CN110399247B (en) Data recovery method, device and equipment and computer readable storage medium
CN106227625B (en) A kind of restoration methods and system of the flash data damaged by power down
CN103365766B (en) A kind of method and system of file integrality protection
CN100437504C (en) Hard disc data backup system and method
JP2009282752A (en) Storage device and recording method of file system
CN104133740A (en) Method for recovering abnormal power failure data
US9858287B2 (en) Storage system
CN108062262A (en) Operating system backup-and-restore method and its system based on storage sector data
JP2006172320A (en) Data duplication controller
CN101364218A (en) Hard disk video recorder file systems and checking method thereof
JP2006519444A (en) Flash memory data management method
CN104461791A (en) Information processing method and device
CN103531234B (en) Power-down protection method in write operation process of NandFlash memory
CN104899114A (en) Continuous time data protection method on solid state drive
US20100138932A1 (en) Data protecting method and computing apparatus
CN103593301B (en) Bad block management method and system
CN104598328A (en) File system repair method, device and system
CN103902227B (en) It is a kind of to support the additional document storage mode write and share and read
CN104156175A (en) Virtual disk size smooth expansion method
US20070112722A1 (en) File system and file information processing method
CN108763371A (en) A kind of Exfat file system power-off protection and file detect restoration methods

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant