File recovery method, device, electronic device and storage medium

By obtaining file attribute information and using index trees and hierarchical linked lists to determine file node locations and update their status, the problem of accidental deletion of files in the file system is solved, and rapid file recovery and system integrity are achieved.

CN114625696BActive Publication Date: 2024-09-27CHONGQING UNISINSIGHT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210350946.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-02
Publication Date
2024-09-27
Estimated Expiration
2042-04-02

AI Technical Summary

Technical Problem

Existing technology is difficult to effectively recover accidentally deleted files in the file system, resulting in data unavailability.

Method used

By obtaining the attribute information of the file to be restored, using the pre-created index tree and hierarchical linked list, it determines the location of the file node and updates its usage status, thereby achieving rapid file recovery.

Benefits of technology

It achieves fast and accurate recovery of files and ensures the integrity of the file system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114625696B
    Figure CN114625696B
Patent Text Reader

Abstract

The present application provides a file recovery method, device, electronic device and storage medium, and relates to the field of data processing technology. The method comprises: obtaining attribute information of a file to be recovered, the attribute information comprising at least one of the following: full path information of the file to be recovered, directory node to be recovered of the file to be recovered, and creation time information of the file to be recovered; according to the attribute information of the file to be recovered and the pre-created index tree, determining the file node where the file to be recovered is located from the target hierarchical linked list; according to the mapping relationship between the file node and the file index unit, determining the location information of the file node in the disk, and updating the usage status of the file node. The method can realize the rapid recovery of files and ensure the integrity of the file system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a file recovery method, device, electronic device and storage medium. Background Art

[0002] With the rapid development of economy and technology, the amount of Internet data is also increasing, and the reliable storage of data in the file system is particularly critical. Usually, data files may be damaged or deleted by mistake during or after storage, which may cause the entire file system data to be unavailable.

[0003] Therefore, how to recover files in the file system is a problem that needs to be solved urgently. Summary of the invention

[0004] The purpose of the present application is to provide a file recovery method, device, electronic device and storage medium, so as to effectively recover accidentally deleted files and files in a specific time period under a specified directory based on a fixed file system structure.

[0005] To achieve the above purpose, the technical solution adopted in the embodiment of the present application is as follows:

[0006] In a first aspect, an embodiment of the present application provides a file recovery method, comprising:

[0007] Acquire attribute information of the file to be restored, the attribute information including at least one of the following: full path information of the 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;

[0008] According to the attribute information of the file to be restored and the pre-created index tree, the file node where the file to be restored is located is determined from the target hierarchical linked list, the target hierarchical linked list is generated according to the information of the directory nodes and the file nodes of all deleted files in the file system to which the file to be restored belongs, and the index tree is used to indicate the index relationship between all the directory nodes and the file nodes in the file system;

[0009] According to the mapping relationship between the file node and the file index unit, the location information of the file node in the disk is determined, and the use status of the file node is updated. The mapping relationship between the file node and the file index unit is determined based on the structure of the file system.

[0010] 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 pre-created index tree, the method includes:

[0011] Loading the index area of ​​the file system from the disk, reading the information of all directory nodes and all file nodes, the index area comprising: a plurality of index units, each index unit comprising an index check value, a plurality of directory nodes and a plurality of file nodes; the information of each directory node comprising at least one of the following: directory name, usage status, level, parent directory identifier, directory identifier, directory creation time and modification time; the information of each file node comprising at least one of the following: file name, usage status, level, parent directory identifier, file identifier, file creation time and modification time, file fragment number and size;

[0012] The information of the directory node and the file node whose usage state is the first state are saved in the hierarchical linked list;

[0013] The hierarchical linked list is parsed layer by layer, and the index tree is created according to the connection relationship identified by the parent directory.

[0014] Optionally, 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 a pre-created index tree includes:

[0015] According to the full path information of the file to be restored, searching the index tree for the directory path information of the file to be restored, wherein the directory path information represents the index relationship of each directory node of the file to be restored;

[0016] If the directory path information is found, the directory identifier of the parent directory node of the file node where the file to be restored is located is determined according to the directory path information;

[0017] According to the directory identifier of the parent directory node and the file name of the file to be restored, the file node that matches the directory identifier of the parent directory node and the file name of the file to be restored is determined from the target hierarchical linked list as the file node where the file to be restored is located.

[0018] Optionally, after searching the index tree for directory path information of the file to be restored according to the full path information of the file to be restored, the method further includes:

[0019] If the directory path information is not found, traverse the index tree and search for the first-level directory node of the file to be restored according to the full path information of the file to be restored;

[0020] According to the directory identifier of the first-level directory node and the directory name of at least one lower-level directory node of the first-level directory node, all directory nodes of the to-be-recovered file are determined from the target level linked list, and directory path information of the to-be-recovered file is generated;

[0021] Determine the directory identifier of the parent directory node of the file node where the file to be restored is located according to the directory path information;

[0022] According to the directory identifier of the parent directory node and the file name of the file to be restored, the file node that matches the directory identifier of the parent directory node and the file name of the file to be restored is determined from the target hierarchical linked list as the file node where the file to be restored is located.

[0023] Optionally, the updating of the usage status of the file node includes:

[0024] The usage state of the file node is updated from the second state to the first state.

[0025] Optionally, 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 a pre-created index tree includes:

[0026] According to the to-be-restored directory node of the to-be-restored file, traverse the index tree to search for all subdirectory nodes under the to-be-restored directory node;

[0027] According to the directory identifier of each sub-directory node, determine all file nodes matching the directory identifier of each sub-directory node from the target level linked list;

[0028] According to the creation time information of the file to be restored, a file node whose file creation time satisfies the creation time information is determined from all the file nodes.

[0029] Optionally, the updating of the usage status of the file node includes:

[0030] 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.

[0031] In a second aspect, an embodiment of the present application further provides a file recovery device, including: an acquisition module, a determination module, and an update module;

[0032] The acquisition module is used to acquire attribute information of the file to be restored, wherein the attribute information includes at least one of the following: full path information of the 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;

[0033] The determination module is used to determine 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 pre-created index tree, wherein the target hierarchical linked list is generated according to the information of the directory nodes and the file nodes of all deleted files in the file system to which the file to be restored belongs, and the index tree is used to indicate the index relationship between all the directory nodes and the file nodes in the file system;

[0034] The update module is used to determine the location information of the file node in the disk and update the usage status of the file node according to the mapping relationship between the file node and the file index unit. The mapping relationship between the file node and the file index unit is determined based on the structure of the file system.

[0035] Optionally, the device further includes: a reading module, a storage module, and a creation module;

[0036] The reading module is used to load the index area of ​​the file system from the disk, read the information of all directory nodes and all file nodes, the index area includes: multiple index units, each index unit includes an index check value, multiple directory nodes and multiple file nodes; the information of each directory node includes at least one of the following: directory name, usage status, level, parent directory identifier, directory identifier, directory creation time and modification time; the information of each file node includes at least one of the following: file name, usage status, level, parent directory identifier, file identifier, file creation time and modification time, file fragment number and size;

[0037] The storage module is used to save the information of the directory node and the file node whose usage status is the first status into the hierarchical linked list;

[0038] The creation module is used to parse the hierarchical linked list layer by layer and create the index tree according to the connection relationship identified by the parent directory.

[0039] Optionally, the determination module is specifically used to search for 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 relationship of each directory node of the file to be restored;

[0040] If the directory path information is found, the directory identifier of the parent directory node of the file node where the file to be restored is located is determined according to the directory path information;

[0041] According to the directory identifier of the parent directory node and the file name of the file to be restored, the file node that matches the directory identifier of the parent directory node and the file name of the file to be restored is determined from the target hierarchical linked list as the file node where the file to be restored is located.

[0042] Optionally, the determination module is specifically configured to traverse the index tree and search for a first-level directory node of the file to be restored according to the full path information of the file to be restored if the directory path information is not found;

[0043] According to the directory identifier of the first-level directory node and the directory name of at least one lower-level directory node of the first-level directory node, all directory nodes of the to-be-recovered file are determined from the target level linked list, and directory path information of the to-be-recovered file is generated;

[0044] Determine the directory identifier of the parent directory node of the file node where the file to be restored is located according to the directory path information;

[0045] According to the directory identifier of the parent directory node and the file name of the file to be restored, the file node that matches the directory identifier of the parent directory node and the file name of the file to be restored is determined from the target hierarchical linked list as the file node where the file to be restored is located.

[0046] Optionally, the updating module is specifically configured to update the usage status of the file node from the second status to the first status.

[0047] Optionally, the determination module is specifically configured to traverse and search for all subdirectory nodes under the to-be-restored directory node of the to-be-restored file in the index tree according to the to-be-restored directory node of the to-be-restored file;

[0048] According to the directory identifier of each sub-directory node, determine all file nodes matching the directory identifier of each sub-directory node from the target level linked list;

[0049] According to the creation time information of the file to be restored, a file node whose file creation time satisfies the creation time information is determined from all the file nodes.

[0050] Optionally, the update module is specifically configured to update the usage status of the file node and the usage status of a directory node associated with the file node from the second status to the first status.

[0051] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor. When the electronic device is running, the processor and the storage medium communicate through the bus, and the processor executes the machine-readable instructions to perform the steps of the file recovery method provided in the first aspect.

[0052] In a fourth aspect, an embodiment of the present application provides a storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the file recovery method provided in the first aspect are executed.

[0053] The beneficial effects of this application are:

[0054] The present application provides a file recovery method, device, electronic device and storage medium, the method comprising: obtaining attribute information of a file to be recovered, the attribute information comprising at least one of the following: full path information of the file to be recovered, directory node to be recovered of the file to be recovered, and creation time information of the file to be recovered; determining the file node where the file to be recovered is located from a target hierarchical linked list according to the attribute information of the file to be recovered and a pre-created index tree; wherein the target hierarchical linked list is generated according to the information of the directory nodes and file nodes of all deleted files in the file system to which the file to be recovered belongs, and the index tree is used to indicate the index relationship of all directory nodes and file nodes in the file system; determining the location information of the file node in the disk according to the mapping relationship between the file node and the file index unit, and updating the usage status of the file node; wherein the mapping relationship between the file node and the file index unit is determined based on the structure of the file system. In the method, based on the attribute information of the file to be recovered, the directory path of the file to be recovered is searched from the pre-created index tree, and based on the found directory path, the file node where the file to be recovered is located is determined from the hierarchical linked list, and the usage status of the file node is updated. Among them, the file node where the file to be recovered is located is searched based on the created index tree and hierarchical linked list. Since the index relationship between directory nodes and file nodes is stored in the index tree, the directory path of the file to be recovered can be found quickly and accurately. The hierarchical linked list is generated by the information of all deleted directory nodes and file nodes. The file node where the file to be recovered is located can be quickly found in the hierarchical linked list, thereby realizing rapid recovery of files and ensuring the integrity of the file system. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0056] Figure 1 A schematic diagram of a file system structure provided in an embodiment of the present application;

[0057] Figure 2 A flowchart of a file recovery method provided in an embodiment of the present application;

[0058] Figure 3 A flowchart of another file recovery method provided in an embodiment of the present application;

[0059] Figure 4 A schematic diagram of the structure of an index tree provided in an embodiment of the present application;

[0060] Figure 5 A flowchart of another file recovery method provided in an embodiment of the present application;

[0061] Figure 6 A flowchart of another file recovery method provided in an embodiment of the present application;

[0062] Figure 7 A schematic diagram of searching for a file node where a file to be restored is located provided in an embodiment of the present application;

[0063] Figure 8 A flowchart of another file recovery method provided in an embodiment of the present application;

[0064] Fig. 9 A schematic diagram of a file recovery device provided in an embodiment of the present application;

[0065] Fig.10 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0066] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It should be understood that the drawings in the present application only serve the purpose of explanation and description and are not used to limit the scope of protection of the present application. In addition, it should be understood that the schematic drawings are not drawn in real proportion. The flowchart used in this application shows the operations implemented according to some embodiments of the present application. It should be understood that the operations of the flowchart can be implemented out of sequence, and the steps without logical context can be reversed in order or implemented simultaneously. In addition, those skilled in the art can add one or more other operations to the flowchart under the guidance of the content of the present application, or remove one or more operations from the flowchart.

[0067] In addition, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.

[0068] It should be noted that the term "comprising" will be used in the embodiments of the present application to indicate the existence of the features declared thereafter, but does not exclude the addition of other features.

[0069] Figure 1 A schematic diagram of a file system structure provided in an embodiment of the present application. The file recovery method provided in the present application can be based on Figure 1 The file system implementation shown. The file system of the present application divides the disk space into structures during initialization. The disk space of the file system includes: a reserved area, two super blocks, and multiple block groups, each of which 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.

[0070] Optionally, each block group may include a primary index area and a backup index area, wherein a primary index area or a backup index area may be referred to as a block group index GInode, and the size thereof is 1M, and a primary index area or a backup index area may be further subdivided into 64 sub-unit indexes (SInode), each sub-unit index is 16K, wherein a sub-index unit may include: an index log record of 4K, a directory index unit of 4K, and a file index unit of 8K. An index check value is recorded in the index log record, and a target index unit may include multiple directory nodes, each of which is 128B, and a file index unit may include multiple file nodes, each of which is 128B.

[0071] The primary index area and the backup index area are located at the two ends of the block group, and the data area is between the primary index area and the backup index area. Each data area includes multiple data blocks, such as Figure 1 As shown, a data area may include 64 data blocks, and the size of each data block may be 64M.

[0072] In addition, the primary / backup index area includes index log records, directory index units, and file index units, respectively. The index log records in the index area are used to record index log information, wherein the log information may include index checksums, index update time and number of times, and log information, etc.; the directory index unit and the file index unit are index units for recording directory attributes and file attributes, respectively. The index checksum value size can be 4K, the directory index unit size can be 4K, and the file index unit size can be 8K. Among them, the directory index unit includes 32 directory nodes, each of which can be 128B in size, and the file index unit includes 64 file nodes, each of which can be 128B in size, and the number of file nodes corresponds to the number of data blocks one by one.

[0073] The superblock is used to record the overall information of the entire file system, including the signature of the file system, the creation time of the system, the last write time, the number of accesses, the number of index units, the number of block groups, the size of data blocks, the size of index units, the universally unique identifier (UUID), and the formatting status. Superblocks are divided into primary and backup superblocks. The primary and backup relationship is used to improve the reliability of the system by restoring the data of another superblock when an abnormality occurs in the information of a certain superblock.

[0074] It should be noted that the above-mentioned reserved area, super block size and unit block group size are only an optional allocation method, which is not limited to the above and can be appropriately adjusted according to actual conditions.

[0075] In addition, the index area is a key area of ​​the file system, and the index log record is used to record index log information, and the log information may include an index check value. The information of each directory node may include at least one of the following: directory name, usage status, level, parent directory identifier (parent directory ID), directory identifier (directory ID), directory creation time and modification time; the information of each file node may include at least one of the following: file name, usage status, level, parent directory identifier, file identifier, file creation time and modification time, file segment number and size.

[0076] It should be noted that the number of block groups into which the above-mentioned disk is divided, the number of index areas included in each block group, the size of the index area and the size of the data area, the number of data blocks included in the data area and the size of each data block can be a possible example, and the present application is not limited to this.

[0077] After clearly introducing the file system structure, the method of the present application will be described through a number of specific embodiments.

[0078] Figure 2A flowchart of a file recovery method provided in an embodiment of the present application; Figure 2 As shown, the method may include:

[0079] S201. Acquire 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, a directory node to be restored of the file to be restored, and creation time information of the file to be restored.

[0080] Usually, the loading process of the file system is to read all the index areas of the file system and parse all the directory nodes (DNode) and file nodes (FNode) included in the index areas. If the usage status of the directory node or file node is 1, which means that the node has been used, then according to the hierarchy of the directory node or file node, the information stored in the directory node and the information stored in the file node and the location (Locate) of the index unit of the disk corresponding to the directory node and the file node are saved in a hierarchical linked list, where each level uses a linked list. After all the parsing and saving are completed, the hierarchical linked list is parsed level by level, and the index tree is generated according to the parent directory identification relationship component stored in each node. The addition, deletion, query and modification of directories or files in the file system are all implemented based on this index tree.

[0081] When a file stored in a file system is deleted by mistake, it needs to be restored in time to ensure the normal use of the file system. In one implementation, the attribute information of the file to be restored input by the user can be obtained, and the attribute information can be input through a user interface that can provide a file recovery function.

[0082] In this embodiment, the attribute information may include, but is not limited to: the full path information of the file to be restored, the directory node to be restored of the file to be restored, and the creation time information of the file to be restored. The full path information of the file to be restored is composed of the directories at all levels where the file to be restored is located and the file itself, which represents the upper and lower cascade relationship between the directories at all levels and the files to be restored. For example, the full path information of the file to be restored is: " / video / dir1 / file1", which represents that the file to be restored file1 is stored in the subdirectory dir1 of the first-level directory video.

[0083] The directory node to be restored of the file to be restored may refer to any directory in the directories at all levels where the file to be restored is located. The creation time information of the file to be restored also refers to the time when the file to be restored is created and stored in the file system.

[0084] S202: Determine 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 pre-created index tree.

[0085] The target hierarchical linked list is generated based on the directory node information and file node information of all deleted files in the file system to which the file to be recovered belongs, and the index tree is used to indicate the index relationship between all directory nodes and file nodes in the file system.

[0086] Optionally, based on the acquired attribute information of the file to be restored, the directory path of the file to be restored may be searched from a pre-created index tree, and the file node where the file to be restored is located may be determined based on the found directory path combined with the hierarchical linked list.

[0087] The present application may search based on one or more of the above-obtained attribute information, and may specifically obtain one or more of the attribute information according to the recovery requirements of the file to be recovered.

[0088] In some embodiments, during the process of loading the file system, after reading the information of the directory nodes and file nodes in all index areas in the file system, all directory nodes and file nodes with names and a usage status of 0 are saved in a hierarchical linked list according to the level and their index information and corresponding location information on the disk are generated. Among them, the usage status of 0 means that the node is not used and the node has been deleted. Specifically, the usage status of the directory node is 0, which means that the directory where the file is located is deleted, and the usage status of the file node is 0, which means that the file is deleted.

[0089] Optionally, based on the generated target hierarchical linked list, the file nodes are directly determined in the target hierarchical linked list. Since the target hierarchical linked list only contains information of deleted directory nodes or file nodes, the efficiency of determining the file nodes of the files to be recovered can be greatly improved, avoiding the long time-consuming search in the full hierarchical linked list that completely includes all file node information and directory node information.

[0090] S203: According to the mapping relationship between the file node and the file index unit, determine the location information of the file node in the disk, and update the usage status of the file node.

[0091] The mapping relationship between the file node and the file index unit is determined based on the structure of the file system.

[0092] In some embodiments, based on the above Figure 1 In the file system structure, the mapping relationship between each index unit and the file node and directory node in the file system is fixed. During the loading of the file system, the mapping relationship between the file node and the file index unit is determined. The location information of the file node on the disk can be directly read. The location information of each file node on the disk can also be stored in the above-mentioned target hierarchical linked list.

[0093] Optionally, according to the determined position of the file node where the file to be restored is located in the disk, the use status corresponding to the file node in the disk is updated, thereby realizing the restoration of the file to be restored.

[0094] In summary, the file recovery method provided by this embodiment includes: obtaining the attribute information of the file to be recovered, the attribute information includes at least one of the following: the full path information of the file to be recovered, the directory node to be recovered of the file to be recovered, and the creation time information of the file to be recovered; according to the attribute information of the file to be recovered and the pre-created index tree, determining the file node where the file to be recovered is located from the target hierarchical linked list; wherein the target hierarchical linked list is generated according to the information of the directory nodes and the information of the file nodes of all deleted files in the file system to which the file to be recovered belongs, and the index tree is used to indicate the index relationship of all directory nodes and file nodes in the file system; according to the mapping relationship between the file node and the file index unit, determining the location information of the file node in the disk, and updating the usage status of the file node; wherein the mapping relationship between the file node and the file index unit is determined based on the structure of the file system. In this method, based on the attribute information of the file to be recovered, the directory path of the file to be recovered is searched from the pre-created index tree, and based on the found directory path, the file node where the file to be recovered is located is determined from the hierarchical linked list, and the usage status of the file node is updated. Among them, the file node where the file to be recovered is located is searched based on the created index tree and hierarchical linked list. Since the index relationship between directory nodes and file nodes is stored in the index tree, the directory path of the file to be recovered can be found quickly and accurately. The hierarchical linked list is generated by the information of all deleted directory nodes and file nodes. The file node where the file to be recovered is located can be quickly found in the hierarchical linked list, thereby realizing rapid recovery of files and ensuring the integrity of the file system.

[0095] Figure 3 A flowchart of another file recovery method provided by an embodiment of the present application; optionally, in step S202, before determining the file node where the file to be recovered is located from the target hierarchical linked list according to the attribute information of the file to be recovered and the pre-created index tree, the method of the present application may further include:

[0096] S301, loading the index area of ​​the file system from the disk, and reading the information of all directory nodes and all file nodes.

[0097] Among them, the index area includes: multiple index units, each index unit includes an index check value, multiple directory nodes and multiple file nodes; the information of each directory node includes at least one of the following: directory name, usage status, hierarchy, parent directory identifier, directory identifier, directory creation time and modification time; the information of each file node includes at least one of the following: file name, usage status, hierarchy, parent directory identifier, file identifier, file creation time and modification time, file fragment number and size.

[0098] Optionally, the structure of the index area in the file system to which the present solution is applied has been described in detail in the above embodiments and will not be described in detail here.

[0099] It should be explained that the usage status in the information of the target node and the file node can include a first status and a second status. The first status can be 1, which means that the node has been used, and the second status can be 0, which means that the node has not been used. The hierarchy refers to the hierarchy where the node is located. The parent directory identifier refers to the ID of the node above the current node. For example, the identifier of directory 1 is 1000, the identifier of the sub-directory 2 of directory 1 is 1001, and the identifier of the sub-directory 3 of directory 2 is 1002. Then, it can be determined that the parent directory identifier of directory 3 is 1001, and the parent directory identifier of directory 2 is 1000. The directory identifier refers to the ID of the current node.

[0100] In some embodiments, the process of loading the file system is to parse and obtain all the information contained in the file system, including the information of the data area index area, etc. By loading the index area of ​​the file system, all the information contained in the index area can be read, including the information of all the file nodes under the file index unit and the information of all the directory nodes under the directory index unit.

[0101] S302: Save the information of the directory node and the file node whose usage status is the first status into a hierarchical linked list.

[0102] The current usage status of the directory node can be determined by the usage status in the directory node information, and the current usage status of the file node can also be determined by the usage status in the file node information. Optionally, based on the usage status of each file node and directory node read, the information of the directory node with the first usage status and the information of the file node can be saved in the hierarchical linked list, that is, the information of all file nodes and directory nodes with a usage status of 1 (used, not deleted) can be saved in the hierarchical linked list.

[0103] Among them, the information of each file node and directory node may be saved in a corresponding level in a hierarchical linked list according to the level of each file node and the level of the directory node.

[0104] S303, parsing the hierarchical linked list layer by layer, and creating an index tree according to the connection relationship identified by the parent directory.

[0105] Optionally, the hierarchical linked list may be parsed layer by layer, and an index tree may be constructed according to the parent directory identification relationship between each directory node and file node.

[0106] Figure 4 A schematic diagram of the structure of an index tree provided in an embodiment of the present application, assuming that the above-mentioned hierarchical linked list is as follows:

[0107]

[0108]

[0109] Then, based on the information of each file node and directory node in the hierarchical linked list, according to the relationship between the parent directory identifiers of each node, it can be known that the first layer of the index tree includes directory node 1, directory node 2, and directory node 3, and the second layer includes: directory node 5, directory node 6, directory node 7, and directory node 8, among which the parent node of directory node 5 is directory node 2, the parent node of directory node 6 is directory node 1, the parent node of directory node 7 is directory node 3, and the parent node of directory node 8 is directory node 2. Similarly, the third layer of the index tree includes: file node 1, file node 2, file node 3, and file node 4. The parent node of file node 1 is directory node 7, the parent node of file node 2 is directory node 8, the parent node of file node 3 is directory node 5, and the parent node of file node 4 is directory node 6. Based on this, the following can be constructed: Figure 4 The index tree shown.

[0110] It should be noted that the constructed index tree clearly expresses the index relationship between each directory node and file node, and operations such as adding, deleting, checking and modifying files or directories can be performed based on the index tree.

[0111] Figure 5 A flowchart of another file recovery method provided by an embodiment of the present application; Optionally, in step S202, determining the file node where the file to be recovered is located from the target hierarchical linked list according to the attribute information of the file to be recovered and the pre-created index tree may include:

[0112] S501. Searching for 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, where the directory path information represents the index relationship of each directory node of the file to be restored.

[0113] Assume that the full path of the file to be restored is " / video / dir1 / file1", where file file1 is deleted by mistake. According to the full path " / video / dir1 / file1", " / video / dir1" is found in the index tree, and the identifier of the directory node dir1 is read as 1001.

[0114] S502: If the directory path information is found, determine the directory identifier of the parent directory node of the file node where the file to be restored is located according to the directory path information.

[0115] In some embodiments, if the file to be recovered is just a file that was deleted by mistake, that is, the file file1 mentioned above was deleted by mistake, and the directory is still intact, then according to the full path information of the file to be recovered, the directory path information can be found in the index tree, that is, / video / dir1 can be found.

[0116] Based on the found directory path information, it can be determined that the parent directory node of the file node where the to-be-recovered file file1 is located is directory node 1, the node name of directory node 1 is dir1, and the directory identifier thereof is 1001.

[0117] S503: According to the directory identifier of the parent directory node and the file name of the file to be restored, determine from the target hierarchical linked list the file node that matches 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.

[0118] Similarly, search for the file node with the file name "file1" and the parent directory identifier 1001 in the third layer of the target hierarchical linked list. Assuming they are file node 1 and file node 2, then it can be determined that the file nodes where the file to be recovered is located are file node 1 and file node 2.

[0119] The file nodes where the file to be recovered is located are file node 1 and file node 2, that is, the file information representing the file to be recovered file 1 is stored in file node 1 and file node 2 respectively, and file node 1 and file node 2 respectively store part of the information of file 1. The specific content recorded in the file to be recovered file 1 is stored in the data blocks corresponding to file node 1 and file node 2 respectively.

[0120] Figure 6 A flowchart of another file recovery method provided in an embodiment of the present application; Figure 7 A schematic diagram of searching for a file node where a file to be restored is located is provided in an embodiment of the present application. Optionally, in step S501, after searching for 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:

[0121] S601: If the directory path information is not found, traverse the index tree and search for the first-level directory node of the file to be restored according to the full path information of the file to be restored.

[0122] In other embodiments, if some directories and files of the file to be recovered are deleted by mistake, that is, dir1 / file1 in the above full path " / video / dir1 / file1" are deleted, since the directory is missing, then, based on the full path information of the file to be recovered, the directory path information cannot be found in the index tree, that is, / video / dir1 cannot be found.

[0123] In this case, the index tree can be traversed, and the index tree can be searched forward level by level to find the nearest matching directory level, that is, to find the first-level directory node named video, that is, Figure 7 The directory node shown in 1.

[0124] S602: According to the directory identifier of the first-level directory node and the directory name of at least one subordinate directory node of the first-level directory node, all directory nodes of the file to be restored are determined from the target hierarchical linked list, and directory path information of the file to be restored is generated.

[0125] Based on the found directory node 1, it can be determined that the directory identifier of directory node 1 is 1000. Then, based on the directory identifier 1000, the directory node 2 named dir1 and the parent directory identifier 1000 can be searched in the second layer of the target hierarchical linked list.

[0126] S603: Determine the directory identifier of the parent directory node of the file node where the file to be restored is located according to the directory path information.

[0127] Alternatively, if Figure 7 As shown, it can be known that the target identifier of directory node 2 is 1001, then it can be determined that the directory identifier of the parent directory node of the file node where the file to be restored file1 is located is 1001, that is, the parent directory identifier of the file node where the file to be restored is located is 1001.

[0128] S604: According to the directory identifier of the parent directory node and the file name of the file to be restored, determine from the target hierarchical linked list the file node that matches 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.

[0129] like Figure 7As shown in , the parent directory identifiers of file node 1 and file node 2 are both 1001, and the file names are both file 1. Based on the determined parent directory identifier 1001 and the file name file 1 of the file to be restored, it can be determined from the target hierarchical linked list that the file nodes where the file to be restored is located include file node 1 and file node 2 respectively.

[0130] Furthermore, if Figure 7 As shown, the positions of file node 1 and file node 2 in the disk can be determined according to the mapping relationship between file node 1 and file node 2 and the file index unit.

[0131] Optionally, in step S203, updating the usage status of the file node may include: updating the usage status of the file node from the second status to the first status.

[0132] In one feasible method, when a file is deleted by mistake, the usage status of the file node where the file is located is updated from the first status to the second status, that is, from the usage status 1 to the usage status 0, indicating that the current file is deleted and the file node is in an unused state. Then, when restoring the file, the usage status of the file node where the determined file to be restored is located can be updated from the second status to the first status, that is, from the usage status 0 to the usage status 1, so that file recovery can be achieved.

[0133] Figure 8 A flowchart of another file recovery method provided in an embodiment of the present application; optionally, as Figure 8 As shown, in step S202, according to the attribute information of the file to be restored and the pre-created index tree, determining the file node where the file to be restored is located from the target hierarchical linked list may include:

[0134] S801. According to the directory node to be restored of the file to be restored, search for all sub-directory nodes under the directory node to be restored in the index tree.

[0135] In the above-mentioned embodiment, the case of restoring a single file after it is deleted is described. This embodiment is for restoring files that are accidentally deleted within the time period of the files to be restored in a specified directory.

[0136] 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 can be found in the index tree, and first all sub-directory nodes under the directory node to be restored can be traversed in the index tree. Assume that the sub-directory nodes include a directory node with a directory name of dir1.

[0137] S802: According to the directory identifier of each sub-directory node, determine all file nodes matching the directory identifier of each sub-directory node from the target level linked list.

[0138] If the sub-directory nodes only include directory node 1, whose directory identifier is 1001, all file nodes whose parent directory identifier is 1001 can be found in the target level linked list.

[0139] In some cases, the sub-directory nodes determined above may also include multiple ones. Assuming that they include directory node 1, directory node 2, and directory node 3, the directory identifier of directory node 1 is 1001, the directory identifier of directory node 2 is 1002, and the directory identifier of directory node 3 is 1003, then all file nodes with parent directory identifier 1001, all file nodes with parent directory identifier 1002, and all file nodes with parent directory identifier 1003 can be found from the target hierarchical linked list.

[0140] S803: According to the creation time information of the file to be restored, determine, from all file nodes, a file node whose file creation time satisfies the creation time information.

[0141] Optionally, the file node whose file creation time satisfies the creation time information of the file to be restored can be determined according to the file creation time recorded in the information of all file nodes. The creation time information of the file to be restored can indicate the time period to be restored, that is, the files within the time period to be restored under the specified directory can be restored.

[0142] Optionally, in step S203, updating the usage status of the file node may include: updating 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.

[0143] For the recovery of files in the time period to be recovered under the specified directory, after the file node to be recovered is determined, the usage status of the file node and the directory node associated with the file node can be updated. The directory node associated with the file node also refers to the parent directory node of the file node. Figure 4 , assuming that the file node is 3, then the directory node associated with file node 3 can be directory node 5.

[0144] Similarly, here 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.

[0145] In summary, the file recovery method provided by the present embodiment includes: obtaining the attribute information of the file to be recovered, the attribute information includes at least one of the following: the full path information of the file to be recovered, the directory node to be recovered of the file to be recovered, and the creation time information of the file to be recovered; according to the attribute information of the file to be recovered and the pre-created index tree, determining the file node where the file to be recovered is located from the target hierarchical linked list; wherein the target hierarchical linked list is generated according to the information of the directory nodes and the information of the file nodes of all deleted files in the file system to which the file to be recovered belongs, and the index tree is used to indicate the index relationship of all directory nodes and file nodes in the file system; according to the mapping relationship between the file node and the file index unit, determining the location information of the file node in the disk, and updating the usage status of the file node; wherein the mapping relationship between the file node and the file index unit is determined based on the structure of the file system. In the present method, based on the attribute information of the file to be recovered, the directory path of the file to be recovered is searched from the pre-created index tree, and based on the found directory path, the file node where the file to be recovered is located is determined from the hierarchical linked list, and the usage status of the file node is updated. Among them, the file node where the file to be recovered is located is searched based on the created index tree and hierarchical linked list. Since the index relationship between directory nodes and file nodes is stored in the index tree, the directory path of the file to be recovered can be found quickly and accurately. The hierarchical linked list is generated by the information of all deleted directory nodes and file nodes. The file node where the file to be recovered is located can be quickly found in the hierarchical linked list, thereby realizing rapid recovery of files and ensuring the integrity of the file system.

[0146] The following describes the apparatus, device, storage medium, etc. used to execute the file recovery method provided by the present application. The specific implementation process and technical effects are described above and will not be repeated below.

[0147] Fig. 9 A schematic diagram of a file recovery device provided in an embodiment of the present application, wherein the functions implemented by the file recovery device correspond to the steps performed by the above method. The device can be understood as a server, or a processor of a server, or can be understood as a component independent of the above server or processor that implements the functions of the present application under the control of the server, such as Fig. 9 As shown, the device may include: an acquisition module 910, a determination module 920, and an update module 930;

[0148] The acquisition module 910 is used to acquire attribute information of the file to be restored, where the attribute information includes at least one of the following: full path information of the 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;

[0149] The determination module 920 is used to determine 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 pre-created index tree. The target hierarchical linked list is generated according to the information of the directory nodes and the file nodes of all deleted files in the file system to which the file to be restored belongs. The index tree is used to indicate the index relationship between all directory nodes and file nodes in the file system.

[0150] The update module 930 is used to determine the location information of the file node in the disk and update the usage status of the file node according to the mapping relationship between the file node and the file index unit. The mapping relationship between the file node and the file index unit is determined based on the structure of the file system.

[0151] Optionally, the device may further include: a reading module, a storage module, and a creation module;

[0152] A reading module is used to load the index area of ​​the file system from the disk, read the information of all directory nodes and all file nodes, the index area includes: multiple index units, each index unit includes an index check value, multiple directory nodes and multiple file nodes; the information of each directory node includes at least one of the following: directory name, usage status, level, parent directory identifier, directory identifier, directory creation time and modification time; the information of each file node includes at least one of the following: file name, usage status, level, parent directory identifier, file identifier, file creation time and modification time, file fragment number and size;

[0153] A storage module, used for storing information of directory nodes and file nodes whose usage status is the first status into a hierarchical linked list;

[0154] Create a module to parse the hierarchical linked list layer by layer and create an index tree based on the connection relationship identified by the parent directory.

[0155] Optionally, the determination module 920 is specifically configured to search the index tree for directory path information of the file to be restored according to the full path information of the file to be restored, where the directory path information represents the index relationship of each directory node of the file to be restored;

[0156] If the directory path information is found, the directory identifier of the parent directory node of the file node where the file to be restored is located is determined according to the directory path information;

[0157] According to the directory identifier of the parent directory node and the file name of the file to be restored, the file node that matches the directory identifier of the parent directory node and the file name of the file to be restored is determined from the target hierarchical linked list as the file node where the file to be restored is located.

[0158] Optionally, the determination module is specifically used to traverse the index tree and find the first-level directory node of the file to be restored according to the full path information of the file to be restored if the directory path information is not found;

[0159] According to the directory identifier of the first-level directory node and the directory name of at least one lower-level directory node of the first-level directory node, all directory nodes of the to-be-recovered file are determined from the target level linked list, and directory path information of the to-be-recovered file is generated;

[0160] Determine the directory identifier of the parent directory node of the file node where the file to be restored is located according to the directory path information;

[0161] According to the directory identifier of the parent directory node and the file name of the file to be restored, the file node that matches the directory identifier of the parent directory node and the file name of the file to be restored is determined from the target hierarchical linked list as the file node where the file to be restored is located.

[0162] 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.

[0163] Optionally, the determination module 920 is specifically configured to traverse the index tree to search for all subdirectory nodes under the directory node to be restored according to the directory node to be restored of the file to be restored;

[0164] According to the directory identifier of each sub-directory node, all file nodes matching the directory identifier of each sub-directory node are determined from the target level linked list;

[0165] According to the creation time information of the file to be restored, a file node whose file creation time satisfies the creation time information is determined from all file nodes.

[0166] Optionally, the update 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.

[0167] The above-mentioned device is used to execute the method provided by the aforementioned embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.

[0168] The above modules may be one or more integrated circuits configured to implement the above methods, such as one or more application specific integrated circuits (ASIC), or one or more digital singnal processors (DSP), or one or more field programmable gate arrays (FPGA). For another example, when a module is implemented in the form of a processing element scheduling program code, the processing element may be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call program code. For another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).

[0169] The above modules can be connected or communicated with each other via a wired connection or a wireless connection. The wired connection may include a metal cable, an optical cable, a hybrid cable, etc., or any combination thereof. The wireless connection may include a connection in the form of a LAN, a WAN, Bluetooth, a 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. Those skilled in the art will clearly understand that for the convenience and simplicity of description, the specific working process of the system and device described above can refer to the corresponding process in the method embodiment, and will not be repeated in this application.

[0170] Fig.10 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application, which may be a computing device with data processing capabilities.

[0171] The device may include: a processor 801 and a memory 802 .

[0172] The memory 802 is used to store programs, and the processor 801 calls the programs stored in the memory 802 to execute the above method embodiment. The specific implementation method and technical effect are similar and will not be repeated here.

[0173] The memory 802 stores program codes, and when the program codes are executed by the processor 801, the processor 801 executes various steps of the file recovery method according to various exemplary embodiments of the present application described in the above “Exemplary Method” section of this specification.

[0174] Processor 801 can be a general-purpose processor, such as a central processing unit (CPU), a digital signal processor (DigitalSignal Processor, DSP), an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field programmable gate array (Field Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, and can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiments of the present application. A general-purpose processor can be a microprocessor or any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present application can be directly embodied as a hardware processor to be executed, or a combination of hardware and software modules in the processor can be executed.

[0175] The memory 802 is a non-volatile computer-readable storage medium that can 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, such as a flash memory, a hard disk, a multimedia card, a card-type memory, a random access memory (Random Access Memory, RAM), a static random access memory (Static Random Access Memory, SRAM), a programmable read-only memory (Programmable Read Only Memory, PROM), a read-only memory (Read Only Memory, ROM), an electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), a magnetic memory, a disk, an optical disk, etc. The memory is any other medium that can be used to carry or store a desired program code in the form of an instruction or data structure and can be accessed by a computer, but is not limited thereto. The memory 802 in the embodiment of the present application can also be a circuit or any other device that can realize a storage function, for storing program instructions and / or data.

[0176] Optionally, the present application also provides a program product, such as a computer-readable storage medium, including a program, which is used to execute the above method embodiment when executed by a processor.

[0177] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0178] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple 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.

[0179] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units.

[0180] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (English: processor) to perform some steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (English: Read-Only Memory, abbreviated: ROM), random access memory (English: Random Access Memory, abbreviated: RAM), disk or optical disk and other media that can store program codes.

Claims

1. A file recovery method, characterized in that: include: Acquire attribute information of the file to be restored, the attribute information including at least one of the following: full path information of the 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; According to the attribute information of the file to be restored and the pre-created index tree, the file node where the file to be restored is located is determined from the target hierarchical linked list, the target hierarchical linked list is generated according to the information of the directory nodes and the file nodes of all deleted files in the file system to which the file to be restored belongs, and the index tree is used to indicate the index relationship between all the directory nodes and the file nodes in the file system; According to the mapping relationship between the file node and the file index unit, the location information of the file node in the disk is determined, and the use status of the file node is updated, wherein the mapping relationship between the file node and the file index unit is determined based on the structure of the file system; The step of 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 pre-created index tree comprises: According to the full path information of the file to be restored, searching the index tree for the directory path information of the file to be restored, wherein the directory path information represents the index relationship of each directory node of the file to be restored; If the directory path information is found, the directory identifier of the parent directory node of the file node where the file to be restored is located is determined according to the directory path information; According to the directory identifier of the parent directory node and the file name of the to-be-recovered file, determine from the target hierarchical linked list a file node that matches the directory identifier of the parent directory node and the file name of the to-be-recovered file as the file node where the to-be-recovered file is located; After searching the index tree for directory path information of the file to be restored according to the full path information of the file to be restored, the method further includes: If the directory path information is not found, traverse the index tree and search for the first-level directory node of the file to be restored according to the full path information of the file to be restored; According to the directory identifier of the first-level directory node and the directory name of at least one lower-level directory node of the first-level directory node, all directory nodes of the to-be-recovered file are determined from the target level linked list, and directory path information of the to-be-recovered file is generated; Determine the directory identifier of the parent directory node of the file node where the file to be restored is located according to the directory path information; According to the directory identifier of the parent directory node and the file name of the file to be restored, the file node that matches the directory identifier of the parent directory node and the file name of the file to be restored is determined from the target hierarchical linked list as the file node where the file to be restored is located.

2. The method according to claim 1, characterized in that Before determining the file node where the file to be restored is located from the target level linked list according to the attribute information of the file to be restored and the pre-created index tree, the method includes: Loading the index area of ​​the file system from the disk, reading the information of all directory nodes and all file nodes, the index area comprising: a plurality of index units, each index unit comprising an index check value, a plurality of directory nodes and a plurality of file nodes; the information of each directory node comprising at least one of the following: directory name, usage status, level, parent directory identifier, directory identifier, directory creation time and modification time; the information of each file node comprising at least one of the following: file name, usage status, level, parent directory identifier, file identifier, file creation time and modification time, file fragment number and size; The information of the directory node and the file node whose usage state is the first state are saved in the hierarchical linked list; The hierarchical linked list is parsed layer by layer, and the index tree is created according to the connection relationship identified by the parent directory.

3. The method according to claim 1, characterized in that: The updating of the usage status of the file node includes: The usage state of the file node is updated from the second state to the first state.

4. The method according to claim 2, characterized in that: The step of 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 pre-created index tree comprises: According to the to-be-restored directory node of the to-be-restored file, traverse the index tree to search for all subdirectory nodes under the to-be-restored directory node; According to the directory identifier of each sub-directory node, determine all file nodes matching the directory identifier of each sub-directory node from the target level linked list; According to the creation time information of the file to be restored, a file node whose file creation time satisfies the creation time information is determined from all the file nodes.

5. The method according to claim 4, characterized in that The updating of the usage status of the file node includes: 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.

6. A file recovery device, characterized in that: include: Get module, confirm module, update module; The acquisition module is used to acquire attribute information of the file to be restored, wherein the attribute information includes at least one of the following: full path information of the 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 determination module is used to determine 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 pre-created index tree, wherein the target hierarchical linked list is generated according to the information of the directory nodes and the file nodes of all deleted files in the file system to which the file to be restored belongs, and the index tree is used to indicate the index relationship between all the directory nodes and the file nodes in the file system; The update module is used to determine the location information of the file node in the disk and update the use status of the file node according to the mapping relationship between the file node and the file index unit, and the mapping relationship between the file node and the file index unit is determined based on the structure of the file system; The determining module is specifically used to search 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, wherein the directory path information represents the index relationship of each directory node of the file to be restored; If the directory path information is found, the directory identifier of the parent directory node of the file node where the file to be restored is located is determined according to the directory path information; According to the directory identifier of the parent directory node and the file name of the to-be-recovered file, determine from the target hierarchical linked list a file node that matches the directory identifier of the parent directory node and the file name of the to-be-recovered file as the file node where the to-be-recovered file is located; The determination module is specifically configured to traverse the index tree and search for a first-level directory node of the file to be restored according to the full path information of the file to be restored if the directory path information is not found; According to the directory identifier of the first-level directory node and the directory name of at least one lower-level directory node of the first-level directory node, all directory nodes of the to-be-recovered file are determined from the target level linked list, and directory path information of the to-be-recovered file is generated; Determine the directory identifier of the parent directory node of the file node where the file to be restored is located according to the directory path information; According to the directory identifier of the parent directory node and the file name of the file to be restored, the file node that matches the directory identifier of the parent directory node and the file name of the file to be restored is determined from the target hierarchical linked list as the file node where the file to be restored is located.

7. An electronic device, characterized in that: include: A processor, a storage medium and a bus, wherein the storage medium stores program instructions executable by the processor, and when the electronic device is running, the processor communicates with the storage medium via the bus, and the processor executes the program instructions to perform the steps of the file recovery method as described in any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the file recovery method according to any one of claims 1 to 5 are executed.