File recovery method and device, computer device and storage medium

By identifying and piecing together the starting and non-starting data blocks of deleted files, the problem of recovering accidentally deleted files is solved, achieving automated, accurate, and efficient file recovery.

CN112084157BActive Publication Date: 2026-05-19TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
TENCENT TECHNOLOGY (SHENZHEN) CO LTD
Filing Date
2020-09-18
Publication Date
2026-05-19

AI Technical Summary

Technical Problem

In the process of file operation, if a file is accidentally deleted due to user error, existing technology is not able to recover the file efficiently and accurately.

Method used

By identifying multiple data blocks corresponding to a deleted file, distinguishing between the starting data block and non-starting data blocks, and using the type string of the starting data block for concatenation, the file can be recovered.

Benefits of technology

It enables automatic file recovery without manual intervention, reducing manpower consumption and improving the accuracy and efficiency of file recovery.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112084157B_ABST
    Figure CN112084157B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose a file recovery method and device, computer equipment and a storage medium, and belong to the technical field of computers. The method comprises the following steps: in response to a file recovery instruction, determining a plurality of target data blocks corresponding to a deleted file, identifying a starting data block and a non-starting data block in the plurality of target data blocks, splicing the starting data block and the non-starting data block, and obtaining at least one target file. The method realizes an automatic file recovery scheme, does not require manual file recovery, and takes into account that the starting data block in the data block spliced to form the file comprises a type string. Therefore, by identifying a plurality of data blocks corresponding to the deleted file, the starting data block and the non-starting data block of different types are determined, and subsequent splicing is performed according to the identified data blocks of different types, the deleted file is recovered, the accuracy of the file is improved, the efficiency of file recovery is improved, and indexing and management of the data blocks are realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a file recovery method, apparatus, computer device, and storage medium. Background Technology

[0002] With the development of computer technology and the gradual expansion of data scale, file systems have become increasingly feature-rich and diverse, enabling users to perform various operations on files within the file system, such as editing, moving, and deleting. However, during file operations, users may accidentally delete files due to operational errors, in which case file recovery is necessary. Summary of the Invention

[0003] This application provides a file recovery method, apparatus, computer device, and storage medium, which can improve the efficiency of file recovery. The technical solution is as follows:

[0004] On the one hand, a file recovery method is provided, the method comprising:

[0005] In response to a file recovery command, identify multiple target data blocks corresponding to the deleted file;

[0006] Identify the starting data block and non-starting data blocks among the plurality of target data blocks, wherein the data header of the starting data block includes a type string, and the data header of the non-starting data block does not include the type string;

[0007] The starting data block and the non-starting data block are concatenated to obtain at least one target file.

[0008] On the other hand, a file recovery device is provided, the device comprising:

[0009] The first determination module is used to determine multiple target data blocks corresponding to the deleted file in response to the file recovery command;

[0010] An identification module is used to identify the starting data block and non-starting data blocks among the plurality of target data blocks, wherein the data header of the starting data block includes a type string, and the data header of the non-starting data block does not include the type string;

[0011] The splicing processing module is used to splice the starting data block and the non-starting data block to obtain at least one target file.

[0012] In one possible implementation, there are multiple starting data blocks and one non-starting data block. The splicing processing module includes:

[0013] The first identification unit is configured to identify, from the plurality of said starting data blocks, a first data block whose data tail does not include an ending string;

[0014] The splicing processing unit is used to splice the first data block with the non-starting data block and determine the resulting spliced ​​data block as a target file.

[0015] In another possible implementation, the device further includes:

[0016] The second determining module is used to determine each of the second data blocks other than the first data block in the plurality of starting data blocks as a target file.

[0017] In another possible implementation, there are multiple non-starting data blocks, and the splicing processing module includes:

[0018] The splicing processing unit is used to splice the starting data block with any of the non-starting data blocks to obtain a first spliced ​​data block that meets the splicing conditions, wherein the splicing conditions are that the data block reading operation is successfully executed.

[0019] The first determining unit is configured to determine the first concatenated data block as a target file in response to the first concatenated data block satisfying the termination condition, wherein the termination condition is that the data end of the data block includes an end string.

[0020] In another possible implementation, the device further includes:

[0021] The third determining module is used to respond to the first concatenated data block not satisfying the termination condition by continuing to concatenate the first concatenated data block with any one or more of the remaining non-starting data blocks until a concatenated data block that satisfies the concatenation condition and the termination condition is obtained, and then determining the concatenated data block as a target file.

[0022] In another possible implementation, the splicing processing unit is configured to splice the starting data block with any of the non-starting data blocks to obtain a first candidate data block; in response to the failure of the read operation on the first candidate data block, to splice the starting data block with any of the remaining non-starting data blocks until a first spliced ​​data block that satisfies the splicing conditions is obtained.

[0023] In another possible implementation, the device further includes:

[0024] The execution module is used to call the target reading tool that matches the type string in the starting data block to perform a reading operation on any concatenated data block;

[0025] The fourth determining module is used to determine that the spliced ​​data block satisfies the splicing condition in response to the fact that the end position read by the target reading tool is the same as the end position of the spliced ​​data block;

[0026] The fourth determining module is further configured to determine that the splicing data block does not meet the splicing conditions in response to the fact that the end position read by the reading tool is different from the end position of the spliced ​​data block.

[0027] In another possible implementation, the device further includes:

[0028] The fifth determining module is used to determine the file type corresponding to the type string based on the type string in the starting data block;

[0029] The sixth determining module is used to determine the reading tool corresponding to the file type as the reading tool that matches the type string.

[0030] In another possible implementation, the first determining module includes:

[0031] The second determining unit is configured to, in response to the file recovery instruction, determine multiple stored index information and multiple data blocks, wherein each index information includes at least one of a file identifier or a data block identifier, and the file indicated by the file identifier includes the data block indicated by the data block identifier in the same index information;

[0032] The query unit is configured to query at least one target data block from among the multiple data blocks based on the multiple index information. The multiple index information does not include index information corresponding to the target data block and satisfying the index conditions. The index conditions refer to the index information including a file identifier and a data block identifier, or the index information satisfying an index information format.

[0033] In another possible implementation, the query unit is used to query target index information that does not meet the index conditions from the multiple index information; and to determine the data block corresponding to the target data block identifier in the target index information as the target data block.

[0034] In another possible implementation, the query unit is used to determine the data block identifiers included in the plurality of index information; and to determine the other data blocks among the plurality of data blocks, excluding the data block corresponding to the determined data block identifier, as the target data block.

[0035] In another possible implementation, the file recovery instruction carries a target type identifier, which indicates the file type to which the target file to be recovered belongs;

[0036] The identification module includes:

[0037] The third determining unit is used to determine the target type string corresponding to the target type identifier;

[0038] The second identification unit is used to identify the starting data block and the non-starting data block among the plurality of target data blocks according to the target type string, wherein the data header of the starting data block includes the target type string.

[0039] On the other hand, a computer device is provided, the computer device including a processor and a memory, the memory storing at least one piece of program code, the at least one piece of program code being loaded and executed by the processor to perform the operations performed in the file recovery method as described above.

[0040] On the other hand, a computer-readable storage medium is provided that stores at least one piece of program code, which is loaded and executed by a processor to perform the operations performed in the file recovery method described above.

[0041] In another aspect, a computer program product or computer program is provided, the computer program product or computer program including computer program code stored in a computer-readable storage medium. A processor of a computer device reads the computer program code from the computer-readable storage medium, and the processor executes the computer program code, causing the computer device to perform the operations performed in the file recovery method described above.

[0042] The beneficial effects of the technical solutions provided in this application include at least the following:

[0043] This application implements an automatic file recovery scheme that eliminates the need for manual file recovery, reducing manpower consumption. Furthermore, considering that the starting data block in the data blocks that form the file includes a type string, the scheme identifies multiple data blocks corresponding to the deleted file, determines different types of starting and non-starting data blocks, and then reassembles the data blocks according to the identified different types to recover the deleted file. This improves the accuracy and efficiency of file recovery. Attached Figure Description

[0044] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0045] Figure 1 This is a schematic diagram of the structure of an implementation environment provided in an embodiment of this application;

[0046] Figure 2 This is a flowchart of a file recovery method provided in an embodiment of this application;

[0047] Figure 3 This is a flowchart of a file recovery method provided in an embodiment of this application;

[0048] Figure 4 This is a data storage structure diagram of a file system provided in an embodiment of this application;

[0049] Figure 5 This is a schematic diagram of a spliced ​​data block provided in an embodiment of this application;

[0050] Figure 6 This is a flowchart of a file recovery method provided in an embodiment of this application;

[0051] Figure 7 This is a flowchart of a data block extraction method provided in an embodiment of this application;

[0052] Figure 8 This is a flowchart of a data block splicing verification method provided in an embodiment of this application;

[0053] Figure 9 This is a schematic diagram of the structure of a file recovery device provided in an embodiment of this application;

[0054] Figure 10 This is a schematic diagram of the structure of a file recovery device provided in an embodiment of this application;

[0055] Figure 11 This is a schematic diagram of the structure of a terminal provided in an embodiment of this application;

[0056] Figure 12 This is a schematic diagram of the structure of a server provided in an embodiment of this application. Detailed Implementation

[0057] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the implementation methods of this application will be further described in detail below with reference to the accompanying drawings.

[0058] The terms “first,” “second,” etc., used in this application may be used herein to describe various concepts, but unless otherwise stated, these concepts are not limited by these terms. These terms are used only to distinguish one concept from another. For example, without departing from the scope of this application, a first data block may be referred to as a second data block, and similarly, a second data block may be referred to as a first data block.

[0059] As used in this application, the terms "at least one," "multiple," "each," and "any" have the following meanings: at least one includes one, two, or more; multiple includes two or more; each refers to each of the corresponding multiple; and any refers to any one of the multiple. For example, multiple data blocks include three data blocks, where each refers to each of the three data blocks, and any refers to any one of the three data blocks, which could be the first data block, the second data block, or the third data block.

[0060] Cloud technology refers to a hosting technology that unifies a series of resources such as hardware, software, and networks within a wide area network or local area network to achieve data computing, storage, processing, and sharing.

[0061] Cloud technology is a collective term for network technologies, information technologies, integration technologies, management platform technologies, and application technologies applied to the cloud computing business model. It can form resource pools, providing flexible and convenient on-demand access. Cloud computing technology will become a crucial support. Backend services of technical network systems require substantial computing and storage resources, such as video websites, image websites, and many portal websites. With the rapid development and application of the internet industry, every item may have its own identification mark in the future, requiring transmission to backend systems for logical processing. Data at different levels will be processed separately, and various industry data will all require robust system support, which can only be achieved through cloud computing.

[0062] Cloud storage is a new concept that extends and develops from the concept of cloud computing. A distributed cloud storage system (hereinafter referred to as a storage system) refers to a storage system that uses cluster applications, grid technology, and distributed storage file systems to bring together a large number of storage devices of various types (storage devices are also called storage nodes) in the network to work together through application software or application interfaces to provide data storage and business access functions to the outside world.

[0063] Currently, the storage method of storage systems is as follows: Logical volumes are created. During the creation of a logical volume, physical storage space is allocated to each logical volume. This physical storage space may consist of a single storage device or the disks of several storage devices. Clients store data on a logical volume, which means storing the data on the file system. The file system divides the data into many parts, each part being an object. Each object contains not only the data but also additional information such as a data identifier (ID, ID entity). The file system writes each object to the physical storage space of that logical volume and records the storage location information of each object. Therefore, when a client requests access to data, the file system can allow the client to access the data based on the storage location information of each object.

[0064] The process by which a storage system allocates physical storage space to a logical volume is as follows: the physical storage space is pre-divided into strips according to the capacity estimate of the objects stored in the logical volume (this estimate often has a large margin relative to the actual capacity of the objects to be stored) and the grouping of Redundant Array of Independent Disks (RAID). A logical volume can be understood as a strip, thus allocating physical storage space to the logical volume.

[0065] The file recovery method provided in this application can be used in a computer device, optionally a terminal or a server. Optionally, the server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. Optionally, the terminal can be a smartphone, tablet, laptop, desktop computer, smart speaker, or smartwatch, but is not limited to these. Optionally, the terminal and server can be directly or indirectly connected via wired or wireless communication; this application does not impose any restrictions on this connection.

[0066] Figure 1 This is a schematic diagram of an implementation environment provided in an embodiment of this application, such as... Figure 1 As shown, the implementation environment includes a terminal 101 and a server 102. A communication connection is established between the terminal 101 and the server 102, and the terminal 101 and the server 102 can interact through this communication connection.

[0067] Server 102 stores multiple files and their corresponding data blocks. Terminal 101 can access the files on server 102 and perform various operations on them, such as editing, moving, and deleting. Furthermore, if a file on server 102 is deleted, terminal 101 can send a file recovery command to server 102, enabling server 102 to recover the deleted file according to the command. The recovered file can then be provided to terminal 101 for viewing.

[0068] The method provided in this application can be used in a variety of scenarios.

[0069] For example, in video recovery scenarios:

[0070] The server stores multiple videos, which are then shared with users for viewing. Users can also upload videos to the server to share with other users. If a user accidentally deletes a video uploaded to the server, the file recovery method provided in this application can recover the deleted video.

[0071] Figure 2 This is a flowchart of a file recovery method provided in an embodiment of this application, applied in a computer device, such as... Figure 2 As shown, the method includes:

[0072] 201. In response to a file recovery command, the computer device identifies multiple target data blocks corresponding to the deleted file.

[0073] The file recovery command is used to instruct the recovery of deleted files.

[0074] In this embodiment of the application, each file is obtained by concatenating at least one data block. After receiving the file recovery instruction, the target data block corresponding to the deleted file is obtained so that the deleted file can be recovered according to the target data block.

[0075] 202. The computer device identifies the starting data block and non-starting data blocks among multiple target data blocks.

[0076] The data header of the starting data block includes a type string. The non-starting data block is another target data block among multiple target data blocks besides the starting data block. The data header of the non-starting data block does not include a type string.

[0077] 203. The computer device concatenates the starting data block and the non-starting data block to obtain at least one target file.

[0078] This application implements an automatic file recovery scheme that eliminates the need for manual file recovery, reducing manpower consumption. Furthermore, considering that the starting data block in the data blocks that form the file includes a type string, the scheme identifies multiple data blocks corresponding to the deleted file, determines different types of starting and non-starting data blocks, and then reassembles the data blocks according to the identified different types to recover the deleted file. This improves the accuracy and efficiency of file recovery.

[0079] Figure 3 This is a flowchart of a file recovery method provided in an embodiment of this application, applied in a computer device, such as... Figure 3 As shown, the method includes:

[0080] 301. In response to a file recovery command, a computer device identifies multiple stored index entries and multiple data blocks.

[0081] In this embodiment, a computer device stores multiple files, each file being constructed by concatenating at least one data block. Optionally, a data block may contain multiple characters, and the characters from at least one data block are concatenated to form a complete string representing the content of the corresponding file. The computer device also stores multiple data blocks corresponding to the multiple files and multiple index information (Inodes). The index information indicates the relationship between files and data blocks. Each index information includes at least one of a file identifier or a data block identifier. The file identifier indicates a file in the computer device, and the data block identifier indicates a data block in the computer device. Furthermore, the file indicated by the file identifier includes the data block indicated by the data block identifier in the same index information.

[0082] In this computer device, files, data blocks, and index information are stored in different storage areas. Optionally, the computer device includes a file storage area, a data block storage area, and an index identifier storage area. The file storage area stores multiple files, the data block storage area stores multiple data blocks, and the index identifier storage area stores multiple index entries. Optionally, the data block storage area includes multiple groups, and each group includes multiple blocks.

[0083] In this computer device, when no file, its corresponding data block, and its corresponding index information have been deleted, the index information includes a file identifier and a data block identifier. The file identifier indicates the file, and the data block identifier indicates the data block corresponding to the file. Through this index information, it can be determined that the file indicated by the file identifier is formed by concatenating the data blocks indicated by the data block identifier. Optionally, the index information also includes at least one of the following: the concatenation order of multiple data block identifiers, a file address, or a data block address. The concatenation order refers to the order in which multiple data blocks are concatenated to form the corresponding file; the file address indicates the location where the file is stored; and the data block address indicates the location where the data blocks are stored.

[0084] When any file is deleted from a computer device, the index information corresponding to that file is also deleted, or part of the information in the index is deleted, but the data block corresponding to the file is not deleted. In this case, the data block corresponding to the deleted file will no longer have index information, or the corresponding index information will be incomplete. Therefore, by using multiple index information and multiple data blocks in the computer device, the data block corresponding to the deleted file can be selected from multiple data blocks, thereby recovering the deleted file.

[0085] File recovery commands are used to instruct the recovery of deleted files. When a file recovery command is received, it indicates that a deleted file needs to be recovered. Therefore, multiple stored index information and multiple data blocks are identified so that file recovery can be performed subsequently based on these index information and data blocks.

[0086] In this embodiment, the computer device includes multiple storage areas, each with a corresponding location. The system structure directory includes the locations of multiple storage areas so that the location of each storage area can be determined subsequently based on the system structure directory. Optionally, each storage area has a storage area identifier and address information. The storage area identifier indicates the corresponding storage area, and the address information indicates the location of the corresponding storage area. The system structure directory includes a correspondence between multiple storage area identifiers and multiple address information.

[0087] In this computer device, different storage areas store different types of information. For example, the index information storage area stores only index information, the data block storage area stores only data blocks, and the file storage area stores only files. Optionally, the system structure directory includes storage area identifiers and information type identifiers corresponding to each storage area identifier. These information type identifiers are used to indicate the type of information in the storage area. For example, the system structure directory includes the correspondence between storage area identifier 1 and information type identifier A, and the correspondence between storage area identifier 2 and information type identifier B. If information type identifier A indicates index information, then the storage area indicated by storage area identifier 1 stores index information; if information type identifier B indicates data blocks, then the storage area indicated by storage area identifier 2 stores data blocks.

[0088] In addition, each file system has a fixed data storage structure. Based on the system structure directory corresponding to the computer device, the data storage structure of the file system corresponding to that computer device can be determined, thereby determining the data block storage area. Figure 4 This is a schematic diagram of a file system's data storage structure. The file system includes the Master Boot Record (MBR), Super Block (SB), File System (FS) structure, and data block storage area. The Master Boot Record is the first sector that must be read when accessing the hard drive after the computer boots up. The Super Block is located at the root of the file system and is used to describe and maintain the state of the file system. A file system is a method of storing and organizing data, which makes accessing and searching data easy.

[0089] In one possible implementation, the computer device includes an index information storage area and a data block storage area. In this case, step 301 includes: in response to a file recovery instruction, reading the system structure directory of the file system, determining the location of the index information storage area and the data block storage area, reading the index information storage area according to the location of the index information storage area to obtain multiple index information entries, and reading the data block storage area according to the location of the data block storage area to obtain multiple data blocks.

[0090] The system structure directory is used to indicate the location of multiple storage areas. By reading the system structure directory, the location of any one or more storage areas can be determined.

[0091] In one possible implementation, the computer device is a terminal, and the terminal has a file recovery application installed. Then step 301 includes: starting the file recovery application, displaying a file recovery button in the application interface of the file recovery application, and in response to the triggering operation of the file recovery button, determining multiple stored index information and multiple data blocks.

[0092] The File Recovery application is for recovering deleted files, and the File Recovery button is used to trigger the file recovery command.

[0093] Optionally, a file recovery button and multiple file type identifiers are displayed in the application interface. When a target type identifier is selected, in response to the triggering operation of the file recovery button, multiple stored index information and multiple data blocks are determined.

[0094] The file type identifier is used to indicate the file type, and different file type identifiers indicate different file types. For example, multiple file type identifiers include file type identifier 1, file type identifier 2, and file type identifier 3. File type identifier 1 indicates text type, file type identifier 2 indicates video type, file type identifier 3 indicates image type, etc.

[0095] By displaying multiple file type identifiers, users can select the file type identifier they need to recover. By selecting the target type identifier, only files belonging to the target file type can be recovered subsequently, without having to recover files of other file types, thereby improving the efficiency of file recovery.

[0096] In one possible implementation, the computer device is a terminal, and the terminal has a file recovery application installed. Then step 301 includes: starting the file recovery application, displaying a file recovery button and multiple file type identifiers in the application interface of the file recovery application, and when the target type identifier is selected, in response to the triggering operation of the file recovery button, reading the current system structure directory, determining the location of the index information storage area and the data block storage area, and reading the index information storage area and the data block storage area respectively according to the location of the index information storage area and the data block storage area to obtain multiple index information and multiple data blocks.

[0097] In one possible implementation, where the computer device is a server, step 301 includes: the server receiving a file recovery request sent by the terminal, and determining, based on the file recovery request, multiple stored index information entries and multiple data blocks. Optionally, the terminal launches a file recovery application, displays a file recovery button in the application interface of the file recovery application, and sends a file recovery request in response to triggering the file recovery button.

[0098] 302. A computer device queries at least one target data block from multiple data blocks based on multiple index information.

[0099] In this embodiment, when the file, its corresponding data block, and its corresponding index information are not deleted, the index information satisfies the indexing conditions. Specifically, the index information includes a file identifier and a data block identifier, or it conforms to an index information format and can indicate the correspondence between the file and the data block. However, when any file is deleted, the corresponding index information is deleted, or part of the index information is deleted, making it impossible to determine the correspondence between some data blocks and the file. Therefore, by using multiple index information entries, the target data block corresponding to the deleted file is selected from multiple data blocks so that the deleted file can be recovered subsequently based on the target data block.

[0100] In cases where deleting any file results in the deletion of some information in the index information corresponding to that file, the index information may no longer meet the indexing conditions. Specifically, the index information may not include a file identifier, or it may not include a data block identifier, or it may not include both a file identifier and a data block identifier, or the format of the index information may not meet the index information format. Therefore, when any index information does not meet the indexing conditions, it indicates that the file corresponding to that index information has been deleted. In this case, the data block corresponding to that index information is extracted as the target data block for subsequent recovery of the deleted file.

[0101] In one possible implementation, step 302 includes: querying target index information that does not meet the index conditions from multiple index information, identifying the data block corresponding to the target data block identifier in the target index information, and determining it as the target data block.

[0102] The target index information consists of indexes that do not meet the indexing criteria, i.e., incomplete index information. Since deleting the file corresponding to the target index information results in the deletion of some information within the target index information, making it incomplete, finding incomplete index information confirms that the file corresponding to it has been deleted. Therefore, it is necessary to extract the data blocks corresponding to the incomplete index information to facilitate the subsequent recovery of the deleted file.

[0103] Optionally, after obtaining multiple index information entries, the multiple index information entries are traversed to determine the target index information entries that do not meet the index conditions.

[0104] In one possible implementation, step 302 includes: determining the data block identifiers included in multiple index information, and identifying the other data blocks among the multiple data blocks, excluding the data block corresponding to the determined data block identifier, as the target data block.

[0105] Since the index information corresponding to the file is deleted when a file is deleted, some data blocks will not have corresponding index information. Therefore, from multiple data blocks, the data blocks whose index information does not correspond to the data block identifier are selected, which are the data blocks of the deleted file.

[0106] Optionally, based on the data block identifiers included in the multiple index information, multiple data blocks are traversed, and other data blocks besides the data block corresponding to the determined data block identifier are selected from the multiple data blocks and determined as the target data block.

[0107] It should be noted that the embodiments of this application are illustrated by taking the determination of target data blocks through index information as an example. In another embodiment, steps 301-302 are not required. When a file recovery instruction is received, other methods are used to determine the multiple target data blocks corresponding to the deleted file.

[0108] 303. The computer device identifies the starting data block and non-starting data blocks among multiple target data blocks.

[0109] In the embodiments of this application, any file is obtained by concatenating at least one data block. In the at least one data block, the data header of the first data block includes a type string indicating the file type to which the file belongs, while the data headers of the other data blocks do not include a type string. Therefore, the starting data block and non-starting data blocks are identified from multiple target data blocks so that when concatenating data blocks later, the starting data block is used as the first data block in the file to be recovered and concatenated with other non-starting data blocks to obtain the recovered file, thereby improving the efficiency of file recovery.

[0110] The header of the starting data block (HEAD BLOCK) includes a type string, while the header of non-starting data blocks does not include a type string.

[0111] The type string is used to represent the file type. Optionally, this type string is a MagicNumber, and different file types correspond to different strings. For example, the type string for a taz (a type of compressed file) file type is 8b1f0008, and the file extension for a taz file type is .tar.gz; the type string for a binlog (a type of binary log) file type is 62fe6e69. The binlog is used to record information about user updates to the database, such as SQL (Structured Query Language) statements that modify database tables and content; the type string for a tar file type is usTar, and the type string for a rar file type is rar.

[0112] Optionally, the starting data block includes multiple characters, and the data header of the starting data block includes a type string, with the characters following the type string representing the content of the file.

[0113] In one possible implementation, the file recovery instruction carries a target type identifier, which is used to indicate the file type to which the target file to be recovered belongs; step 303 includes: determining the target type string corresponding to the target type identifier, and identifying the starting data block and non-starting data blocks among multiple target data blocks based on the target type string.

[0114] In this embodiment of the application, the deleted file may include files of multiple file types. When the file recovery instruction carries a target type identifier, it means that only the file of the target file type indicated by the target type identifier needs to be recovered, and there is no need to recover files of other file types. Therefore, when filtering the data blocks of the file to be recovered, only the starting data block containing the target type string needs to be filtered out, and data blocks containing other type strings are no longer considered, thereby improving the efficiency of file recovery.

[0115] 304. The computer device concatenates the starting data block and the non-starting data block to obtain at least one target file.

[0116] In this embodiment, each file includes at least one data block. Optionally, any file may include one data block, or the file may include multiple data blocks. When a file includes one data block, the corresponding file can be created using that data block. When a file includes multiple data blocks, the starting data block and non-starting data blocks are determined, and then concatenated to obtain the corresponding file. Optionally, the starting data block and non-starting data blocks are concatenated using the CAT (Concatenate) command to obtain at least one target file.

[0117] Since the starting data blocks obtained from multiple data blocks include one or more, and each starting data block corresponds to a file, one or more target files can be obtained by concatenating the starting data blocks and non-starting data blocks.

[0118] In this embodiment of the application, the starting data block identified from multiple data blocks includes one or more, and the non-starting data blocks include one or more. Depending on the number of starting data blocks and non-starting data blocks, step 304 includes the following three methods:

[0119] In the first method, there is one starting data block and one non-starting data block. Step 304 includes step 3041:

[0120] 3041. Concatenate the starting data block with the non-starting data block to obtain a target file.

[0121] In this embodiment, the starting data block is the first data block of the file, and the non-starting data blocks are the other data blocks in the file besides the first data block. Therefore, when there is only one starting data block and one non-starting data block, concatenating the starting data block and the non-starting data block can yield a target file.

[0122] In one possible implementation, the starting data block includes a first string, and the non-starting data block includes a second string. Then step 3041 includes: concatenating the first string and the second string to obtain a concatenated string, and identifying the concatenated string as a target file.

[0123] In this embodiment of the application, during the process of concatenating multiple data blocks, the concatenated data blocks need to be verified to ensure their accuracy, thereby improving the accuracy of the file. Furthermore, tail verification is performed on the concatenated data blocks to determine whether the file has ended, ensuring file integrity. In one possible implementation, step 3041 includes: in response to the starting data block not meeting the end condition, concatenating the starting data block with non-starting data blocks to obtain a concatenated data block; and in response to the concatenated data block meeting both the concatenation and end conditions, identifying the concatenated data block as a target file.

[0124] The concatenation condition is that if the data block read operation is successful, any concatenated data block that meets the concatenation condition is considered correctly concatenated, meaning that the concatenation order of at least two data blocks forming the concatenated data block is correct. If the read operation on the concatenated data block fails, it means that the concatenation order of at least two data blocks forming the concatenated data block is incorrect. The termination condition is that the data block includes an end-of-file string at the end of the data, which is used to indicate the end of the file.

[0125] Optionally, the ending string is a type string. If the header of the concatenated data block includes a type string, and the tail of the concatenated data block includes an ending string, and the ending string is a type string, then the type string in the header is the same as the ending string. For example, in the concatenated data block corresponding to the target file, the header of the concatenated data block includes the type string 1, and the tail of the concatenated data block includes the type string 1.

[0126] Alternatively, the ending string can be any other string. For example, the ending string could be 16 zeros, or 16 ones, etc.

[0127] By using concatenation and termination conditions, the accuracy and integrity of the concatenated data blocks are ensured, thereby improving the accuracy and integrity of the recovered files.

[0128] In one possible implementation, after obtaining the concatenated data block, the process of verifying whether the concatenated data block meets the concatenation conditions includes: calling a target reading tool that matches the type string in the starting data block, performing a reading operation on the concatenated data block, determining that the concatenated data block meets the concatenation conditions in response to the target reading tool reading the same end position as the end position of the concatenated data block, and determining that the concatenated data block does not meet the concatenation conditions in response to the reading tool reading the same end position as the end position of the concatenated data block.

[0129] Among them, the target reading tool for type string matching is used to read files that belong to the file type indicated by the type string. For example, if the file is a video, the reading tool is a video player; if the file is text, the reading tool is a text reader, etc.

[0130] Optionally, the end position of the read tool can be monitored via the / proc (a file system) system. For example, monitoring / proc / <pid> / fd / 0 (the reading process of the reading tool) is used to determine the end position of the reading tool's reading process.

[0131] In this embodiment, any file is composed of multiple data blocks concatenated sequentially. When reading the file using a reading tool matched to that file, the entire file can be read according to the order of the data blocks, meaning the end position of the file can be reached. Therefore, when the reading tool performs a reading operation on the concatenated data block, if the reading tool can read the end position of the concatenated data block, it indicates that the reading operation on the concatenated data block was successful, the concatenated data block is correctly concatenated, and the concatenated data block meets the concatenation conditions. If the reading tool cannot read the end position of the concatenated data block, it indicates that the reading operation on the concatenated data block was unsuccessful, the concatenated data block is incorrectly concatenated, and the concatenated data block does not meet the concatenation conditions.

[0132] For example, a file contains three data blocks, concatenated in the order of data block 1, data block 2, and data block 3. During the concatenation process, if the current concatenation order is data block 1 followed by data block 3, then when reading the current concatenated data block using a reading tool, only the end position of data block 1 can be read, but the end position of data block 3 cannot be read, thus determining that the current concatenation is incorrect. However, if the current concatenation order is data block 1 followed by data block 2, then when reading the current concatenated data block using a reading tool, the end position of data block 2 can be read, thus determining that the current concatenation is correct. Figure 5 As shown, the starting data block is concatenated with the Nth non-starting data block to obtain a concatenated data block. If the end position of the concatenated data block is at the end position of the starting data block instead of the end position of the concatenated data block when reading the concatenated data block with a reading tool, it indicates that the concatenated data block is not concatenated correctly.

[0133] Optionally, based on the type string in the starting data block, the file type corresponding to the type string is determined, and the reading tool corresponding to the file type is determined as the reading tool that matches the type string.

[0134] Since the type string included in the starting data block indicates the file type, and the file obtained by concatenating the starting data block with other data blocks also belongs to that file type, the reading tool corresponding to the file type is determined to be the reading tool that matches the type string, so that it can read the concatenated data block.

[0135] The second method, where there are multiple starting data blocks and only one non-starting data block, includes the following steps 3042-3044:

[0136] 3042. From multiple starting data blocks, identify the first data block whose data tail does not include the ending string.

[0137] In this embodiment, a file is obtained by concatenating at least one data block. The first data block includes a type string in its header, and the last data block includes an end string to indicate the start and end of the file's data. Furthermore, a non-starting data block cannot stand alone as a file; it must be concatenated with a starting data block to generate the corresponding file. Therefore, when there are multiple starting data blocks and only one non-starting data block, only one starting data block can be concatenated with that non-starting data block to form a file. Thus, from the multiple starting data blocks, the first data block whose data tail does not include an end string is identified, indicating that it needs to be concatenated with a non-starting data block to obtain a complete file.

[0138] 3043. Concatenate the first data block with the non-starting data block, and determine the concatenated data block as a target file.

[0139] By concatenating two data blocks, the data from the two blocks are combined into a single complete data block, which is then used as the target file for recovery.

[0140] 3044. Each second data block, excluding the first data block, from multiple starting data blocks is designated as a target file.

[0141] Since the header data of each second data block includes a type string and the tail data includes an end string, each second data block can represent a file. Therefore, each second data block is used as a target file to be recovered.

[0142] The third method, where there are one or more starting data blocks and multiple non-starting data blocks, includes the following steps 3045-3047:

[0143] 3045. Concatenate the starting data block with any non-starting data block to obtain the first concatenated data block that meets the concatenation conditions.

[0144] In the embodiments of this application, the starting data block includes one or more. If the starting data block includes one, then the starting data block is concatenated with multiple non-starting data blocks to obtain a file. If the starting data block includes multiple, then the multiple starting data blocks are concatenated with multiple non-starting data blocks to obtain multiple files, and the data blocks corresponding to different files are different from each other.

[0145] For any given starting data block, among multiple non-starting data blocks, only one non-starting data block can be concatenated with the starting data block to obtain a concatenated data block that satisfies the concatenation conditions. Therefore, each non-starting data block is concatenated with the starting data block, and the resulting concatenated data block is verified to obtain the first concatenated data block that satisfies the concatenation conditions.

[0146] In one possible implementation, step 3045 includes: concatenating the starting data block with any non-starting data block to obtain a first candidate data block; and in response to the failure of the read operation on the first candidate data block, concatenating the starting data block with any remaining non-starting data block until a first concatenated data block that meets the concatenation conditions is obtained.

[0147] The process involves concatenating the starting data block with any other starting data block to obtain a candidate data block. If the read operation on this candidate data block fails, it indicates that the concatenation of the starting data block with the non-starting data block is incorrect, and therefore the candidate data block cannot be read. Consequently, this data block needs to be concatenated with any of the remaining non-starting data blocks. Subsequently, a read operation is performed on the concatenated data block. If the read operation still fails, the above steps are repeated to continue concatenating with any of the remaining non-starting data blocks until the resulting concatenated data block meets the concatenation conditions.

[0148] 3046. In response to the first concatenated data block meeting the termination condition, the first concatenated data block is determined as a target file.

[0149] If the first concatenated data block includes an end string at the end of its data, indicating the end of the file, then the first concatenated data block is identified as a target file.

[0150] 3047. In response to the first concatenated data block not meeting the termination condition, continue to concatenate the first concatenated data block with any one or more remaining non-starting data blocks until a concatenated data block that meets the concatenation and termination conditions is obtained, and the concatenated data block is determined as a target file.

[0151] If the first concatenated data block does not meet the termination condition, it means that the file corresponding to the first concatenated data block is not yet finished. Other non-starting data blocks need to be concatenated after the first concatenated data block. Therefore, the first concatenated data block is concatenated with the remaining non-starting data blocks to ensure that a complete file is obtained.

[0152] After concatenating the first concatenated data block with any remaining non-starting data block, it is necessary to determine whether the newly obtained concatenated data block meets the concatenation conditions. After obtaining the second concatenated data block that meets the concatenation conditions, it is then determined whether the second concatenated data block meets the termination conditions. If the second concatenated data block meets the termination conditions, it is used as a concatenated data block. If the second concatenated data block does not meet the termination conditions, it is concatenated with any remaining non-starting data block again. Then, the concatenated data block obtained is verified to meet both the concatenation and termination conditions. The above steps are repeated until a concatenated data block that meets both the concatenation and termination conditions is obtained.

[0153] It should be noted that the embodiments of this application are only illustrated by taking the concatenation of any starting data block with at least one non-starting data block to form a target file. If there are multiple starting data blocks, after the first starting data block is concatenated with at least one non-starting data block to form a target file, the second starting data block is concatenated with the remaining non-starting data blocks to obtain a second target file. The above steps are repeated to obtain multiple target files.

[0154] This application implements an automatic file recovery scheme that eliminates the need for manual file recovery, reducing manpower consumption. Furthermore, considering that the starting data block in the data blocks that form the file includes a type string, the scheme identifies multiple data blocks corresponding to the deleted file, determines different types of starting and non-starting data blocks, and then reassembles the data blocks according to the identified different types to recover the deleted file. This improves the accuracy and efficiency of file recovery.

[0155] Furthermore, during the process of concatenating multiple data blocks, the concatenated data blocks are verified through concatenation and termination conditions to ensure the correctness and integrity of the concatenated data blocks, thereby improving the success rate and accuracy of the file.

[0156] Furthermore, by selecting the file type of the file to be recovered, only the selected file type can be recovered, eliminating the need to recover other file types, thereby improving file recovery efficiency.

[0157] Based on the above embodiments, a file recovery process is provided, such as... Figure 6 As shown, the file recovery process includes:

[0158] 1. In response to file recovery commands, extract multiple target data blocks corresponding to the deleted file from multiple stored data blocks based on multiple stored index information.

[0159] 2. Identify the starting data block and multiple non-starting data blocks among multiple data blocks.

[0160] 3. Concatenate the starting data block with any non-starting data block to obtain the concatenated data block.

[0161] 4. Verify the correctness of the spliced ​​data block. Verify whether the spliced ​​data block meets the splicing conditions. If the spliced ​​data block does not meet the splicing conditions, proceed to step 5. If the spliced ​​data block meets the splicing conditions, proceed to step 6.

[0162] 5. Concatenate the starting data block with the remaining non-starting data block to obtain a new concatenated data block, and verify the correctness of the new concatenated data block again until a concatenated data block that meets the concatenation conditions is obtained, and then proceed to step 6.

[0163] 6. Perform tail verification on the concatenated data block to verify whether the concatenated data block meets the termination condition. If the termination condition is met, proceed to step 7; otherwise, proceed to step 8.

[0164] 7. Combine the concatenated data blocks into a single target file.

[0165] 8. Perform concatenation processing on the concatenated data block and the next non-starting data block until a concatenated data block that meets the concatenation and termination conditions is obtained. Concatenate the concatenated data block that meets the concatenation and termination conditions as a file.

[0166] Based on the above embodiments, a process for extracting data blocks is provided, such as... Figure 7 As shown, the process for extracting the data block includes:

[0167] 1. Scan the file system structure to determine the index information storage area and the data block storage area.

[0168] 2. Traverse multiple index information entries in the index information storage area to determine if any of them contain incomplete index information. If incomplete index information is included, proceed to step 3; otherwise, proceed to step 4.

[0169] 3. Based on the data block identifiers included in the incomplete index information, extract the corresponding data blocks as the target data blocks for the deleted files.

[0170] 4. Based on the data block identifiers included in multiple index information, traverse multiple data blocks and extract the data blocks that do not have a data block identifier, and use them as the target data blocks corresponding to the deleted files.

[0171] Based on the above embodiments, a data block splicing verification process is provided, such as... Figure 8 As shown, the data block splicing verification process includes:

[0172] 1. Concatenate the starting data block with a non-starting data block to obtain the concatenated data block.

[0173] 2. Verify the spliced ​​data block to determine whether the at least two data blocks that form the spliced ​​data block match. If they do not match, it means that the spliced ​​data block is not spliced ​​correctly, so proceed to step 3. If they match, it means that the spliced ​​data block is spliced ​​correctly, so proceed to step 4.

[0174] 3. Concatenate the starting data block with the remaining non-starting data block until a correctly concatenated data block is obtained, and then proceed to step 4.

[0175] 4. Perform end verification on the concatenated data block. If the verification is successful, the concatenated data block is treated as a file. If the verification fails, the concatenated data block is concatenated with the remaining non-starting data block until a concatenated data block that is correctly concatenated and whose end verification is successful is obtained. The concatenated data block that is correctly concatenated and whose end verification is successful is treated as a target file.

[0176] Figure 9 This is a schematic diagram of the structure of a file recovery device provided in an embodiment of this application, as shown below. Figure 9 As shown, the device includes:

[0177] The first determining module 901 is used to determine multiple target data blocks corresponding to the deleted file in response to the file recovery command;

[0178] The identification module 902 is used to identify the starting data block and non-starting data blocks among multiple target data blocks. The data header of the starting data block includes a type string, while the data header of the non-starting data block does not include a type string.

[0179] The splicing processing module 903 is used to splice the starting data block and the non-starting data block to obtain at least one target file.

[0180] In one possible implementation, there are multiple starting data blocks and one non-starting data block, such as... Figure 10 As shown, the splicing processing module 903 includes:

[0181] The first identification unit 9031 is used to identify, from multiple starting data blocks, a first data block whose data tail does not include an ending string;

[0182] The splicing processing unit 9032 is used to splice the first data block with the non-starting data block and determine the spliced ​​data block as a target file.

[0183] In another possible implementation, such as Figure 10 As shown, the device also includes:

[0184] The second determining module 904 is used to determine each of the second data blocks, excluding the first data block, as a target file from the multiple starting data blocks.

[0185] In another possible implementation, there are multiple non-starting data blocks, such as... Figure 10 As shown, the splicing processing module 903 includes:

[0186] The splicing processing unit 9032 is used to splice the starting data block with any non-starting data block to obtain a first spliced ​​data block that meets the splicing conditions, namely, the successful execution of the data block reading operation.

[0187] The first determining unit 9033 is used to determine the first concatenated data block as a target file in response to the first concatenated data block meeting the termination condition, wherein the termination condition is that the data end of the data block includes an end string.

[0188] In another possible implementation, such as Figure 10 As shown, the device also includes:

[0189] The third determining module 905 is used to respond to the first concatenated data block not meeting the termination condition by continuing to concatenate the first concatenated data block with any one or more remaining non-starting data blocks until a concatenated data block that meets the concatenation and termination conditions is obtained, and then determining the concatenated data block as a target file.

[0190] In another possible implementation, the splicing processing unit 9032 is used to splice the starting data block with any non-starting data block to obtain a first candidate data block; in response to the failure of the read operation on the first candidate data block, the starting data block is spliced ​​with any remaining non-starting data block until a first spliced ​​data block that meets the splicing conditions is obtained.

[0191] In another possible implementation, such as Figure 10 As shown, the device also includes:

[0192] Execution module 906 is used to call the target reading tool that matches the type string in the starting data block to perform a reading operation on any concatenated data block;

[0193] The fourth determining module 907 is used to determine that the spliced ​​data block meets the splicing conditions in response to the fact that the end position read by the target reading tool is the same as the end position of the spliced ​​data block.

[0194] The fourth determining module 907 is also used to determine that the concatenated data block does not meet the concatenation conditions in response to the fact that the end position read by the reading tool is different from the end position of the concatenated data block.

[0195] In another possible implementation, such as Figure 10 As shown, the device also includes:

[0196] The fifth determining module 908 is used to determine the file type corresponding to the type string based on the type string in the starting data block;

[0197] The sixth determination module 909 is used to determine the reading tool corresponding to the file type as the reading tool that matches the type string.

[0198] In another possible implementation, such as Figure 10 As shown, the first determining module 901 includes:

[0199] The second determining unit 9011 is used to determine, in response to a file recovery instruction, multiple stored index information and multiple data blocks, wherein each index information includes at least one of a file identifier or a data block identifier, and the file indicated by the file identifier includes the data block indicated by the data block identifier in the same index information;

[0200] The query unit 9012 is used to query at least one target data block in multiple data blocks based on multiple index information. The multiple index information does not include index information corresponding to the target data block and satisfying the index conditions. The index conditions refer to the index information including file identifier and data block identifier, or the index information satisfying the index information format.

[0201] In another possible implementation, the query unit 9012 is used to query target index information that does not meet the index conditions from multiple index information; and to identify the data block corresponding to the target data block identifier in the target index information as the target data block.

[0202] In another possible implementation, the query unit 9012 is used to determine the data block identifiers included in multiple index information; and to determine the other data blocks among the multiple data blocks, excluding the data block corresponding to the determined data block identifier, as the target data block.

[0203] In another possible implementation, the file recovery instruction carries a target type identifier, which indicates the file type to which the target file to be recovered belongs;

[0204] like Figure 10 As shown, the recognition module 902 includes:

[0205] The third determining unit 9021 is used to determine the target type string corresponding to the target type identifier;

[0206] The second identification unit 9022 is used to identify the starting data block and non-starting data blocks among multiple target data blocks according to the target type string. The data header of the starting data block includes the target type string.

[0207] Figure 11 A structural block diagram of an electronic device 1100 provided in an exemplary embodiment of this application is shown. The electronic device 1100 may be a portable mobile terminal, such as a smartphone, tablet computer, MP3 player (Moving Picture Experts Group Audio Layer III), MP4 player (Moving Picture Experts Group Audio Layer IV), laptop computer, or desktop computer. The electronic device 1100 may also be referred to as a user device, portable terminal, laptop terminal, desktop terminal, or other names.

[0208] Electronic device 1100 includes: processor 1101 and memory 1102.

[0209] Processor 1101 may include one or more processing cores, such as a quad-core processor, an octa-core processor, etc. Processor 1101 may be implemented using at least one hardware form selected from DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). Processor 1101 may also include a main processor and a coprocessor. The main processor, also known as a CPU (Central Processing Unit), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, processor 1101 may integrate a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, processor 1101 may also include an AI (Artificial Intelligence) processor, which is used to handle computational operations related to machine learning.

[0210] The memory 1102 may include one or more computer-readable storage media, which may be non-transitory. The memory 1102 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In some embodiments, the non-transitory computer-readable storage media in the memory 1102 are used to store at least one program code, which is executed by the processor 1101 to implement the file recovery method provided in the method embodiments of this application.

[0211] In some embodiments, the electronic device 1100 may also optionally include: a peripheral device interface 1103 and at least one peripheral device. The processor 1101, memory 1102, and peripheral device interface 1103 can be connected via a bus or signal line. Each peripheral device can be connected to the peripheral device interface 1103 via a bus, signal line, or circuit board. Specifically, the peripheral device includes at least one of: a radio frequency circuit 1104, a display screen 1105, a camera assembly 1106, an audio circuit 1107, a positioning assembly 1108, and a power supply 1109.

[0212] Peripheral device interface 1103 can be used to connect at least one I / O (Input / Output) related peripheral device to processor 1101 and memory 1102. In some embodiments, processor 1101, memory 1102 and peripheral device interface 1103 are integrated on the same chip or circuit board; in some other embodiments, any one or two of processor 1101, memory 1102 and peripheral device interface 1103 can be implemented on separate chips or circuit boards, which is not limited in this embodiment.

[0213] The radio frequency (RF) circuit 1104 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The RF circuit 1104 communicates with communication networks and other communication devices via electromagnetic signals. The RF circuit 1104 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals back into electrical signals. Optionally, the RF circuit 1104 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a user identity module card, etc. The RF circuit 1104 can communicate with other terminals via at least one wireless communication protocol. This wireless communication protocol includes, but is not limited to: the World Wide Web, metropolitan area networks, intranets, various generations of mobile communication networks (2G, 3G, 4G, and 5G), wireless local area networks, and / or WiFi (Wireless Fidelity) networks. In some embodiments, the RF circuit 1104 may also include circuitry related to NFC (Near Field Communication), which is not limited in this application.

[0214] Display screen 1105 is used to display a UI (User Interface). This UI may include graphics, text, icons, videos, and any combination thereof. When display screen 1105 is a touch display screen, it also has the ability to collect touch signals on or above its surface. These touch signals can be input as control signals to processor 1101 for processing. In this case, display screen 1105 can also be used to provide virtual buttons and / or a virtual keyboard, also known as soft buttons and / or a soft keyboard. In some embodiments, there may be one display screen 1105, disposed on the front panel of electronic device 1100; in other embodiments, there may be at least two display screens, disposed on different surfaces of electronic device 1100 or in a folded design; in still other embodiments, display screen 1105 may be a flexible display screen, disposed on a curved or folded surface of electronic device 1100. Furthermore, display screen 1105 may be configured as a non-rectangular, irregular shape, i.e., a non-rectangular screen. The display screen 1105 can be made of materials such as LCD (Liquid Crystal Display) and OLED (Organic Light-Emitting Diode).

[0215] The camera assembly 1106 is used to acquire images or videos. Optionally, the camera assembly 1106 includes a front-facing camera and a rear-facing camera. The front-facing camera is disposed on the front panel of the terminal, and the rear-facing camera is disposed on the back of the terminal. In some embodiments, there are at least two rear-facing cameras, which are any one of a main camera, a depth-sensing camera, a wide-angle camera, and a telephoto camera, to achieve background blurring by fusion of the main camera and the depth-sensing camera, panoramic shooting by fusion of the main camera and the wide-angle camera, VR (Virtual Reality) shooting, or other fusion shooting functions. In some embodiments, the camera assembly 1106 may also include a flash. The flash can be a single-color temperature flash or a dual-color temperature flash. A dual-color temperature flash refers to a combination of a warm light flash and a cool light flash, which can be used for light compensation at different color temperatures.

[0216] The audio circuit 1107 may include a microphone and a speaker. The microphone is used to collect sound waves from the user and the environment, converting the sound waves into electrical signals that are input to the processor 1101 for processing, or input to the radio frequency circuit 1104 for voice communication. For stereo sound acquisition or noise reduction purposes, multiple microphones may be used, each located at a different part of the electronic device 1100. The microphone may also be an array microphone or an omnidirectional microphone. The speaker is used to convert electrical signals from the processor 1101 or the radio frequency circuit 1104 into sound waves. The speaker may be a conventional diaphragm speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can convert electrical signals not only into audible sound waves but also into inaudible sound waves for purposes such as distance measurement. In some embodiments, the audio circuit 1107 may also include a headphone jack.

[0217] Positioning component 1108 is used to locate the current geographical location of electronic device 1100 in order to enable navigation or LBS (Location Based Service). Positioning component 1108 can be a positioning component based on the US GPS (Global Positioning System), China's BeiDou system, or Russia's Galileo system.

[0218] Power supply 1109 is used to supply power to various components in electronic device 1100. Power supply 1109 can be alternating current, direct current, a disposable battery, or a rechargeable battery. When power supply 1109 includes a rechargeable battery, the rechargeable battery can be a wired rechargeable battery or a wireless rechargeable battery. A wired rechargeable battery is a battery that is charged via a wired line, and a wireless rechargeable battery is a battery that is charged via a wireless coil. The rechargeable battery can also be used to support fast charging technology.

[0219] In some embodiments, the electronic device 1100 further includes one or more sensors 1110. The one or more sensors 1110 include, but are not limited to: an accelerometer 1111, a gyroscope 1112, a pressure sensor 1113, a fingerprint sensor 1114, an optical sensor 1115, and a proximity sensor 1116.

[0220] Accelerometer 1111 can detect the magnitude of acceleration on the three coordinate axes of a coordinate system established by electronic device 1100. For example, accelerometer 1111 can be used to detect the components of gravitational acceleration on the three coordinate axes. Processor 1101 can control display screen 1105 to display the user interface in either a landscape or portrait view based on the gravitational acceleration signal acquired by accelerometer 1111. Accelerometer 1111 can also be used for games or for acquiring user motion data.

[0221] The gyroscope sensor 1112 can detect the orientation and rotation angle of the electronic device 1100. The gyroscope sensor 1112 can work in conjunction with the accelerometer sensor 1111 to collect the user's 3D movements on the electronic device 1100. Based on the data collected by the gyroscope sensor 1112, the processor 1101 can perform the following functions: motion sensing (e.g., changing the UI based on the user's tilt), image stabilization during shooting, game control, and inertial navigation.

[0222] Pressure sensor 1113 can be disposed on the side bezel of electronic device 1100 and / or on the lower layer of display screen 1105. When pressure sensor 1113 is disposed on the side bezel of electronic device 1100, it can detect the user's grip signal on electronic device 1100, and processor 1101 can perform left / right hand recognition or quick operation based on the grip signal collected by pressure sensor 1113. When pressure sensor 1113 is disposed on the lower layer of display screen 1105, processor 1101 can control operable controls on UI interface based on the user's pressure operation on display screen 1105. Operable controls include at least one of button controls, scroll bar controls, icon controls, and menu controls.

[0223] The fingerprint sensor 1114 is used to collect a user's fingerprint. The processor 1101 identifies the user based on the fingerprint collected by the fingerprint sensor 1114, or vice versa. When the user's identity is identified as trusted, the processor 1101 authorizes the user to perform relevant sensitive operations, including unlocking the screen, viewing encrypted information, downloading software, making payments, and changing settings. The fingerprint sensor 1114 can be located on the front, back, or side of the electronic device 1100. When the electronic device 1100 has a physical button or manufacturer logo, the fingerprint sensor 1114 can be integrated with the physical button or manufacturer logo.

[0224] An optical sensor 1115 is used to collect ambient light intensity. In one embodiment, the processor 1101 can control the display brightness of the display screen 1105 based on the ambient light intensity collected by the optical sensor 1115. Specifically, when the ambient light intensity is high, the display brightness of the display screen 1105 is increased; when the ambient light intensity is low, the display brightness of the display screen 1105 is decreased. In another embodiment, the processor 1101 can also dynamically adjust the shooting parameters of the camera assembly 1106 based on the ambient light intensity collected by the optical sensor 1115.

[0225] A proximity sensor 1116, also known as a distance sensor, is installed on the front panel of the electronic device 1100. The proximity sensor 1116 is used to detect the distance between the user and the front of the electronic device 1100. In one embodiment, when the proximity sensor 1116 detects that the distance between the user and the front of the electronic device 1100 is gradually decreasing, the processor 1101 controls the display screen 1105 to switch from a screen-on state to a screen-off state; when the proximity sensor 1116 detects that the distance between the user and the front of the electronic device 1100 is gradually increasing, the processor 1101 controls the display screen 1105 to switch from a screen-off state to a screen-on state.

[0226] Those skilled in the art will understand that Figure 11 The structure shown does not constitute a limitation on the electronic device 1100, and may include more or fewer components than shown, or combine certain components, or use different component arrangements.

[0227] Figure 12 This is a schematic diagram of a server structure provided in an embodiment of this application. The server 1200 can vary significantly due to different configurations or performance. It may include one or more Central Processing Units (CPUs) 1201 and one or more memories 1202. The memory 1202 stores at least one line of program code, which is loaded and executed by the processor 1201 to implement the methods provided in the various method embodiments described above. Of course, the server may also have wired or wireless network interfaces, a keyboard, and input / output interfaces for input and output. The server may also include other components for implementing device functions, which will not be elaborated upon here.

[0228] Server 1200 can be used to perform the steps executed by the server in the above file recovery method.

[0229] This application also provides a computer device, which includes a processor and a memory. The memory stores at least one piece of program code, which is loaded and executed by the processor to perform the operations performed in the file recovery method of the above embodiments.

[0230] This application also provides a computer-readable storage medium storing at least one piece of program code, which is loaded and executed by a processor to implement the operations performed in the file recovery method of the above embodiments.

[0231] This application also provides a computer program product or computer program that includes computer program code stored in a computer-readable storage medium. A processor of a computer device reads the computer program code from the computer-readable storage medium and executes the computer program code, causing the computer device to perform the operations as described in the file recovery method of the above embodiments.

[0232] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.

[0233] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present application should be included within the protection scope of the present application.< / pid>

Claims

1. A file recovery method, characterized in that, The method includes: In response to a file recovery command, multiple target data blocks corresponding to the deleted file are identified. The file recovery command carries a target type identifier, which is used to indicate the file type to which the target file to be recovered belongs. Identify the starting data block and non-starting data blocks among the plurality of target data blocks. The data header of the starting data block includes a target type string, while the data header of the non-starting data block does not include the target type string. The type string is a string used to represent the file type, and different file types correspond to different type strings. The target type string is the type string corresponding to the target type identifier. The starting data block and the non-starting data block are concatenated to obtain at least one target file; The non-starting data blocks are multiple. The step of concatenating the starting data block and the non-starting data blocks to obtain at least one target file includes: concatenating the starting data block with any one of the non-starting data blocks to obtain a concatenated data block; in response to the concatenated data block satisfying the concatenation condition and the termination condition, determining the concatenated data block as a target file, wherein the concatenation condition is that the data block read operation is successfully executed, and the termination condition is that the data end of the data block includes an end string; The method further includes: invoking a target reading tool that matches the target type string in the starting data block to perform a reading operation on any concatenated data block; determining that the concatenated data block satisfies the concatenation condition in response to the end position read by the target reading tool being the same as the end position of the concatenated data block; and determining that the concatenated data block does not satisfy the concatenation condition in response to the end position read by the reading tool being different from the end position of the concatenated data block.

2. The method according to claim 1, characterized in that, The starting data block is multiple, and the non-starting data block is one. The process of concatenating the starting data block and the non-starting data block to obtain at least one target file includes: From the plurality of said starting data blocks, identify a first data block whose data tail does not include an ending string; The first data block is concatenated with the non-starting data block, and the resulting concatenated data block is determined as a target file.

3. The method according to claim 2, characterized in that, The method further includes: Each of the second data blocks, excluding the first data block, from the plurality of initial data blocks is determined as a target file.

4. The method according to claim 1, characterized in that, After concatenating the starting data block with any of the non-starting data blocks to obtain a concatenated data block, the method further includes: In response to the concatenated data block satisfying the concatenation condition but not the termination condition, the concatenated data block is continued to be concatenated with any one or more of the remaining non-starting data blocks until a concatenated data block that satisfies both the concatenation condition and the termination condition is obtained, and the concatenated data block is identified as a target file.

5. The method according to claim 1, characterized in that, The step of concatenating the starting data block with any of the non-starting data blocks to obtain a concatenated data block includes: The starting data block is concatenated with any of the non-starting data blocks to obtain the first candidate data block; In response to the failure of the read operation on the first candidate data block, the starting data block is concatenated with any of the remaining non-starting data blocks until a concatenated data block that meets the concatenation conditions is obtained.

6. The method according to claim 5, characterized in that, The method further includes: Based on the target type string in the starting data block, determine the file type corresponding to the target type string; The reading tool corresponding to the file type is determined as the reading tool that matches the target type string.

7. The method according to claim 1, characterized in that, The step of responding to a file recovery command and determining multiple target data blocks corresponding to the deleted file includes: In response to the file recovery instruction, multiple stored index information and multiple data blocks are determined, each index information including at least one of a file identifier or a data block identifier, wherein the file indicated by the file identifier includes the data block indicated by the data block identifier in the same index information; Based on the multiple index information, at least one target data block is queried among the multiple data blocks. The multiple index information does not include index information corresponding to the target data block and satisfying the index conditions. The index conditions refer to the index information including a file identifier and a data block identifier, or the index information satisfying an index information format.

8. The method according to claim 7, characterized in that, The step of querying at least one target data block from the multiple data blocks based on the multiple index information includes: From the multiple index information entries, query the target index information that does not meet the index conditions; The data block corresponding to the target data block identifier in the target index information is identified as the target data block.

9. The method according to claim 7, characterized in that, The step of querying at least one target data block from the multiple data blocks based on the multiple index information includes: Determine the data block identifiers included in the multiple index information entries; The data blocks other than the data block corresponding to the determined data block identifier among the plurality of data blocks are identified as the target data blocks.

10. The method according to claim 1, characterized in that, The identification of the starting data block and non-starting data blocks among the plurality of target data blocks includes: Determine the target type string corresponding to the target type identifier; Based on the target type string, the starting data block and the non-starting data block among the plurality of target data blocks are identified, and the data header of the starting data block includes the target type string.

11. A file recovery device, characterized in that, The device includes: The first determining module is used to determine multiple target data blocks corresponding to the deleted file in response to a file recovery instruction. The file recovery instruction carries a target type identifier, which is used to indicate the file type to which the target file to be recovered belongs. The identification module is used to identify the starting data block and non-starting data blocks among the plurality of target data blocks. The data header of the starting data block includes a target type string, while the data header of the non-starting data block does not include the target type string. The type string is a string used to represent the file type. Different file types correspond to different type strings. The target type string is the type string corresponding to the target type identifier. The splicing processing module is used to splice the starting data block and the non-starting data block to obtain at least one target file; There are multiple non-starting data blocks. The splicing processing module is used to splice the starting data block with any one of the non-starting data blocks to obtain a spliced ​​data block. In response to the spliced ​​data block satisfying the splicing condition and the termination condition, the spliced ​​data block is determined as a target file. The splicing condition is that the data block reading operation is successfully executed, and the termination condition is that the data end of the data block includes an end string. The device further includes: The execution module is used to call the target reading tool that matches the type string in the starting data block to perform a reading operation on any concatenated data block; The fourth determining module is used to determine that the spliced ​​data block satisfies the splicing condition in response to the fact that the end position read by the target reading tool is the same as the end position of the spliced ​​data block; The fourth determining module is further configured to determine that the splicing data block does not meet the splicing conditions in response to the fact that the end position read by the reading tool is different from the end position of the spliced ​​data block.

12. A computer device, characterized in that, The computer device includes a processor and a memory, the memory storing at least one line of program code, which is loaded and executed by the processor to perform the operations performed in the file recovery method as described in any one of claims 1 to 10.

13. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores at least one piece of program code, which is loaded and executed by a processor to perform the operations performed in the file recovery method as described in any one of claims 1 to 10.