CN104991926A - File system recovery method and system - Google Patents

File system recovery method and system Download PDF

Info

Publication number
CN104991926A
CN104991926A CN201510370100.8A CN201510370100A CN104991926A CN 104991926 A CN104991926 A CN 104991926A CN 201510370100 A CN201510370100 A CN 201510370100A CN 104991926 A CN104991926 A CN 104991926A
Authority
CN
China
Prior art keywords
file
subregion
fault
superblock
file system
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.)
Pending
Application number
CN201510370100.8A
Other languages
Chinese (zh)
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.)
Inspur Beijing Electronic Information Industry Co Ltd
Original Assignee
Inspur Beijing Electronic Information Industry 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 Inspur Beijing Electronic Information Industry Co Ltd filed Critical Inspur Beijing Electronic Information Industry Co Ltd
Priority to CN201510370100.8A priority Critical patent/CN104991926A/en
Publication of CN104991926A publication Critical patent/CN104991926A/en
Pending legal-status Critical Current

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/1448Management of the data involved in backup or backup restore
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/11File system administration, e.g. details of archiving or snapshots

Abstract

The invention provides a file system recovery method and system, relates to the field of system management, and solves the problem of data loss in a file system recovery process. The method comprises the steps of: when a partition fault occurs, searching a superblock file of a partition of a fault; according to the superblock file, recovering the partition of the fault; and after finishing the recovery of the partition of the fault, remounting the partition. According to the technical scheme provided by the invention, the file system recovery method is suitable for a data partition file system, and the repair of a file system is finished through the superblock file.

Description

File system recovery method and system
Technical field
The present invention relates to field of system management, particularly relate to a kind of file system recovery method and device.
Background technology
In actual applications, some maloperations cause destruction to the file system of the subregion having data unavoidably, and subregion cannot complete carry, now want the carry proceeding subregion, can only reformat subregion or recover original file system.Reformat the loss that subregion can cause original all data, this mode is lost larger, and also there are some shortcomings in the method for recovery file system, certain methods also can cause loss that is a lot of or total data when recovering original file system, cannot play the effect that as far as possible few minimizing legacy data is lost.
Summary of the invention
The invention provides a kind of file system recovery method and system, solve the problem of loss of data in file system recovery process.
A kind of file system recovery method, comprising:
When there is subregion fault, the superblock file of the subregion of looking up the fault;
According to described superbock file, recover the subregion of described fault;
After the partition recovery of described fault is completed, this subregion of carry again.
Preferably, the superblock file of the subregion of looking up the fault is specially:
1024B-2048B to superblock file is copied in the file of the subregion of described fault.
Preferably, according to described superbock file, the subregion recovering described fault comprises:
Binary described superblock file transform is become the form of 16 systems;
Verify the correctness of 16 system superblock files, obtain the number of inodes and the number of block that superblock file header records;
According to the number of described inodes and the number of block, recover the subregion of described fault.
Preferably, described when there is subregion fault, before the step of the superblock file of the subregion of looking up the fault, also comprise:
Format is carried out and carry to disk partition.
Preferably, operating environment is linux system.
Present invention also offers a kind of file system recovery system, comprising:
File polling module, for when there is subregion fault, the superblock file of the subregion of looking up the fault;
Fault restoration module, for according to described superbock file, recovers the subregion of described fault;
Carry module, for after completing the partition recovery of described fault, this subregion of carry again.
Preferably, described file polling module, specifically for
1024B-2048B to superblock file is copied in the file of the subregion of described fault.
Preferably, described fault restoration module comprises:
Converting unit, for becoming the form of 16 systems by binary described superblock file transform;
Authentication unit, for verifying the correctness of 16 system superblock files, obtains the number of inodes and the number of block that superblock file header records;
Recovery unit, for according to the number of described inodes and the number of block, recovers the subregion of described fault.
Preferably, described carry module, also for when system initialization, carries out format and carry to disk partition.
The invention provides a kind of file system recovery method and system, when there is subregion fault, the superblock file of the subregion of looking up the fault, according to described superbock file, recover the subregion of described fault, and after the partition recovery of described fault is completed, this subregion of carry again.Completed the reparation of file system by superbock file, solve the problem of loss of data in file system recovery process.
Accompanying drawing explanation
The process flow diagram of a kind of file system recovery method that Fig. 1 provides for embodiments of the invention one;
Fig. 2 is the physical storage structure schematic diagram of subregion;
The structural representation of a kind of file system recovery system that Fig. 3 provides for embodiments of the invention two;
Fig. 4 is the structural representation of fault restoration module 302 in Fig. 3.
Embodiment
Hereinafter will be described in detail to embodiments of the invention by reference to the accompanying drawings.It should be noted that, when not conflicting, the embodiment in the application and the feature in embodiment can combination in any mutually.
First by reference to the accompanying drawings embodiments of the invention one are described.
Embodiments provide a kind of file system recovery method, use the method to complete to the flow process of file system fault handling as shown in Figure 1, comprising:
The installation of step 101, operating system;
In this step, linux system is installed, as installed redhat6.4 operating system.
Step 102, subregion is carried out to sdb, format, carry.
Step 103, detection file system fault.
Can also the simulation files system failure, as used dd to the sdb1 simulation files system failure.
Instruction: dd if=/dev/null of=/dev/mnt count=1000bs=4K.
Step 104, occur subregion fault time, the superblock Fileview file system of the subregion of looking up the fault;
After there is sdb1 file system corruption in step 103, carry cannot be carried out.
Search superblock immediately.Concrete, copy from/dev/sdb1 the 1024B-2048B position of superblock (Here it is) is superblock file to one.
The instruction used is: dd if=/dev/sdb1bs=1k skip=1count=1of=superblock.
Wherein, bs=1k is the block size at every turn read and write;
Skip=1, shows to offset how many BOB(beginning of block)s and reads (block is bs=1k, skew 1, represent from 1k read) here;
Count=1, represents the size (represent and read 1k) read here;
Where if, of, represent read and write wherefrom respectively.
With reference to figure 2, the physical storage structure for subregion:
Can see in Fig. 2 that first 1k place of first Block is the Boot Block stored, and superblock is from 1k, size is 1k.
Step 105, according to described superbock file, recover the subregion of described fault.
This step specifically comprises:
1, superblock file is checked;
Open the superblock file copying out from/dev/sda3 with vim, owing to being binary file, use after opening with vim: Xxd converts 16 binary form to.
Like this, the form of superblock on disk is just obtained.
2, superblock correctness is verified;
First, by checking/usr/include/linux/ext3_fs.h header file in structext3_super_block, can know and record the number of inodes and the number of block on the head of superblock file, they are 32.
As can be seen from superblock:
Inodes_count:00003a04 (notes: be decimal end) – >043a0000=70909952 here
blocks_count:fdc43904–>0439c4fd=70894845dumpe2fs/dev/sda3|less
Following output (part) can be seen:
Inode count:70909952
Block count:70894845
3, superblock recovery file system is used;
[ root@localhost~]#e2fsck-b 32768/dev/sdb1
e2fsck 1.41.12(17-May-2010)
/dev/sdb1was not cleanly unmounted,check forced.
Resize inode not valid.Recreate<y>?cancelled!
[ root@localhost~]#e2fsck-b 32768/dev/sdb1
e2fsck 1.41.12(17-May-2010)
/dev/sdb1was not cleanly unmounted,check forced.
Resize inode not valid.Recreate<y>?yes
Pass 1:Checking inodes,blocks,and sizes
Pass 2:Checking directory structure
Pass 3:Checking directory connectivity
Pass 4:Checking reference counts
Pass 5:Checking group summary information
Free blocks count wrong for group#0(24975,counted=24974).
Fix<y>?yes
Free blocks count wrong for group#1(32647,counted=32644).
Fix<y>?yes
Free blocks count wrong(471602,counted=471598).
Fix<y>?yes
Free inodes count wrong for group#0(8133,counted=8128).
Fix<y>?yes
Directories count wrong for group#0(2,counted=4).
Fix<y>?yes
Free inodes count wrong(122149,counted=122144).
Fix<y>?yes
/dev/sdb1:*****FILE SYSTEM WAS MODIFIED*****
/dev/sdb1:16/122160files(6.3%non-contiguous),16594/488192blocks
Here can see that file system is recovered.
Step 106, after the partition recovery of described fault is completed, this subregion of carry again.
Again carry/dev/sdb1 can see the normal carry of energy, file free of losses.
Below in conjunction with accompanying drawing, embodiments of the invention two are described.
Embodiments provide a kind of file system recovery system, its structure as shown in Figure 3, comprising:
File polling module 301, for when there is subregion fault, the superblock file of the subregion of looking up the fault;
Fault restoration module 302, for according to described superbock file, recovers the subregion of described fault;
Carry module 303, for after completing the partition recovery of described fault, this subregion of carry again.
Preferably, described file polling module 301, specifically for
1024B-2048B to superblock file is copied in the file of the subregion of described fault.
Preferably, the structure of described fault restoration module 302 as shown in Figure 4, comprising:
Converting unit 3021, for becoming the form of 16 systems by binary described superblock file transform;
Authentication unit 3022, for verifying the correctness of 16 system superblock files, obtains the number of inodes and the number of block that superblock file header records;
Recovery unit 3023, for according to the number of described inodes and the number of block, recovers the subregion of described fault.
Preferably, described carry module 303, also for when system initialization, carries out format and carry to disk partition.
The embodiment provides a kind of file system recovery method and system, when there is subregion fault, the superblock file of the subregion of looking up the fault, according to described superbock file, recover the subregion of described fault, and after the partition recovery of described fault is completed, this subregion of carry again.Completed the reparation of file system by superbock file, solve the problem of loss of data in file system recovery process, the loss that maloperation causes data can be reduced in linux system.
One of ordinary skill in the art will appreciate that all or part of step of above-described embodiment can use computer program flow process to realize, described computer program can be stored in a computer-readable recording medium, described computer program (as system, unit, device etc.) on corresponding hardware platform performs, when performing, step comprising embodiment of the method one or a combination set of.
Alternatively, all or part of step of above-described embodiment also can use integrated circuit to realize, and these steps can be made into integrated circuit modules one by one respectively, or the multiple module in them or step are made into single integrated circuit module to realize.Like this, the present invention is not restricted to any specific hardware and software combination.
Each device/functional module/functional unit in above-described embodiment can adopt general calculation element to realize, and they can concentrate on single calculation element, also can be distributed on network that multiple calculation element forms.
Each device/functional module/functional unit in above-described embodiment using the form of software function module realize and as independently production marketing or use time, can be stored in a computer read/write memory medium.The above-mentioned computer read/write memory medium mentioned can be ROM (read-only memory), disk or CD etc.
Anyly be familiar with those skilled in the art in the technical scope that the present invention discloses, change can be expected easily or replace, all should be encompassed within protection scope of the present invention.Therefore, protection scope of the present invention should be as the criterion with the protection domain described in claim.

Claims (9)

1. a file system recovery method, is characterized in that, comprising:
When there is subregion fault, the superblock file of the subregion of looking up the fault;
According to described superbock file, recover the subregion of described fault;
After the partition recovery of described fault is completed, this subregion of carry again.
2. file system recovery method according to claim 1, is characterized in that, the superblock file of the subregion of looking up the fault is specially:
1024B-2048B to superblock file is copied in the file of the subregion of described fault.
3. file system recovery method according to claim 1, is characterized in that, according to described superbock file, the subregion recovering described fault comprises:
Binary described superblock file transform is become the form of 16 systems;
Verify the correctness of 16 system superblock files, obtain the number of inodes and the number of block that superblock file header records;
According to the number of described inodes and the number of block, recover the subregion of described fault.
4. file system recovery method according to claim 1, is characterized in that, described when there is subregion fault, before the step of the superblock file of the subregion of looking up the fault, also comprises:
Format is carried out and carry to disk partition.
5., according to the arbitrary described file system recovery method of Claims 1-4, it is characterized in that, operating environment is linux system.
6. a file system recovery system, is characterized in that, comprising:
File polling module, for when there is subregion fault, the superblock file of the subregion of looking up the fault;
Fault restoration module, for according to described superbock file, recovers the subregion of described fault;
Carry module, for after completing the partition recovery of described fault, this subregion of carry again.
7. file system recovery system according to claim 6, is characterized in that, described file polling module, specifically for
1024B-2048B to superblock file is copied in the file of the subregion of described fault.
8. file system recovery system according to claim 6, is characterized in that, described fault restoration module comprises:
Converting unit, for becoming the form of 16 systems by binary described superblock file transform;
Authentication unit, for verifying the correctness of 16 system superblock files, obtains the number of inodes and the number of block that superblock file header records;
Recovery unit, for according to the number of described inodes and the number of block, recovers the subregion of described fault.
9. file system recovery system according to claim 6, is characterized in that,
Described carry module, also for when system initialization, carries out format and carry to disk partition.
CN201510370100.8A 2015-06-29 2015-06-29 File system recovery method and system Pending CN104991926A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510370100.8A CN104991926A (en) 2015-06-29 2015-06-29 File system recovery method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510370100.8A CN104991926A (en) 2015-06-29 2015-06-29 File system recovery method and system

Publications (1)

Publication Number Publication Date
CN104991926A true CN104991926A (en) 2015-10-21

Family

ID=54303742

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510370100.8A Pending CN104991926A (en) 2015-06-29 2015-06-29 File system recovery method and system

Country Status (1)

Country Link
CN (1) CN104991926A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109213629A (en) * 2018-07-02 2019-01-15 广东睿江云计算股份有限公司 A kind of union file system failure self-recovery method and device
CN111209138A (en) * 2018-11-22 2020-05-29 浙江宇视科技有限公司 Operation and maintenance method and device of data storage system
CN111984195A (en) * 2020-08-19 2020-11-24 广州邦讯信息系统有限公司 Method and device for improving stability of embedded Linux system

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050144501A1 (en) * 2003-12-02 2005-06-30 Kim Jae G. Method for recovering data in EXT2 file system, and computer-readable storage medium recorded with data-recovery program
CN101635638A (en) * 2008-07-25 2010-01-27 中兴通讯股份有限公司 Disaster tolerance system and disaster tolerance method thereof
CN102541685A (en) * 2011-11-16 2012-07-04 中标软件有限公司 Linux system backup method and Linux system repair method
CN102955720A (en) * 2011-08-25 2013-03-06 北京中科智网科技有限公司 Method for improving stability of EXT (extended) file system
CN103678044A (en) * 2013-12-30 2014-03-26 厦门市美亚柏科信息股份有限公司 Data recovery method and device of RAID5 in EXT3 file system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050144501A1 (en) * 2003-12-02 2005-06-30 Kim Jae G. Method for recovering data in EXT2 file system, and computer-readable storage medium recorded with data-recovery program
CN101635638A (en) * 2008-07-25 2010-01-27 中兴通讯股份有限公司 Disaster tolerance system and disaster tolerance method thereof
CN102955720A (en) * 2011-08-25 2013-03-06 北京中科智网科技有限公司 Method for improving stability of EXT (extended) file system
CN102541685A (en) * 2011-11-16 2012-07-04 中标软件有限公司 Linux system backup method and Linux system repair method
CN103678044A (en) * 2013-12-30 2014-03-26 厦门市美亚柏科信息股份有限公司 Data recovery method and device of RAID5 in EXT3 file system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
贺伟涛: "ext2文件系统中superblock corrupt后的修复工作", 《网络安全技术与应用》 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109213629A (en) * 2018-07-02 2019-01-15 广东睿江云计算股份有限公司 A kind of union file system failure self-recovery method and device
CN109213629B (en) * 2018-07-02 2022-04-22 广东睿江云计算股份有限公司 Method and device for self-recovering joint file system fault
CN111209138A (en) * 2018-11-22 2020-05-29 浙江宇视科技有限公司 Operation and maintenance method and device of data storage system
CN111984195A (en) * 2020-08-19 2020-11-24 广州邦讯信息系统有限公司 Method and device for improving stability of embedded Linux system

Similar Documents

Publication Publication Date Title
CN103699585B (en) Methods, devices and systems for file metadata storage and file recovery
JP5669867B2 (en) System and method for garbage collection in a deduplication data system
JP6097880B2 (en) Byzantine fault tolerance data replication method and system
JP6264666B2 (en) Data storage method, data storage device, and storage device
CN108027757B (en) System and method for restoring data from opaque data backup streams
CN102567146B (en) Log backup method and device and smart card
US10860447B2 (en) Database cluster architecture based on dual port solid state disk
CN102067148A (en) Methods and systems for determining file classifications
US11210003B2 (en) Method, device and computer program product for restoring data based on replacing child node identifiers with parent node identifier
CN104199888A (en) Data recovery method and device for resilient file system
WO2021129151A1 (en) File backup method and apparatus, and terminal device
CN104991926A (en) File system recovery method and system
CN103973727A (en) Data synchronizing method and device
CN105278985A (en) Method and system for deploying file system
CN112800019A (en) Data backup method and system based on Hadoop distributed file system
CN105608150A (en) Business data processing method and system
CN106326041A (en) Second-level recovery method for database
CN105159790B (en) A kind of data rescue method and file server
CN111143113A (en) Method, electronic device and computer program product for copying metadata
US8595189B2 (en) Method and system for implementing fast incremental backups
TWI461904B (en) Recovery method and device for linux using fat file system
CN103761202A (en) Data storage node hard disk position identification method and system
CN114026545A (en) Snapshot for arbitrary point in time replication
CN107783904B (en) Unit test pile de-weighting method, device, computer readable storage medium and equipment
JP6376626B2 (en) Data storage method, data storage device, and storage device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20151021

RJ01 Rejection of invention patent application after publication