[go: up one dir, main page]

CN114625696B - File recovery method and device, electronic equipment and storage medium - Google Patents

File recovery method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN114625696B
CN114625696B CN202210350946.5A CN202210350946A CN114625696B CN 114625696 B CN114625696 B CN 114625696B CN 202210350946 A CN202210350946 A CN 202210350946A CN 114625696 B CN114625696 B CN 114625696B
Authority
CN
China
Prior art keywords
file
directory
restored
node
information
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
CN202210350946.5A
Other languages
Chinese (zh)
Other versions
CN114625696A (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.)
Chongqing Unisinsight Technology Co Ltd
Original Assignee
Chongqing Unisinsight Technology 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 Chongqing Unisinsight Technology Co Ltd filed Critical Chongqing Unisinsight Technology Co Ltd
Priority to CN202210350946.5A priority Critical patent/CN114625696B/en
Publication of CN114625696A publication Critical patent/CN114625696A/en
Application granted granted Critical
Publication of CN114625696B publication Critical patent/CN114625696B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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 OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/901Indexing; Data structures therefor; Storage structures
    • G06F16/9024Graphs; Linked lists
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/901Indexing; Data structures therefor; Storage structures
    • G06F16/9027Trees

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Software Systems (AREA)
  • Quality & Reliability (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Management Or Editing Of Information On Record Carriers (AREA)

Abstract

The application provides a file recovery method, a file recovery device, electronic equipment and a storage medium, and relates to the technical field of data processing. The method comprises the following steps: acquiring attribute information of a file to be restored, wherein the attribute information comprises at least one of the following items: full path information of the file to be restored, directory nodes to be restored of the file to be restored and creation time information of the file to be restored; determining a file node where the file to be restored is located from a target hierarchical linked list according to attribute information of the file to be restored and a pre-created index tree; and determining the position information of the file node in the disk according to the mapping relation between the file node and the file index unit, and updating the use state of the file node. The method can realize the quick recovery of the file and ensure the integrity of the file system.

Description

File recovery method and device, electronic equipment and storage medium
Technical Field
The present application relates to the field of data processing technologies, and in particular, to a file recovery method, a device, an electronic apparatus, and a storage medium.
Background
Along with the rapid development of economy and science and technology, the data volume of the internet is increased, and the reliable storage of data in a file system is also particularly critical. In general, during or after the storage of a data file, there may be damage or misdeletion, which results in a problem that the data of the whole file system is not available.
Therefore, how to restore files in a file system is a problem to be solved.
Disclosure of Invention
The application aims to provide a file recovery method, a device, an electronic device and a storage medium, which are used for effectively recovering a wrongly deleted file and a file with a specific time period under a designated directory based on a fixed file system structure.
In order to achieve the above purpose, the technical scheme adopted by the embodiment of the application is as follows:
in a first aspect, an embodiment of the present application provides a file recovery method, including:
Acquiring attribute information of a file to be restored, wherein the attribute information comprises at least one of the following items: the method comprises the steps of full path information of a file to be restored, a directory node to be restored of the file to be restored and creation time information of the file to be restored;
Determining a file node where the file to be restored is located from a target hierarchical linked list according to attribute information of the file to be restored and a pre-created index tree, wherein the target hierarchical linked list is generated according to information of directory nodes and information of file nodes of all deleted files in a file system to which the file to be restored belongs, and the index tree is used for indicating index relations of all directory nodes and file nodes in the file system;
and determining the position information of the file node in a disk according to the mapping relation between the file node and the file index unit, and updating the use state of the file node, wherein the mapping relation between the file node and the file index unit is determined based on the structure of the file system.
Optionally, before determining the file node where the file to be restored is located from the target hierarchical linked list according to the attribute information of the file to be restored and the index tree created in advance, the method includes:
loading an index area of a file system from a disk, and reading information of all directory nodes and information of all file nodes, wherein the index area comprises: the system comprises a plurality of index units, a plurality of storage units and a plurality of storage units, wherein each index unit comprises an index check value, a plurality of directory nodes and a plurality of file nodes; the information for each directory node includes at least one of: directory name, usage status, hierarchy, parent directory identification, directory creation time, and modification time; the information of each file node includes at least one of: file name, usage status, hierarchy, parent directory identification, file creation time and modification time, file fragment number and size;
Storing the information of the directory node with the use state of the first state and the information of the file node into a hierarchical linked list;
And analyzing the hierarchical linked list layer by layer, and creating the index tree according to the connection relation of the father directory identifier.
Optionally, the determining, according to the attribute information of the file to be restored and the index tree created in advance, a file node where the file to be restored is located from a target hierarchical linked list includes:
Searching directory path information of the file to be restored in the index tree according to the full path information of the file to be restored, wherein the directory path information represents the index relation of each directory node of the file to be restored;
if the directory path information is found, determining the directory identification of the father directory node of the file node where the file to be restored is located according to the directory path information;
And determining the file node matched with the directory identifier of the parent directory node and the file name of the file to be restored as the file node where the file to be restored is located from the target hierarchical linked list according to the directory identifier of the parent directory node and the file name of the file to be restored.
Optionally, after searching the directory path information of the file to be restored in the index tree according to the full path information of the file to be restored, the method further includes:
If the directory path information is not found, traversing the index tree, and searching a first-stage directory node of the file to be restored according to the full path information of the file to be restored;
Determining all directory nodes of the file to be restored from the target hierarchical linked list according to the directory identification of the first-level directory node and the directory name of at least one lower-level directory node of the first-level directory node, and generating directory path information of the file to be restored;
Determining the directory identification of the father directory node of the file node where the file to be restored is located according to the directory path information;
And determining the file node matched with the directory identifier of the parent directory node and the file name of the file to be restored as the file node where the file to be restored is located from the target hierarchical linked list according to the directory identifier of the parent directory node and the file name of the file to be restored.
Optionally, the updating the usage status of the file node includes:
And updating the using state of the file node from the second state to the first state.
Optionally, the determining, according to the attribute information of the file to be restored and the index tree created in advance, a file node where the file to be restored is located from a target hierarchical linked list includes:
According to the directory nodes to be restored of the files to be restored, traversing and searching all sub-directory nodes under the directory nodes to be restored in the index tree;
Determining all file nodes matched with the directory identifications of the sub-directory nodes from the target hierarchical linked list according to the directory identifications of the sub-directory nodes;
and determining file nodes with file creation time meeting the creation time information from all the file nodes according to the creation time information of the file to be restored.
Optionally, the updating the usage status of the file node includes:
And updating the use state of the file node and the use state of the directory node associated with the file node from the second state to the first state.
In a second aspect, an embodiment of the present application further provides a file restoring apparatus, including: the device comprises an acquisition module, a determination module and an update module;
The obtaining module is configured to obtain attribute information of a file to be restored, where the attribute information includes at least one of the following: the method comprises the steps of full path information of a file to be restored, a directory node to be restored of the file to be restored and creation time information of the file to be restored;
the determining module is configured to determine, according to attribute information of the file to be restored and a pre-created index tree, a file node where the file to be restored is located from a target hierarchical linked list, where the target hierarchical linked list is generated according to information of directory nodes of all deleted files and information of file nodes in a file system to which the file to be restored belongs, and the index tree is used to indicate index relationships between all directory nodes and file nodes in the file system;
The updating module is used for determining the position information of the file node in the disk according to the mapping relation between the file node and the file index unit, updating the use state of the file node, and determining the mapping relation between the file node and the file index unit based on the structure of the file system.
Optionally, the apparatus further comprises: the device comprises a reading module, a storage module and a creation module;
The reading module is configured to load an index area of the file system from a disk, and read information of all directory nodes and information of all file nodes, where the index area includes: the system comprises a plurality of index units, a plurality of storage units and a plurality of storage units, wherein each index unit comprises an index check value, a plurality of directory nodes and a plurality of file nodes; the information for each directory node includes at least one of: directory name, usage status, hierarchy, parent directory identification, directory creation time, and modification time; the information of each file node includes at least one of: file name, usage status, hierarchy, parent directory identification, file creation time and modification time, file fragment number and size;
The storage module is used for storing the information of the directory node and the information of the file node with the use state being the first state into the hierarchical linked list;
the creation module is used for analyzing the hierarchical linked list layer by layer and creating the index tree according to the connection relation of the father directory identification.
Optionally, the determining module is specifically configured to search, according to the full path information of the file to be restored, directory path information of the file to be restored in the index tree, where the directory path information characterizes an index relationship of each directory node of the file to be restored;
if the directory path information is found, determining the directory identification of the father directory node of the file node where the file to be restored is located according to the directory path information;
And determining the file node matched with the directory identifier of the parent directory node and the file name of the file to be restored as the file node where the file to be restored is located from the target hierarchical linked list according to the directory identifier of the parent directory node and the file name of the file to be restored.
Optionally, the determining module is specifically configured to traverse the index tree if the directory path information is not found, and find a first-level directory node of the file to be restored according to the full path information of the file to be restored;
Determining all directory nodes of the file to be restored from the target hierarchical linked list according to the directory identification of the first-level directory node and the directory name of at least one lower-level directory node of the first-level directory node, and generating directory path information of the file to be restored;
Determining the directory identification of the father directory node of the file node where the file to be restored is located according to the directory path information;
And determining the file node matched with the directory identifier of the parent directory node and the file name of the file to be restored as the file node where the file to be restored is located from the target hierarchical linked list according to the directory identifier of the parent directory node and the file name of the file to be restored.
Optionally, the updating module is specifically configured to update the usage status of the file node from the second status to the first status.
Optionally, the determining module is specifically configured to traverse and find all sub-directory nodes under the directory nodes to be restored in the index tree according to the directory nodes to be restored of the file to be restored;
Determining all file nodes matched with the directory identifications of the sub-directory nodes from the target hierarchical linked list according to the directory identifications of the sub-directory nodes;
and determining file nodes with file creation time meeting the creation time information from all the file nodes according to the creation time information of the file to be restored.
Optionally, the updating module is specifically configured to update the usage state of the file node and the usage state of the directory node associated with the file node from the second state to the first state.
In a third aspect, an embodiment of the present application provides an electronic device, including: a processor, a storage medium, and a bus, the storage medium storing machine-readable instructions executable by the processor, the processor and the storage medium communicating over the bus when the electronic device is operating, the processor executing the machine-readable instructions to perform the steps of the file recovery method as provided in the first aspect when executed.
In a fourth aspect, an embodiment of the present application provides a storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the file restoration method as provided in the first aspect.
The beneficial effects of the application are as follows:
The application provides a file recovery method, a device, electronic equipment and a storage medium, wherein the method comprises the following steps: acquiring attribute information of a file to be restored, wherein the attribute information comprises at least one of the following items: full path information of the file to be restored, directory nodes to be restored of the file to be restored and creation time information of the file to be restored; determining a file node where the file to be restored is located from a target hierarchical linked list according to attribute information of the file to be restored and a pre-created index tree; the target hierarchical linked list is generated according to the information of all directory nodes of the deleted files and the information of the file nodes in the file system to which the files to be restored belong, and the index tree is used for indicating the index relation between all directory nodes and the file nodes in the file system; determining the position information of the file node in the disk according to the mapping relation between the file node and the file index unit, and updating the use state of the file node; the mapping relation between the file nodes and the file index unit is determined based on the structure of the file system. According to the method, based on attribute information of the file to be restored, directory paths of the file to be restored are searched from a pre-established index tree, file nodes where the file to be restored is located are determined from a hierarchical linked list based on the searched directory paths, and the use state of the file nodes is improved. The index tree is used for searching the file node where the file to be restored is located, and the index tree is used for storing index relations of the directory node and the file node, so that the directory path of the file to be restored can be quickly and accurately searched, and the information of all the deleted directory nodes and the file node in the hierarchical linked list is used for generating the file node where the file to be restored is located, and the file node where the file to be restored is located can be quickly found in the hierarchical linked list, thereby realizing quick restoration of the file and ensuring the integrity of a file system.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the embodiments will be briefly described below, it being understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and other related drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic diagram of a file system according to an embodiment of the present application;
FIG. 2 is a schematic flow chart of a file recovery method according to an embodiment of the present application;
FIG. 3 is a flowchart illustrating another method for recovering files according to an embodiment of the present application;
FIG. 4 is a schematic diagram of an index tree according to an embodiment of the present application;
FIG. 5 is a flowchart illustrating another method for recovering files according to an embodiment of the present application;
FIG. 6 is a flowchart illustrating another method for recovering files according to an embodiment of the present application;
FIG. 7 is a schematic diagram of searching a file node where a file to be restored is located according to an embodiment of the present application;
FIG. 8 is a flowchart illustrating another method for recovering files according to an embodiment of the present application;
FIG. 9 is a schematic diagram of a file recovery device according to an embodiment of the present application;
fig. 10 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present application more apparent, the technical solutions of the embodiments of the present application will be clearly and completely described with reference to the accompanying drawings in the embodiments of the present application, and it should be understood that the drawings in the present application are for the purpose of illustration and description only and are not intended to limit the scope of the present application. In addition, it should be understood that the schematic drawings are not drawn to scale. A flowchart, as used in this disclosure, illustrates operations implemented according to some embodiments of the present application. It should be understood that the operations of the flow diagrams may be implemented out of order and that steps without logical context may be performed in reverse order or concurrently. Moreover, one or more other operations may be added to or removed from the flow diagrams by those skilled in the art under the direction of the present disclosure.
In addition, the described embodiments are only some, but not all, embodiments of the application. The components of the embodiments of the present application generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the application, as presented in the figures, is not intended to limit the scope of the application, as claimed, but is merely representative of selected embodiments of the application. All other embodiments, which can be made by a person skilled in the art without making any inventive effort, are intended to be within the scope of the present application.
It should be noted that the term "comprising" will be used in embodiments of the application to indicate the presence of the features stated hereafter, but not to exclude the addition of other features.
Fig. 1 is a schematic diagram of a file system structure according to an embodiment of the present application, and the file recovery method provided by the present application may be implemented based on the file system shown in fig. 1. The file system of the application performs structural division on disk space during initialization. The disk space of the file system includes: each block group may include two index areas and a data area, wherein the size of the reserved area may be 4M, the size of each super block may be 4K, and the size of each block group may be 256g+2m.
Alternatively, each chunk may include a primary index region and a backup index region, where one primary index region or one backup index region may each be referred to as a chunk index GInode, each 1M in size, and one primary index region or one backup index region may be further subdivided into 64 sub-unit indices (SInode), each sub-unit index being 16K, where one sub-index unit may include: index log record 4K, directory index unit 4K, and file index unit 8K. The index log record has an index check value recorded therein, and one target index unit may include a plurality of directory nodes, each of which is 128B, and one file index unit may include a plurality of file nodes, each of which is 128B.
The main index area and the standby index area are respectively positioned at two ends of the block group, and a data area is arranged between the main index area and the standby index area. Each data area includes a plurality of data blocks, as shown in fig. 1, and one data area may include 64 data blocks, and each data block may have a size of 64M.
In addition, the main/standby index area comprises an index log record, a catalog index unit and a file index unit respectively, wherein the index log record of the index area is used for recording index log information, and the log information can comprise an index check code, index updating time and times, log information and the like; the directory index unit and the file index unit are index units that record directory attributes and file attributes, respectively. The index check value may be 4K, the directory index unit may be 4K, and the file index unit may be 8K. The directory index unit comprises 32 directory nodes, the size of each directory node can be 128B, the file index unit comprises 64 file nodes, the size of each file node can be 128B, and the number of the file nodes corresponds to the number of the data blocks one by one.
The super block is used for recording the whole information of the whole file system, including the signature of the file system, the creation time of the system, the last writing time, the access times, the number of index units, the number of block groups, the size of data blocks, the size of index units, a universal unique identification code (Universally Unique Identifier, UUID) and the formatting state. The super blocks are divided into main and standby super blocks, and the main and standby relationship is used for improving the reliability of the system through the recovery of data of another super block when the information of one super block is abnormal.
It should be noted that, the above-mentioned reserved area, super block size and unit block group size are only one alternative allocation method, and specifically may not be limited to the above-mentioned, and may be appropriately adjusted according to practical situations.
In addition, the index area is a key area of the file system, and the index log record is used for recording index log information, which may include an index check value. The information for each directory node may include at least one of: directory name, usage status, hierarchy, parent directory identification (parent directory ID), directory identification (directory ID), directory creation time, and modification time; the information for each file node may include at least one of: file name, usage status, hierarchy, parent directory identification, file creation time and modification time, file fragment number and size.
It should be noted that the number of the block groups divided by the disk, the number of the index areas included in each block group, the size of the index areas, the size of the data areas, the number of the data blocks included in the data areas, and the size of each data block may be one possible example, which is not limited by the present application.
Having clearly described the structure of the file system, the method of the present application will now be described by way of a number of specific embodiments.
FIG. 2 is a schematic flow chart of a file recovery method according to an embodiment of the present application; as shown in fig. 2, the method may include:
s201, acquiring attribute information of a file to be restored, wherein the attribute information comprises at least one of the following items: full path information of the file to be restored, directory nodes to be restored of the file to be restored, and creation time information of the file to be restored.
In general, in the loading process of the file system, all index areas of the file system are read, all directory nodes (DNode) and file nodes (FNode) included in the index areas are analyzed, if the use state of the directory nodes or the file nodes is 1, and the use state of the directory nodes or the file nodes is 1, that is, the node is used, information stored in the directory nodes and information stored in the file nodes and positions (locations) of index units of the directory nodes and the file nodes corresponding to disks are stored in a hierarchy link table according to the hierarchy of the directory nodes or the file nodes, wherein each hierarchy uses a link table, after all analysis and storage are completed, the hierarchy link table is analyzed step by step, an index tree is assembled according to a father directory identifier relation stored in each node, and directory or file addition and deletion of the file system are realized based on the index tree.
When the file stored in the file system is deleted by mistake, the file needs to be recovered in time so as to ensure the normal use of the file system. In one implementation, the attribute information of the file to be restored, which is input by the user, may be input through a user interface capable of providing a file restoring function.
In the present embodiment, the attribute information may include, but is not limited to: full path information of the file to be restored, directory nodes to be restored of the file to be restored, and creation time information of the file to be restored. The full path information of the file to be restored consists of all levels of catalogues where the file to be restored is located and the file, and represents the upper and lower cascade relation between all levels of catalogues of the file to be restored and the file. For example, the full path information of the file to be restored is: "/video/dir1/file1", which characterizes the file to be restored file1 as stored under the subdirectory dir1 of the primary directory video.
The node of the directory to be restored of the file to be restored may refer to any directory in the directories of the levels where the file to be restored is located. The creation time information of the file to be restored refers to the time when the file to be restored is created and stored in the file system.
S202, determining the file node where the file to be restored is located from the target hierarchical linked list according to the attribute information of the file to be restored and the index tree created in advance.
The target hierarchical linked list is generated according to the information of all directory nodes of the deleted files and the information of the file nodes in the file system to which the files to be restored belong, and the index tree is used for indicating the index relation of all directory nodes and the file nodes in the file system.
Optionally, searching for a directory path of the file to be restored from a pre-created index tree based on the acquired attribute information of the file to be restored, and determining a file node where the file to be restored is located based on the searched directory path in combination with the hierarchical linked list.
The application can search based on one or more kinds of information in the acquired attribute information respectively. Specifically, one or more kinds of attribute information can be obtained according to the recovery requirement of the file to be recovered.
In some embodiments, after information of directory nodes and file nodes in all index areas in the file system is read in the process of loading the file system, all directory nodes and file nodes with names and use states of 0 are saved into a hierarchical linked list according to the hierarchy, and the index information and the position information corresponding to the directory nodes and the file nodes in the disk are saved into the hierarchical linked list to generate a target hierarchical linked list. Wherein, the use state is 0, that is, the node is not used, the node is deleted, specifically, the use state of the directory node is 0, which means that the directory where the file is located is deleted, and the use state of the file node is 0, which means that the file is deleted.
Optionally, based on the generated target hierarchical link list, the determination of the file node is directly performed in the target hierarchical link list, and since the target hierarchical link list only contains the deleted directory node or the deleted file node information, the determination efficiency of the file node of the file to be restored can be greatly improved, and the large time consumption generated when searching is performed in the full hierarchical link list completely comprising the information of all the file nodes and the directory node information is avoided.
S203, according to the mapping relation between the file node and the file index unit, determining the position information of the file node in the disk, and updating the use state of the file node.
The mapping relation between the file nodes and the file index unit is determined based on the structure of the file system.
In some embodiments, based on the file system structure in fig. 1, mapping relations among index units, file nodes and directory nodes in the file system are fixed, in the process of loading the file system, mapping relations between file nodes and file index units are determined, position information of the file nodes in a disk can be directly read, and the read position information of the file nodes in the disk can be stored in the target hierarchical linked list.
Optionally, updating the use state corresponding to the file node in the disk according to the determined position of the file node in the disk, where the file to be restored is located, so as to restore the file to be restored.
In summary, the file recovery method provided in this embodiment includes: acquiring attribute information of a file to be restored, wherein the attribute information comprises at least one of the following items: full path information of the file to be restored, directory nodes to be restored of the file to be restored and creation time information of the file to be restored; determining a file node where the file to be restored is located from a target hierarchical linked list according to attribute information of the file to be restored and a pre-created index tree; the target hierarchical linked list is generated according to the information of all directory nodes of the deleted files and the information of the file nodes in the file system to which the files to be restored belong, and the index tree is used for indicating the index relation between all directory nodes and the file nodes in the file system; determining the position information of the file node in the disk according to the mapping relation between the file node and the file index unit, and updating the use state of the file node; the mapping relation between the file nodes and the file index unit is determined based on the structure of the file system. According to the method, based on attribute information of the file to be restored, directory paths of the file to be restored are searched from a pre-established index tree, file nodes where the file to be restored is located are determined from a hierarchical linked list based on the searched directory paths, and the use state of the file nodes is improved. The index tree is used for searching the file node where the file to be restored is located, and the index tree is used for storing index relations of the directory node and the file node, so that the directory path of the file to be restored can be quickly and accurately searched, and the information of all the deleted directory nodes and the file node in the hierarchical linked list is used for generating the file node where the file to be restored is located, and the file node where the file to be restored is located can be quickly found in the hierarchical linked list, thereby realizing quick restoration of the file and ensuring the integrity of a file system.
FIG. 3 is a flowchart illustrating another method for recovering files according to an embodiment of the present application; optionally, in step S202, before determining the file node where the file to be restored is located from the target hierarchical linked list according to the attribute information of the file to be restored and the index tree created in advance, the method of the present application may further include:
S301, loading index areas of a file system from a disk, and reading information of all directory nodes and information of all file nodes.
Wherein the index area includes: the system comprises a plurality of index units, a plurality of storage units and a plurality of storage units, wherein each index unit comprises an index check value, a plurality of directory nodes and a plurality of file nodes; the information for each directory node includes at least one of: directory name, usage status, hierarchy, parent directory identification, directory creation time, and modification time; the information of each file node includes at least one of: file name, usage status, hierarchy, parent directory identification, file creation time and modification time, file fragment number and size.
Optionally, the structure of the index area in the file system to which the present solution is applied is described in detail in the foregoing embodiments, which is not described in detail herein.
It should be explained that, the usage states in the information of the target node and the file node may include a first state and a second state, where the first state may be 1, which indicates that the node is used, and the second state may be 0, which indicates that the node is not used. The hierarchy is the hierarchy in which the finger node is located. The parent directory identification refers to the ID of the previous level node of the current node, for example: if directory 1 is identified as 1000, directory 2 subordinate to directory 1 is identified as 1001, directory 3 subordinate to directory 2 is identified as 1002, then it may be determined that directory 3 parent is identified as 1001, and directory 2 parent is identified as 1000. And the directory identifier refers to the ID of the current node.
In some embodiments, all information contained in the file system, including information of the index area of the data area, etc., is obtained in a process of loading the file system, i.e., parsing the file system. By loading the index area of the file system, all information contained in the index area can be read, including information of all file nodes under the file index unit and information of all directory nodes under the directory index unit.
S302, storing the information of the directory node and the information of the file node with the use states of the directory node and the file node in the hierarchical linked list.
The current use state of the directory node can be determined through the use state in the information of the directory node, and the current use state of the file node can be determined according to the use state in the information of the file node. Alternatively, according to the read usage states of each file node and directory node, the information of the directory node with the usage state being the first state and the information of the file node are saved into the hierarchical linked list, that is, the information of all file nodes with the usage state being 1 (used and not deleted) and the information of the directory node are saved into the hierarchical linked list.
The information of each file node and each directory node may be respectively stored in a corresponding hierarchy in the hierarchy linked list according to the hierarchy of each file node and the hierarchy of each directory node.
S303, analyzing the hierarchical linked list layer by layer, and creating an index tree according to the connection relation of the father directory identification.
Alternatively, the hierarchical linked list may be parsed layer by layer, and the index tree may be constructed according to the parent directory identification relationships of each directory node and file node.
Fig. 4 is a schematic structural diagram of an index tree according to an embodiment of the present application, and it is assumed that the above hierarchical linked list is as follows:
Then, based on the information of each file node and directory node in the hierarchical linked list, the first layer of the index tree can be known to include directory node 1, directory node 2 and directory node 3 according to the relationship of the father directory identifier of each node, and the second layer includes: the node of the upper level of the directory node 5 is the directory node 2, the node of the upper level of the directory node 6 is the directory node 1, the node of the upper level of the directory node 7 is the directory node 3, the node of the upper level of the directory node 8 is the directory node 2, and the index tree third layer comprises: file node 1, file node 2, file node 3, file node 4. The upper node of the file node 1 is a directory node 7, the upper node of the file node 2 is a directory node 8, the upper node of the file node 3 is a directory node 5, and the upper node of the file node 4 is a directory node 6. Based on this, an index tree as shown in fig. 4 can be constructed.
It should be noted that, the index tree obtained by construction clearly expresses the index relationship between each directory node and the file node, and operations such as adding, deleting, checking, modifying, etc. of the file or the directory can be performed according to the index tree.
FIG. 5 is a flowchart illustrating another method for recovering files according to an embodiment of the present application; optionally, in step S202, determining, from the target hierarchical linked list, a file node where the file to be restored is located according to attribute information of the file to be restored and the index tree created in advance, may include:
S501, searching directory path information of the file to be restored in an index tree according to the full path information of the file to be restored, wherein the directory path information represents the index relation of each directory node of the file to be restored.
Assume that the full path of the file to be restored is "/video/dir1/file1", wherein the file1 is deleted by mistake. The "/video/dir1" is found in the index tree according to the full path "/video/dir1/file1" and the identification of directory node dir1 is read as 1001.
S502, if the directory path information is found, determining the directory identification of the father directory node of the file node where the file to be restored is located according to the directory path information.
In some embodiments, if the file to be restored is only deleted by mistake, that is, the file1 is deleted by mistake, and the directory is still complete, then according to the full path information of the file to be restored, the directory path information can be found in the index tree, that is, the/video/dir 1 can be found.
Based on the searched directory path information, it may be determined that the parent directory node of the file node where the file1 to be restored is located is directory node 1, where the node name of the directory node 1 is dir1, and the directory identifier is 1001.
S503, determining the file node matched with the directory identifier of the parent directory node and the file name of the file to be restored as the file node of the file to be restored from the target hierarchical linked list according to the directory identifier of the parent directory node and the file name of the file to be restored.
Similarly, file nodes with file names of "file1" and parent directory identification of 1001 are searched in the third layer of the target hierarchical linked list, and if the file nodes are the file node 1 and the file node 2, the file node where the file to be restored is located can be determined to be the file node 1 and the file node 2.
The file nodes where the file to be restored is located are file node 1 and file node 2, that is, file information representing the file1 to be restored is stored in the file node 1 and the file node 2 respectively, and the file node 1 and the file node 2 store part of information of the file1 respectively. The specific content recorded in the file1 to be restored is respectively stored in the data blocks corresponding to the file node 1 and the file node 2.
FIG. 6 is a flowchart illustrating another method for recovering files according to an embodiment of the present application; fig. 7 is a schematic diagram of searching a file node where a file to be restored is located according to an embodiment of the present application. Optionally, in step S501, after searching the directory path information of the file to be restored in the index tree according to the full path information of the file to be restored, the method of the present application may further include:
S601, if the directory path information is not found, traversing an index tree, and finding a first-stage directory node of the file to be restored according to the full path information of the file to be restored.
In other embodiments, if part of the directory and the file of the file to be restored are deleted by mistake, that is, dir1/file1 in the full path "/video/dir1/file1" is deleted, because the directory is missing, according to the full path information of the file to be restored, the directory path information cannot be found in the index tree, that is, the directory path information cannot be found.
In this case, the index tree may be traversed, looking forward step by step in the index tree, finding the most recently matching directory level, i.e., finding the first level directory node named video, i.e., directory node 1 as shown in FIG. 7.
S602, determining all directory nodes of the file to be restored from the target hierarchical linked list according to the directory identification of the first-level directory node and the directory name of at least one lower-level directory node of the first-level directory node, and generating directory path information of the file to be restored.
Based on the searched directory node 1, it may be determined that the directory identifier of the directory node 1 is 1000, and then, according to the directory identifier 1000, the directory node 2 with the name dir1 and the parent directory identifier of 1000 may be searched in the second layer of the target hierarchical linked list.
S603, determining the directory identification of the father directory node of the file node where the file to be restored is located according to the directory path information.
Alternatively, as shown in fig. 7, it is known that the target identifier of the directory node 2 is 1001, and then it may be determined that the directory identifier of the parent directory node of the file node where the file1 to be restored is located is 1001, that is, the parent directory identifier of the file node where the file to be restored is located is 1001.
S604, determining the file node matched with the directory identifier of the parent directory node and the file name of the file to be restored as the file node of the file to be restored from the target hierarchical linked list according to the directory identifier of the parent directory node and the file name of the file to be restored.
As shown in fig. 7, the parent directory identifications of the file node 1 and the file node 2 are 1001, and the file names are file1. Based on the determined parent directory identifier 1001 and the file name file1 of the file to be restored, it may be determined from the target hierarchical linked list that the file node where the file to be restored is located includes the file node 1 and the file node 2, respectively.
Further, as shown in fig. 7, the positions of the file node 1 and the file node 2 in the disk may be determined according to the mapping relationship between the file node 1 and the file node 2 and the file index unit.
Optionally, in step S203, updating the usage status of the file node may include: and updating the use state of the file node from the second state to the first state.
In one implementation manner, when a file is deleted by mistake, the use state of the file node where the file is located is updated from the first state to the second state, that is, from the use state 1 to the use state 0, which indicates that the current file is deleted and the file node is in an unused state, and when the file is restored, the determined use state of the file node where the file to be restored is located can be updated from the second state to the first state, that is, from the use state 0 to the use state 1, so that the file restoration can be realized.
FIG. 8 is a flowchart illustrating another method for recovering files according to an embodiment of the present application; optionally, as shown in fig. 8, in step S202, determining, from the target hierarchical linked list, a file node where the file to be restored is located according to attribute information of the file to be restored and the index tree created in advance, may include:
S801, traversing and searching all sub-directory nodes under the directory nodes to be restored in an index tree according to the directory nodes to be restored of the file to be restored.
The foregoing embodiment has been described with respect to the case where restoration is performed after a single file is deleted. The embodiment aims at the recovery of the wrongly deleted file in the time period of the file to be recovered under the appointed directory.
In some embodiments, taking the full path of the file to be restored as "/video/dir1/file1" as an example, assuming that the directory node to be restored of the file to be restored is a directory node with a directory name of video, the directory node to be restored of the file to be restored may be found in the index tree, and all sub-directory nodes under the directory node to be restored may be traversed in the index tree first. The child directory node is assumed to include a directory node with directory name dir 1.
S802, according to the directory identifications of all the subdirectory nodes, determining all the file nodes matched with the directory identifications of all the subdirectory nodes from the target hierarchical linked list.
If the child directory node includes only directory node 1, whose directory identification is 1001, then all file nodes whose parent directory identification is 1001 may be looked up from the target hierarchical linked list.
In some cases, the above-determined child directory nodes may also include a plurality of the child directory nodes, and assuming that the child directory nodes include directory node 1, directory node 2, and directory node 3, the directory of directory node 1 is identified as 1001, the directory of directory node 2 is identified as 1002, and the directory of directory node 3 is identified as 1003, all the file nodes with the parent directory identified as 1001, all the file nodes with the parent directory identified as 1002, and all the file nodes with the parent directory identified as 1003 may be searched from the target hierarchical linked list.
S803, determining file nodes with file creation time meeting the creation time information from all file nodes according to the creation time information of the file to be restored.
Optionally, according to the file creation time recorded in the information of all the file nodes, determining the file node whose file creation time satisfies the creation time information of the file to be restored. The creation time information of the file to be restored can indicate the time period to be restored, namely, the file to be restored in the time period to be restored under the appointed directory is restored.
Optionally, in step S203, updating the usage status of the file node may include: the usage status of the file node and the usage status of the directory node associated with the file node are updated from the second status to the first status.
And aiming at the recovery of the file in the time period to be recovered under the specified directory, after the file node to be recovered is determined, updating the use states of the file node and the directory node associated with the file node. Wherein, the directory node associated with the file node refers to the upper directory node of the file node. Referring to fig. 4, assuming that the file node is 3, the directory node associated with the file node 3 may be the directory node 5.
Also, the usage status of the determined file node and the directory node associated with the file node may be updated from the second status to the first status.
In summary, the file recovery method provided in this embodiment includes: acquiring attribute information of a file to be restored, wherein the attribute information comprises at least one of the following items: full path information of the file to be restored, directory nodes to be restored of the file to be restored and creation time information of the file to be restored; determining a file node where the file to be restored is located from a target hierarchical linked list according to attribute information of the file to be restored and a pre-created index tree; the target hierarchical linked list is generated according to the information of all directory nodes of the deleted files and the information of the file nodes in the file system to which the files to be restored belong, and the index tree is used for indicating the index relation between all directory nodes and the file nodes in the file system; determining the position information of the file node in the disk according to the mapping relation between the file node and the file index unit, and updating the use state of the file node; the mapping relation between the file nodes and the file index unit is determined based on the structure of the file system. According to the method, based on attribute information of the file to be restored, directory paths of the file to be restored are searched from a pre-established index tree, file nodes where the file to be restored is located are determined from a hierarchical linked list based on the searched directory paths, and the use state of the file nodes is improved. The index tree is used for searching the file node where the file to be restored is located, and the index tree is used for storing index relations of the directory node and the file node, so that the directory path of the file to be restored can be quickly and accurately searched, and the information of all the deleted directory nodes and the file node in the hierarchical linked list is used for generating the file node where the file to be restored is located, and the file node where the file to be restored is located can be quickly found in the hierarchical linked list, thereby realizing quick restoration of the file and ensuring the integrity of a file system.
The following describes a device, equipment, storage medium, etc. for executing the file recovery method provided by the present application, and specific implementation processes and technical effects thereof are referred to above, and are not described in detail below.
Fig. 9 is a schematic diagram of a file restoring apparatus according to an embodiment of the present application, where functions implemented by the file restoring apparatus correspond to steps executed by the method. The apparatus may be understood as a server, or a processor of a server, or as a component, which is independent from the server or the processor and performs the functions of the present application under the control of the server, as shown in fig. 9, and may include: an acquisition module 910, a determination module 920, an update module 930;
the obtaining module 910 is configured to obtain attribute information of a file to be restored, where the attribute information includes at least one of the following: full path information of the file to be restored, directory nodes to be restored of the file to be restored and creation time information of the file to be restored;
The determining module 920 is configured to determine, according to attribute information of a file to be restored and an index tree created in advance, a file node where the file to be restored is located from a target hierarchical linked list, where the target hierarchical linked list is generated according to information of directory nodes of all deleted files and information of the file nodes in a file system to which the file to be restored belongs, and the index tree is used to indicate index relationships between all directory nodes and the file nodes in the file system;
the updating module 930 is configured to determine location information of the file node in the disk according to a mapping relationship between the file node and the file index unit, and update a usage state of the file node, where the mapping relationship between the file node and the file index unit is determined based on a structure of the file system.
Optionally, the apparatus may further include: the device comprises a reading module, a storage module and a creation module;
The reading module is used for loading an index area of the file system from the disk, reading information of all directory nodes and information of all file nodes, wherein the index area comprises: the system comprises a plurality of index units, a plurality of storage units and a plurality of storage units, wherein each index unit comprises an index check value, a plurality of directory nodes and a plurality of file nodes; the information for each directory node includes at least one of: directory name, usage status, hierarchy, parent directory identification, directory creation time, and modification time; the information of each file node includes at least one of: file name, usage status, hierarchy, parent directory identification, file creation time and modification time, file fragment number and size;
the storage module is used for storing the information of the directory node and the information of the file node with the use state being the first state into the hierarchical linked list;
And the creation module is used for analyzing the hierarchical linked list layer by layer and creating an index tree according to the connection relation of the father directory identification.
Optionally, the determining module 920 is specifically configured to search, in the index tree, directory path information of the file to be restored according to full path information of the file to be restored, where the directory path information characterizes an index relationship of each directory node of the file to be restored;
If the directory path information is found, determining the directory identification of the father directory node of the file node where the file to be restored is located according to the directory path information;
And determining the file node matched with the directory identifier of the parent directory node and the file name of the file to be restored as the file node where the file to be restored is located from the target hierarchical linked list according to the directory identifier of the parent directory node and the file name of the file to be restored.
Optionally, the determining module is specifically configured to traverse the index tree if the directory path information is not found, and find a first-stage directory node of the file to be restored according to the full path information of the file to be restored;
Determining all directory nodes of the file to be restored from the target hierarchical linked list according to the directory identification of the first-level directory node and the directory name of at least one lower-level directory node of the first-level directory node, and generating directory path information of the file to be restored;
determining the directory identification of a parent directory node of the file node where the file to be restored is located according to the directory path information;
And determining the file node matched with the directory identifier of the parent directory node and the file name of the file to be restored as the file node where the file to be restored is located from the target hierarchical linked list according to the directory identifier of the parent directory node and the file name of the file to be restored.
Optionally, the updating module 930 is specifically configured to update the usage status of the file node from the second status to the first status.
Optionally, the determining module 920 is specifically configured to traverse and find all sub-directory nodes under the directory nodes to be restored in the index tree according to the directory nodes to be restored of the file to be restored;
Determining all file nodes matched with the directory identifications of the sub-directory nodes from the target hierarchical linked list according to the directory identifications of the sub-directory nodes;
And determining file nodes with file creation time meeting the creation time information from all the file nodes according to the creation time information of the file to be restored.
Optionally, the updating module 930 is specifically configured to update the usage status of the file node and the usage status of the directory node associated with the file node from the second status to the first status.
The foregoing apparatus is used for executing the method provided in the foregoing embodiment, and its implementation principle and technical effects are similar, and are not described herein again.
The above modules may be one or more integrated circuits configured to implement the above methods, for example: one or more Application SPECIFIC INTEGRATED Circuits (ASIC), or one or more microprocessors (DIGITAL SINGNAL processor, DSP), or one or more field programmable gate arrays (Field Programmable GATE ARRAY, FPGA), etc. For another example, when a module above is implemented in the form of a processing element scheduler code, the processing element may be a general-purpose processor, such as a central processing unit (Central Processing Unit, CPU) or other processor that may invoke the program code. For another example, the modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).
The modules may be connected or communicate with each other via wired or wireless connections. The wired connection may include a metal cable, optical cable, hybrid cable, or the like, or any combination thereof. The wireless connection may include a connection through a LAN, WAN, bluetooth, zigBee, or NFC, or any combination thereof. Two or more modules may be combined into a single module, and any one module may be divided into two or more units. It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described system and apparatus may refer to corresponding procedures in the method embodiments, and are not repeated in the present disclosure.
Fig. 10 is a schematic structural diagram of an electronic device according to an embodiment of the present application, where the device may be a computing device with a data processing function.
The apparatus may include: a processor 801, and a memory 802.
The memory 802 is used for storing a program, and the processor 801 calls the program stored in the memory 802 to execute the above-described method embodiment. The specific implementation manner and the technical effect are similar, and are not repeated here.
Therein, the memory 802 stores program code that, when executed by the processor 801, causes the processor 801 to perform various steps in the file recovery method according to various exemplary embodiments of the present application described in the above section of the "exemplary method" of the present specification.
The Processor 801 may be a general purpose Processor such as a Central Processing Unit (CPU), digital signal Processor (DIGITAL SIGNAL Processor, DSP), application SPECIFIC INTEGRATED Circuit (ASIC), field programmable gate array (Field Programmable GATE ARRAY, FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or may implement or perform the methods, steps, and logic blocks disclosed in embodiments of the application. The general purpose processor may be a microprocessor or any conventional processor or the like. The steps of a method disclosed in connection with the embodiments of the present application may be embodied directly in a hardware processor for execution, or in a combination of hardware and software modules in the processor for execution.
Memory 802, as a non-volatile computer-readable storage medium, may be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. The Memory may include at least one type of storage medium, which may include, for example, flash Memory, hard disk, multimedia card, card Memory, random access Memory (Random Access Memory, RAM), static random access Memory (Static Random Access Memory, SRAM), programmable Read-Only Memory (Programmable Read Only Memory, PROM), read-Only Memory (ROM), charged erasable programmable Read-Only Memory (ELECTRICALLY ERASABLE PROGRAMMABLE READ-Only Memory, EEPROM), magnetic Memory, magnetic disk, optical disk, and the like. The memory is any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer, but is not limited to such. The memory 802 of embodiments of the present application may also be circuitry or any other device capable of performing storage functions for storing program instructions and/or data.
Optionally, the present application also provides a program product, such as a computer readable storage medium, comprising a program for performing the above-described method embodiments when being executed by a processor.
In the several embodiments provided by the present application, it should be understood that the disclosed apparatus and method may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of the units is merely a logical function division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in hardware plus software functional units.
The integrated units implemented in the form of software functional units described above may be stored in a computer readable storage medium. The software functional unit is stored in a storage medium, and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor (english: processor) to perform some of the steps of the methods according to the embodiments of the application. And the aforementioned storage medium includes: u disk, mobile hard disk, read-Only Memory (ROM), random access Memory (Random Access Memory, RAM), magnetic disk or optical disk, etc.

Claims (8)

1. A method for recovering a file, comprising:
Acquiring attribute information of a file to be restored, wherein the attribute information comprises at least one of the following items: the method comprises the steps of full path information of a file to be restored, a directory node to be restored of the file to be restored and creation time information of the file to be restored;
Determining a file node where the file to be restored is located from a target hierarchical linked list according to attribute information of the file to be restored and a pre-created index tree, wherein the target hierarchical linked list is generated according to information of directory nodes and information of file nodes of all deleted files in a file system to which the file to be restored belongs, and the index tree is used for indicating index relations of all directory nodes and file nodes in the file system;
Determining the position information of the file node in a disk according to the mapping relation between the file node and the file index unit, and updating the use state of the file node, wherein the mapping relation between the file node and the file index unit is determined based on the structure of the file system;
The determining the file node of the file to be restored from the target hierarchical linked list according to the attribute information of the file to be restored and the index tree created in advance comprises the following steps:
Searching directory path information of the file to be restored in the index tree according to the full path information of the file to be restored, wherein the directory path information represents the index relation of each directory node of the file to be restored;
if the directory path information is found, determining the directory identification of the father directory node of the file node where the file to be restored is located according to the directory path information;
Determining a file node matched with the directory identifier of the parent directory node and the file name of the file to be restored as the file node of the file to be restored from the target hierarchical linked list according to the directory identifier of the parent directory node and the file name of the file to be restored;
according to the full path information of the file to be restored, after searching the directory path information of the file to be restored in the index tree, the method further comprises the following steps:
If the directory path information is not found, traversing the index tree, and searching a first-stage directory node of the file to be restored according to the full path information of the file to be restored;
Determining all directory nodes of the file to be restored from the target hierarchical linked list according to the directory identification of the first-level directory node and the directory name of at least one lower-level directory node of the first-level directory node, and generating directory path information of the file to be restored;
Determining the directory identification of the father directory node of the file node where the file to be restored is located according to the directory path information;
And determining the file node matched with the directory identifier of the parent directory node and the file name of the file to be restored as the file node where the file to be restored is located from the target hierarchical linked list according to the directory identifier of the parent directory node and the file name of the file to be restored.
2. The method according to claim 1, wherein before determining a file node where the file to be restored is located from a target hierarchical linked list according to attribute information of the file to be restored and a pre-created index tree, the method includes:
Loading an index area of the file system from a disk, and reading information of all directory nodes and information of all file nodes, wherein the index area comprises: the system comprises a plurality of index units, a plurality of storage units and a plurality of storage units, wherein each index unit comprises an index check value, a plurality of directory nodes and a plurality of file nodes; the information for each directory node includes at least one of: directory name, usage status, hierarchy, parent directory identification, directory creation time, and modification time; the information of each file node includes at least one of: file name, usage status, hierarchy, parent directory identification, file creation time and modification time, file fragment number and size;
Storing the information of the directory node with the use state of the first state and the information of the file node into a hierarchical linked list;
And analyzing the hierarchical linked list layer by layer, and creating the index tree according to the connection relation of the father directory identifier.
3. The method of claim 1, wherein updating the usage status of the file node comprises:
And updating the using state of the file node from the second state to the first state.
4. The method according to claim 2, wherein the determining, from the target hierarchical linked list, the file node where the file to be restored is located according to the attribute information of the file to be restored and the index tree created in advance includes:
According to the directory nodes to be restored of the files to be restored, traversing and searching all sub-directory nodes under the directory nodes to be restored in the index tree;
Determining all file nodes matched with the directory identifications of the sub-directory nodes from the target hierarchical linked list according to the directory identifications of the sub-directory nodes;
and determining file nodes with file creation time meeting the creation time information from all the file nodes according to the creation time information of the file to be restored.
5. The method of claim 4, wherein updating the usage status of the file node comprises:
And updating the use state of the file node and the use state of the directory node associated with the file node from the second state to the first state.
6. A document retrieval apparatus, comprising: the device comprises an acquisition module, a determination module and an update module;
The obtaining module is configured to obtain attribute information of a file to be restored, where the attribute information includes at least one of the following: the method comprises the steps of full path information of a file to be restored, a directory node to be restored of the file to be restored and creation time information of the file to be restored;
the determining module is configured to determine, according to attribute information of the file to be restored and a pre-created index tree, a file node where the file to be restored is located from a target hierarchical linked list, where the target hierarchical linked list is generated according to information of directory nodes of all deleted files and information of file nodes in a file system to which the file to be restored belongs, and the index tree is used to indicate index relationships between all directory nodes and file nodes in the file system;
The updating module is used for determining the position information of the file node in a disk according to the mapping relation between the file node and the file index unit and updating the use state of the file node, wherein the mapping relation between the file node and the file index unit is determined based on the structure of the file system;
The determining module is specifically configured to search, according to the full path information of the file to be restored, directory path information of the file to be restored in the index tree, where the directory path information characterizes an index relationship of each directory node of the file to be restored;
if the directory path information is found, determining the directory identification of the father directory node of the file node where the file to be restored is located according to the directory path information;
Determining a file node matched with the directory identifier of the parent directory node and the file name of the file to be restored as the file node of the file to be restored from the target hierarchical linked list according to the directory identifier of the parent directory node and the file name of the file to be restored;
The determining module is specifically configured to traverse the index tree if the directory path information is not found, and find a first-level directory node of the file to be restored according to the full path information of the file to be restored;
Determining all directory nodes of the file to be restored from the target hierarchical linked list according to the directory identification of the first-level directory node and the directory name of at least one lower-level directory node of the first-level directory node, and generating directory path information of the file to be restored;
Determining the directory identification of the father directory node of the file node where the file to be restored is located according to the directory path information;
And determining the file node matched with the directory identifier of the parent directory node and the file name of the file to be restored as the file node where the file to be restored is located from the target hierarchical linked list according to the directory identifier of the parent directory node and the file name of the file to be restored.
7. An electronic device, comprising: a processor, a storage medium and a bus, the storage medium storing program instructions executable by the processor, the processor and the storage medium communicating via the bus when the electronic device is running, the processor executing the program instructions to perform the steps of the file recovery method according to any one of claims 1 to 5 when executed.
8. A computer-readable storage medium, characterized in that the storage medium has stored thereon a computer program which, when executed by a processor, performs the steps of the file restoration method according to any of claims 1 to 5.
CN202210350946.5A 2022-04-02 2022-04-02 File recovery method and device, electronic equipment and storage medium Active CN114625696B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210350946.5A CN114625696B (en) 2022-04-02 2022-04-02 File recovery method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210350946.5A CN114625696B (en) 2022-04-02 2022-04-02 File recovery method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN114625696A CN114625696A (en) 2022-06-14
CN114625696B true CN114625696B (en) 2024-09-27

Family

ID=81906739

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210350946.5A Active CN114625696B (en) 2022-04-02 2022-04-02 File recovery method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114625696B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115098447B (en) * 2022-07-18 2024-06-18 重庆紫光华山智安科技有限公司 File recovery method and device, electronic equipment and readable storage medium
CN115312084B (en) * 2022-07-29 2025-04-25 深圳市锐明技术股份有限公司 Disk storage system, data reading and writing method, recovery method, device and medium
CN116467037B (en) * 2023-06-09 2023-09-22 成都融见软件科技有限公司 Graphic user interface work state recovery method

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110659254A (en) * 2019-09-27 2020-01-07 浪潮电子信息产业股份有限公司 Deleted file recovery method, device, equipment and readable storage medium
CN111324483A (en) * 2018-12-13 2020-06-23 腾讯科技(深圳)有限公司 Data recovery method and device and related equipment

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7225204B2 (en) * 2002-03-19 2007-05-29 Network Appliance, Inc. System and method for asynchronous mirroring of snapshots at a destination using a purgatory directory and inode mapping
US9471595B1 (en) * 2013-09-30 2016-10-18 Emc Corporation Recovering file mapping information in file systems
CN105607960B (en) * 2015-10-26 2018-12-07 成都华为技术有限公司 File system directory tree restorative procedure and device

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111324483A (en) * 2018-12-13 2020-06-23 腾讯科技(深圳)有限公司 Data recovery method and device and related equipment
CN110659254A (en) * 2019-09-27 2020-01-07 浪潮电子信息产业股份有限公司 Deleted file recovery method, device, equipment and readable storage medium

Also Published As

Publication number Publication date
CN114625696A (en) 2022-06-14

Similar Documents

Publication Publication Date Title
CN114625696B (en) File recovery method and device, electronic equipment and storage medium
CN110018998B (en) File management method and system, electronic equipment and storage medium
US9646030B2 (en) Computer-readable medium storing program and version control method
US11494334B2 (en) Embedded reference counts for file clones
US6675180B2 (en) Data updating apparatus that performs quick restoration processing
CN109086388B (en) Block chain data storage method, device, equipment and medium
US9594674B1 (en) Method and system for garbage collection of data storage systems using live segment records
US9715505B1 (en) Method and system for maintaining persistent live segment records for garbage collection
CN110531940A (en) Video file processing method and processing device
KR100877063B1 (en) Devices and methods for managing data
US9442694B1 (en) Method for storing a dataset
US10496611B1 (en) Method and system for file name based command execution in a storage system
CN111045857A (en) Method for data backup and recovery, electronic device and computer readable storage medium
US8914327B2 (en) Methods and systems for searching a backup volume
US9619322B2 (en) Erasure-coding extents in an append-only storage system
US12169527B2 (en) Approximate nearest neighbor search engine
CN120255819A (en) File processing method and device
WO2023201002A1 (en) Implementing graph search with in-structure metadata of a graph-organized file system
US12001481B2 (en) Graph-organized file system
CN111176901B (en) HDFS deleted file recovery method, terminal device and storage medium
CN114625697B (en) File system recovery method and device, electronic equipment and storage medium
US11803511B2 (en) Methods and systems for ordering operations on a file system having a hierarchical namespace
CN117349236B (en) File reading method, device, equipment and storage medium
CN113282551B (en) Data processing method, system and equipment
CN103336811B (en) The method and apparatus for handling storage system

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