File recovery method, file backup method, storage device, processing device and storage medium

By using full and incremental backup records during file backup and recovery, combined with file block identification and version number, the complex problems of redundant data increase and recovery operations in the existing technology are solved, and efficient and accurate file recovery and backup are achieved.

CN119847822AActive Publication Date: 2025-04-18BEIJING SENSESHIELD TECH CO LTD
View PDF 9 Cites 0 Cited by

Patent Information

Application Number
CN202411992204.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-31
Publication Date
2025-04-18
Estimated Expiration
2044-12-31

AI Technical Summary

Technical Problem

The prior art has problems in the process of file backup and recovery, which increases redundant data and takes up a lot of storage space and computing resources. The recovery operation is complex and time-consuming, and it is impossible to implement a fine-grained recovery mechanism.

Method used

By storing full backup records and incremental backup records on the storage device, precise file recovery and backup is performed using the identification and version number of the file block, and incremental backups are performed only when the content of the file block changes, reducing redundant data storage.

Benefits of technology

Optimizes the efficiency and accuracy of file recovery, reduces redundant data storage, improves backup efficiency, and implements a more flexible recovery mechanism.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119847822A_ABST
    Figure CN119847822A_ABST
Patent Text Reader

Abstract

The invention discloses a file recovery method, a file backup method, a storage device, a processing device and a storage medium. The file recovery method comprises the following steps: receiving a recovery request sent by a second processing device, wherein the recovery request is used for requesting to recover a target file at a target moment; a target backup record is determined, and the target backup record comprises a full-amount backup record corresponding to the last full-amount backup operation before the target moment and all incremental backup records between backup time corresponding to the last full-amount backup operation and the target moment; based on the target backup record, determining a latest version number corresponding to each second identifier; and sending the file blocks corresponding to the latest version number to the second processing device, so that the second processing device combines the file blocks corresponding to the latest version number to obtain a target file at the target moment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of file backup, and in particular to a method for restoring a file, a method for backing up a file, a storage device, a processing device, and a storage medium. Background Art

[0002] File backup and recovery is an important way to ensure data security and integrity. In the prior art, files are usually backed up by full backup and incremental backup. This method optimizes the problem of file redundancy caused by backing up all files each time. However, due to the singleness of the incremental backup detection method, it also leads to repeated backup of files when performing incremental backup, especially in the backup process of large files, which easily leads to the increase of redundant data and occupies a large amount of storage space and computing resources. In addition, after analysis, the inventor believes that the recovery operation often needs to rely on a complete backup chain, the recovery process may be complicated and time-consuming, and a fine-grained recovery mechanism cannot be implemented. Therefore, improving the accuracy and efficiency of backup, reducing redundant storage, and realizing a more flexible recovery mechanism are issues that need to be solved urgently. Summary of the invention

[0003] The purpose of the embodiments of the present application is to provide a method for restoring a file, a method for backing up a file, a storage device, a processing device, and a storage medium.

[0004] On the one hand, an embodiment of the present application provides a method for restoring a file, which is applied to a first storage device, wherein the first storage device stores a full backup record corresponding to at least one full backup operation of a backed up target file, and an incremental backup record corresponding to at least one incremental backup operation; wherein the target file has a corresponding first identifier, and each file block included in the target file has a second identifier associated with the first identifier; the full backup record includes at least the following associated information: the first identifier, the full version number of the file block corresponding to each of the second identifiers associated with the first identifier, and the backup time; the incremental backup record includes at least the following associated information: the first identifier, the second identifier corresponding to each of the changed blocks, the incremental version number corresponding to each of the changed blocks, and the backup time;

[0005] The method comprises:

[0006] receiving a recovery request sent by the second processing device, wherein the recovery request is used to request recovery of a target file at a target time;

[0007] Determine a target backup record, wherein the target backup record includes: a full backup record corresponding to the most recent full backup operation before the target time, and all incremental backup records between the backup time corresponding to the most recent full backup operation and the target time;

[0008] Based on the target backup record, respectively determine the latest version number corresponding to each second identifier;

[0009] The file blocks corresponding to the latest version number are sent to the second processing device, so that the second processing device combines the file blocks corresponding to the latest version number to obtain the target file at the target time.

[0010] Optionally, the method further includes:

[0011] Generate a file list at the target time, the file list including each second identifier associated with the first identifier and the latest version number corresponding to each second identifier, the file list representing the state of the target file at the target time;

[0012] The file list is sent to the second processing device, so that the second processing device performs file recovery on the file blocks received from the first storage device according to the file list.

[0013] Optionally, after receiving the recovery request sent by the second processing device, the method further includes:

[0014] receiving file blocks corresponding to all second identifiers associated with the first identifier on the second processing device;

[0015] Performing a temporary backup operation on the file blocks corresponding to all the second identifiers, and forming a temporary backup record corresponding to the temporary backup operation;

[0016] When the second processing device obtains the target file at the target time, in response to a rollback request sent from the second processing device, all file blocks backed up by the temporary backup operation are sent to the second processing device based on the temporary backup record.

[0017] Optionally, the method further includes:

[0018] Acquire a creation time of a target file corresponding to the first identifier on the second processing device;

[0019] If the creation time is later than the target time, a file deletion request is sent to the second processing device, so that the second processing device deletes the target file on the second processing device.

[0020] Optionally, the method further comprises:

[0021] In the case that the target file corresponding to the first identifier does not exist in the second processing device, a file creation request is sent to the second processing device, so that the second processing device creates a target file.

[0022] On the other hand, an embodiment of the present application provides a method for backing up files, characterized in that the method is applied to a first storage device, a target file to be backed up on a second processing device has a corresponding first identifier, and each file block included in the target file has a second identifier associated with the first identifier;

[0023] The method comprises:

[0024] receiving file blocks corresponding to all second identifiers associated with the first identifier on the second processing device;

[0025] Perform a full backup operation on all file blocks corresponding to the second identifiers;

[0026] Forming a full backup record corresponding to the full backup operation; wherein the full backup record includes at least the following associated information: the first identifier, version numbers of the file blocks corresponding to all the second identifiers associated with the first identifier, and the backup time;

[0027] receiving a changed block, wherein the changed block is a file block in the target file corresponding to the first identifier on the second processing device that has changed after a last backup operation;

[0028] Performing an incremental backup operation on the changed blocks;

[0029] An incremental backup record corresponding to the incremental backup operation is formed; wherein the incremental backup record includes at least the following associated information: the first identifier, the second identifier corresponding to each of the changed blocks, the version number corresponding to each of the changed blocks, and the backup time.

[0030] Optionally, before receiving the change block, the method further includes:

[0031] Sending a first time to the second processing device, where the first time is a backup time corresponding to a previous backup operation;

[0032] In the case where the update time of the target file corresponding to the first identifier is later than the first time, receiving all second identifiers and corresponding first file fingerprints; wherein the first file fingerprint is a file fingerprint of a file block on the second processing device;

[0033] Determine a file block having the same second identifier but different corresponding first file fingerprint and second file fingerprint as a changed block; wherein the second file fingerprint is the file fingerprint of the file block having the latest version number on the first storage device;

[0034] Adding the second identifier corresponding to the changed block to the to-be-backed-up list;

[0035] The to-be-backed-up list is sent to the second processing device, so that the second processing device searches for the changed block according to the second identifier included in the to-be-backed-up list.

[0036] Optionally, before receiving the change block, the method further includes:

[0037] Sending a first time to the second processing device, where the first time is a backup time corresponding to a previous backup operation;

[0038] receiving a second identifier corresponding to an update block and a corresponding first file fingerprint, wherein the update block is a file block determined from file blocks of a target file corresponding to the first identifier on the second processing device and updated later than the first time; and the first file fingerprint is a file fingerprint of the file block on the second processing device;

[0039] Determine the update block with the same second identifier but different corresponding first file fingerprint and second file fingerprint as a change block; wherein the second file fingerprint is the file fingerprint of the file block with the latest version number on the first storage device;

[0040] Adding the second identifier corresponding to the changed block to the to-be-backed-up list;

[0041] The to-be-backed-up list is sent to the second processing device, so that the second processing device searches for the changed block according to the second identifier included in the to-be-backed-up list.

[0042] On the other hand, an embodiment of the present application proposes another method for backing up files, which is applied to a second processing device, wherein a target file to be backed up has a corresponding first identifier, and each file block included in the target file has a second identifier associated with the first identifier;

[0043] The method comprises:

[0044] Sending the file blocks corresponding to all the second identifiers associated with the first identifier on the second processing device to the first storage device, so that the first storage device performs a full backup operation and forms a full backup record corresponding to the full backup operation; wherein the full backup record includes at least the following associated information: the first identifier, the version numbers of the file blocks corresponding to all the second identifiers associated with the first identifier, and the backup time;

[0045] Send the changed blocks to the first storage device, so that the first storage device performs an incremental backup operation and forms an incremental backup record corresponding to the incremental backup operation; wherein the changed blocks are file blocks in the target file corresponding to the first identifier on the second processing device, which have changed after the last backup operation; the incremental backup record includes at least the following related information: the first identifier, the second identifier corresponding to each of the changed blocks, the version number corresponding to each of the changed blocks, and the backup time.

[0046] Optionally, before sending the changed block to the first storage device, the method further includes:

[0047] Acquire a first time, where the first time is a backup time corresponding to the last backup operation;

[0048] When the update time of the target file corresponding to the first identifier is later than the first time, sending all second identifiers and corresponding first file fingerprints to the first storage device, wherein the first file fingerprint is the file fingerprint of the file block on the second processing device;

[0049] Receive a list to be backed up, the list to be backed up includes a second identifier corresponding to a changed block; wherein the changed block is a file block having the same second identifier but a corresponding first file fingerprint and a corresponding second file fingerprint that are different; the second file fingerprint is a file fingerprint of a file block having a latest version number on the first storage device;

[0050] The changed block is searched according to the second identifier included in the to-be-backed-up list.

[0051] Optionally, before sending the changed block to the first storage device, the method further includes:

[0052] Acquire a first time, where the first time is a backup time corresponding to the last backup operation;

[0053] Determine an updated block from the file blocks of the target file corresponding to the first identifier, the updated block being a file block updated later than the first time on the second processing device;

[0054] Sending a second identifier corresponding to the update block and a corresponding first file fingerprint to the first storage device, wherein the first file fingerprint is a file fingerprint of the file block on the second processing device;

[0055] Receive a list to be backed up, the list to be backed up includes a second identifier corresponding to a changed block; wherein the changed block is an update block having the same second identifier but a corresponding first file fingerprint and a corresponding second file fingerprint that are different; the second file fingerprint is a file fingerprint of a file block having a latest version number on the first storage device;

[0056] The changed block is searched according to the second identifier included in the to-be-backed-up list.

[0057] On the other hand, an embodiment of the present application provides a storage device, wherein the first storage device stores a full backup record corresponding to at least one full backup operation of a backed up target file and an incremental backup record corresponding to at least one incremental backup operation; wherein the target file has a corresponding first identifier, and each file block contained in the target file has a second identifier associated with the first identifier; the full backup record includes at least the following associated information: the first identifier, the full version number of the file block corresponding to each of the second identifiers associated with the first identifier, and the backup time; the incremental backup record includes at least the following associated information: the first identifier, the second identifier corresponding to each of the changed blocks, the incremental version number corresponding to each of the changed blocks, and the backup time; including:

[0058] A first acquisition module is configured to receive a recovery request sent by the second processing device, wherein the recovery request is used to request recovery of a target file at a target time;

[0059] A first determination module is configured to determine a target backup record, wherein the target backup record includes: a full backup record corresponding to the most recent full backup operation before the target time, and all incremental backup records between the backup time corresponding to the most recent full backup operation and the target time;

[0060] The first determination module is further configured to determine, based on the target backup record, the latest version number corresponding to each second identifier;

[0061] The first processing module is configured to send the file blocks corresponding to the latest version number to the second processing device, so that the second processing device combines the file blocks corresponding to the latest version number to obtain the target file at the target time.

[0062] On the other hand, an embodiment of the present application provides a storage device, including:

[0063] A second acquisition module is configured to receive file blocks corresponding to all second identifiers associated with the first identifier on the second processing device; wherein the target file to be backed up on the second processing device has a corresponding first identifier, and each file block included in the target file has a second identifier associated with the first identifier;

[0064] A first backup module is configured to perform a full backup operation on the file blocks corresponding to all the second identifiers;

[0065] A second determination module is configured to form a full backup record corresponding to the full backup operation; wherein the full backup record includes at least the following associated information: the first identifier, version numbers of file blocks corresponding to all second identifiers associated with the first identifier, and backup time;

[0066] The second acquisition module is further configured to receive a changed block, wherein the changed block is a file block in the target file corresponding to the first identifier on the second processing device that has changed after the last backup operation;

[0067] A second backup module configured to perform an incremental backup operation on the changed blocks;

[0068] The second determination module is also configured to form an incremental backup record corresponding to the incremental backup operation; wherein the incremental backup record includes at least the following associated information: the first identifier, the second identifier corresponding to each of the changed blocks, the version number corresponding to each of the changed blocks, and the backup time.

[0069] On the other hand, an embodiment of the present application provides a processing device, including:

[0070] A third acquisition module is configured to send the file blocks corresponding to all the second identifiers associated with the first identifier on the second processing device to the first storage device, so that the first storage device performs a full backup operation and forms a full backup record corresponding to the full backup operation; wherein the target file to be backed up has a corresponding first identifier, and each file block included in the target file has a second identifier associated with the first identifier; the full backup record includes at least the following associated information: the first identifier, the version numbers of the file blocks corresponding to all the second identifiers associated with the first identifier, and the backup time;

[0071] The third determination module is configured to send the changed blocks to the first storage device, so that the first storage device performs an incremental backup operation and forms an incremental backup record corresponding to the incremental backup operation; wherein the changed blocks are file blocks in the target file corresponding to the first identifier on the second processing device, which have changed after the last backup operation; and the incremental backup record includes at least the following related information: the first identifier, the second identifier corresponding to each of the changed blocks, the version number corresponding to each of the changed blocks, and the backup time.

[0072] On the other hand, an embodiment of the present disclosure provides a computer program product storing a computer program, wherein the computer program implements the steps of the above method when executed by a processor.

[0073] On the other hand, an embodiment of the present disclosure provides a storage medium, wherein the storage medium carries one or more computer programs, and the one or more computer programs implement the steps of the above method when executed by a processor.

[0074] This application realizes file recovery corresponding to a specified time by setting the identifier and version number of the backup file block, and can optimize the efficiency and accuracy of recovery for recovery requests at different time points, so as to restore the required files. This application also effectively tracks and manages each file block contained in the target file by setting an associated identifier for each file and file block, and by setting the identifier and version number of the backup file block, incremental backup is performed only after the content of the file block changes, which reduces redundant data storage and improves backup efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0075] Figure 1 A flowchart of a method for restoring files according to an embodiment of the present application;

[0076] Figure 2 Another flow chart of the method for restoring files according to an embodiment of the present application;

[0077] Figure 3 Another flow chart of the method for restoring files according to an embodiment of the present application;

[0078] Figure 4 Another flow chart of the method for restoring files according to an embodiment of the present application;

[0079] Figure 5 A flowchart of a method for backing up files according to an embodiment of the present application;

[0080] Figure 6 Another flow chart of the method for backing up files according to an embodiment of the present application;

[0081] Figure 7 Another flow chart of the method for backing up files according to an embodiment of the present application;

[0082] Figure 8 A flowchart of another method for backing up files according to an embodiment of the present application;

[0083] Fig. 9 A flowchart of a process for backing up files according to an embodiment of the present application;

[0084] Fig.10 This is a structural block diagram of a storage device according to an embodiment of the present application.

[0085] Fig.11 This is a structural block diagram of a storage device according to another embodiment of the present application.

[0086] Fig.12This is a structural block diagram of a processing device according to an embodiment of the present application. DETAILED DESCRIPTION

[0087] Various aspects and features of the present application are described herein with reference to the accompanying drawings.

[0088] It should be understood that various modifications may be made to the embodiments of the present application. Therefore, the above description should not be considered as limiting, but only as an example of an embodiment. Other modifications within the scope and spirit of the present application will occur to those skilled in the art.

[0089] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate embodiments of the present application and, together with the general description of the present application given above and the detailed description of the embodiments given below, serve to explain the principles of the present application.

[0090] These and other characteristics of the present application will become apparent from the following description of a preferred form of embodiment given as a non-limiting example with reference to the accompanying drawings.

[0091] It should also be understood that although the present application has been described with reference to some specific examples, those skilled in the art will be able to readily implement many other equivalent forms of the present application.

[0092] The above and other aspects, features and advantages of the present application will become more apparent in view of the following detailed description when taken in conjunction with the accompanying drawings.

[0093] Specific embodiments of the present application are described hereinafter with reference to the accompanying drawings; however, it should be understood that the embodiments applied for are merely examples of the present application, which may be implemented in a variety of ways. Well-known and / or repeated functions and structures are not described in detail to avoid unnecessary or redundant details that obscure the present application. Therefore, the specific structural and functional details applied for herein are not intended to be limiting, but merely serve as a basis and representative basis for the claims to teach those skilled in the art to use the present application in a variety of ways with substantially any suitable detailed structure.

[0094] This specification may use the phrases "in one embodiment," "in another embodiment," "in yet another embodiment," or "in other embodiments," all of which may refer to one or more of the same or different embodiments according to the present application.

[0095] The embodiment of the present application provides a method for restoring files, which is applied to a first storage device. The first storage device may be a backup server, which is used to back up and store files. The first storage device may also be a terminal device, for example, the terminal device may be a secure storage box. The target file is a file stored by the second processing device, which may be a file server, a client, or a terminal device. The target file may be a text, image, or other file. After the second processing device stores the target file, the target file needs to be backed up. The backup of the target file is performed by the first storage device. After the target file is backed up, the first storage device stores at least one full backup record corresponding to a full backup operation of the backed up target file and at least one incremental backup record corresponding to an incremental backup operation. The full backup is a backup operation performed on all file blocks in the target file, and the incremental backup is a backup operation performed when a file block in the target file changes. The target file has a corresponding first identifier, which is a unique identifier of the target file. The target file can be divided into multiple file blocks. Each file block contained in the target file has a second identifier associated with the first identifier. After the target file is divided into multiple file blocks, a unique second identifier can be assigned to each file block, and the second identifier of each file block forms a mapping association with the first identifier of the target file. After performing a full backup of each file block contained in the target file, a corresponding full backup record can be obtained, and the full backup record includes at least the following associated information: the first identifier, the full version number of the file block corresponding to each of the second identifiers associated with the first identifier, and the backup time; after performing an incremental backup of the file blocks contained in the target file, a corresponding incremental backup record can be obtained, and the incremental backup record includes at least the following associated information: the first identifier, the second identifier corresponding to each of the changed blocks, the incremental version number corresponding to each of the changed blocks, and the backup time.

[0096] For example, the target file has four file blocks a, b, c, and d. The first identifier of the target file is recorded as F1, and the second identifiers of file blocks a, b, c, and d are recorded as F1a, F1b, F1c, and F1d, respectively. After the target file is fully backed up at time t1, the full version numbers corresponding to file blocks a, b, c, and d are all v1.0; the full backup record of the target file at time t1 includes: the first identifier F1 of the target file, the full version number v1.0 corresponding to file blocks a, b, c, and d, and the backup time t1. If the target file is fully backed up at time t5, the full version number corresponding to file blocks a, b, c, and d is v2.0; the full backup record of the target file at time t5 includes: the first identifier F1 of the target file, the full version number v2.0 corresponding to file blocks a, b, c, and d, and the backup time t5.

[0097] For example, if file block a and file block b included in the target file are changed after the last backup operation at time t2, file block a and file block b are determined as changed blocks, an incremental backup operation is performed on file block a and file block b, and the incremental version numbers corresponding to file block a and file block b are recorded as v1.1; the incremental backup record of file block a and file block b included in the target file at time t2 includes: the first identifier F1 of the target file, the second identifier F1a of file block a, the second identifier F1b of file block b, the incremental version numbers v1.1 corresponding to file block a and file block b, and the backup time t2.

[0098] If file block a and file block c included in the target file are changed after the last backup operation at time t3, file block a and file block c are determined as changed blocks, and an incremental backup operation is performed on file block a and file block c, and the incremental version number corresponding to file block a and file block c is recorded as v1.2; the incremental backup record of file block a and file block c included in the target file at time t3 includes: the first identifier F1 of the target file, the second identifier F1a of file block a, the second identifier F1c of file block c, the incremental version number v1.2 corresponding to file block a and file block c, and the backup time t3.

[0099] Figure 1 A schematic diagram of the process of restoring files in the present application is shown, as shown in FIG. Figure 1 and Fig. 9 As shown, the method includes:

[0100] S101, receiving a recovery request sent by a second processing device, wherein the recovery request is used to request recovery of a target file at a target time;

[0101] In this embodiment, when the second processing device needs to restore the target file at the target time, it can send a restore request to the first storage device, where the restore request is used to request to restore the target file at the target time, where the target time is the time corresponding to the target file that the second processing device needs to restore. After receiving the restore request sent by the second processing device, the first storage device can restore the target file at the target time according to the restore request.

[0102] S102, determining a target backup record, wherein the target backup record includes: a full backup record corresponding to the most recent full backup operation before the target time, and all incremental backup records between the backup time corresponding to the most recent full backup operation and the target time;

[0103] In this embodiment, after receiving the recovery request sent by the second processing device, the first storage device can determine the target backup record corresponding to the target file to be restored according to the target time. The target backup record includes the full backup record corresponding to the most recent full backup operation before the target time, that is, the full backup record corresponding to the most recent full backup operation of all file blocks in the target file before the target time; the target backup record also includes all incremental backup records between the backup time corresponding to the most recent full backup operation and the target time, that is, the incremental backup record corresponding to the most recent incremental backup operation between the backup time corresponding to the most recent full backup operation and the target time for the file blocks that have changed in the target file.

[0104] For example, if the target time is a time t3_4 between t3 and t4, the full backup record corresponding to the most recent full backup operation before time t3_4 includes: the first identifier F1 of the target file, the full version number v1.0 corresponding to all file blocks a, b, c, and d contained in the target file, and the backup time t1. All incremental backup records between the backup time t1 and the target time t3_4 corresponding to the most recent full backup operation include: the first identifier F1 of the target file; the second identifier F1a of file block a, the corresponding incremental version number v1.2, and the backup time t3; the second identifier F1b of file block b, the corresponding incremental version number v1.1, and the backup time t2; the second identifier F1c of file block c, the corresponding incremental version number v1.2, and the backup time t3.

[0105] S103, based on the target backup record, respectively determining the latest version number corresponding to each second identifier;

[0106] In this embodiment, after determining the target backup record, the latest version number corresponding to the second identifier of each file block can be determined from the target backup record. If the file block has not changed between the backup time corresponding to the most recent full backup operation and the target time, the latest version number corresponding to the second identifier is the full backup version number; if the file block has changed between the backup time corresponding to the most recent full backup operation and the target time, the latest version number corresponding to the second identifier is the incremental backup version number. A set can be constructed based on the second identifier of each file block and the corresponding latest version number. For example, according to the target backup record at the target time t3_4, it can be determined that the latest version number corresponding to the second identifier F1a of the file block a contained in the target file is v1.2, the latest version number corresponding to the second identifier F1b of the file block b is v1.1, the latest version number corresponding to the second identifier F1c of the file block c is v1.2, and the latest version number corresponding to the second identifier F1d of the file block d is v1.0.

[0107] S104: Send the file blocks corresponding to the latest version number to the second processing device, so that the second processing device combines the file blocks corresponding to the latest version number to obtain the target file at the target time.

[0108] In this embodiment, after determining the latest version number corresponding to each second identifier based on the target backup record corresponding to the target time, it can be determined that the file block corresponding to the latest version number is the file block of the latest version relative to the target time. The file block corresponding to the latest version number is sent to the second processing device, so that the second processing device combines the file blocks corresponding to the latest version number according to the second identifier of each file block included in the set and the corresponding latest version number, so that the target file required at the target time can be restored, and the target file is the file of the latest version relative to the target time. For example, according to the target backup record at the target time t3_4, it is determined that the latest version number of the file block a contained in the target file is v1.2, the latest version number corresponding to the file block b is v1.1, the latest version number corresponding to the file block c is v1.2, and the latest version number corresponding to the file block d is v1.0. The file blocks a, b, c, and d corresponding to the latest version numbers are combined to obtain the file of the latest version relative to the target time t3_4.

[0109] Through the above method, when the target file at the target time needs to be restored, the application obtains the full backup record corresponding to the most recent full backup operation of the file block of the target file before the target time, and all incremental backup records between the backup time corresponding to the most recent full backup operation and the target time, determines the file block corresponding to the latest version number, and combines the file blocks corresponding to the latest version number to obtain the target file at the target time. The application realizes the file recovery corresponding to the specified time by setting the identifier and version number of the backup file block, and can optimize the efficiency and accuracy of the recovery for the recovery requests at different time points, so as to restore the required files.

[0110] In one embodiment of the present application, Figure 2 As shown, the method also includes:

[0111] S105, generating a file list at the target time, wherein the file list includes each second identifier associated with the first identifier and the latest version number corresponding to each second identifier, and the file list represents the state of the target file at the target time;

[0112] S106: Send the file list to the second processing device, so that the second processing device performs file recovery on the file blocks received from the first storage device according to the file list.

[0113] In this embodiment, during the recovery of the target file at the target time, based on the target backup record corresponding to the target time, after respectively determining the latest version number corresponding to each second identifier, a file list at the target time is generated, the file list includes each second identifier associated with the first identifier, and the latest version number corresponding to each second identifier, the latest version number corresponding to the second identifier represents the state of the file block corresponding to the second identifier at the target time. According to the file list, the state of each file block contained in the target file at the target time can be determined; according to the state of each file at the target time, the state of the target file at the target time can be determined.

[0114] The file list is sent to the second processing device, which can determine the file blocks of the latest version relative to the target time required to restore the target file according to the latest version numbers corresponding to the second identifiers in the file list, and receive the corresponding file blocks from the first storage device according to the latest version numbers corresponding to each second identifier in the file list, and combine the file blocks of the latest version numbers corresponding to the second identifiers in the file list, so that the obtained target file is the file of the latest version relative to the target time, that is, the file that needs to be restored.

[0115] For example, according to the target backup record at the target time t3_4, it is determined that the latest version number corresponding to the second identifier F1a of the file block a contained in the target file is v1.2, the latest version number corresponding to the second identifier F1b of the file block b is v1.1, the latest version number corresponding to the second identifier F1c of the file block c is v1.2, and the latest version number corresponding to the second identifier F1d of the file block d is v1.0. Based on the information of the above file blocks, a file list at the target time is generated, and the file list includes the first identifier F1, the latest version number v1.2 corresponding to the second identifier F1a of the file block a, the latest version number v1.1 corresponding to the second identifier F1b of the file block b, the latest version number v1.2 corresponding to the second identifier F1c of the file block c, and the latest version number v1.0 corresponding to the second identifier F1d of the file block d. According to the latest version number corresponding to each second identifier in the file list, the corresponding file blocks a, b, c, and d are received from the first storage device, and these file blocks are combined to obtain the target file with the latest version relative to the target time.

[0116] In one embodiment of the present application, Figure 3 As shown, after receiving the recovery request sent by the second processing device, the method further includes:

[0117] S107, receiving file blocks corresponding to all second identifiers associated with the first identifier on the second processing device;

[0118] S108, performing a temporary backup operation on the file blocks corresponding to all the second identifiers, and forming a temporary backup record corresponding to the temporary backup operation;

[0119] S109: When the second processing device obtains the target file at the target time, in response to a rollback request sent from the second processing device, all file blocks backed up by the temporary backup operation are sent to the second processing device based on the temporary backup record.

[0120] In this embodiment, after the first storage device receives the recovery request sent by the second processing device, the second processing device will send the file blocks corresponding to all the second identifiers associated with the first identifier to the first storage device, and the first storage device performs a temporary backup operation on the file blocks corresponding to all the received second identifiers to form a temporary backup record corresponding to the temporary backup operation. For example, when restoring the target file at the target time, a full backup operation is performed on the current target file of the second processing device, and the temporary backup record corresponding to the full backup operation performed on the current target file includes: the first identifier F1 of the target file, the full version number v0.0 corresponding to all the file blocks a, b, c, d contained in the target file, and the backup time t0.

[0121] In the case where the second processing device obtains the target file at the target moment, if an error occurs in the target file at the target moment after restoration or the restored version is not the version that the user actually wants to restore due to a user operation error, the second processing device may send a rollback request to the first storage device. In response to the rollback request sent by the second processing device, the first storage device sends all file blocks backed up by the temporary backup operation to the second processing device based on the temporary backup record corresponding to the full backup operation performed on the target file before the restoration operation of the second processing device, so that when an error occurs in the target file restored by the second processing device, the state of the current target file is rolled back to the state of the target file at the time of the sent restoration request.

[0122] In one embodiment of the present application, Figure 4 As shown, the method also includes:

[0123] S110, obtaining a creation time of a target file corresponding to the first identifier on the second processing device;

[0124] S111: If the creation time is later than the target time, send a file deletion request to the second processing device so that the second processing device deletes the target file on the second processing device.

[0125] In this embodiment, before performing a recovery operation on the target file at the target time, the first storage device will obtain the creation time of the target file corresponding to the first identifier on the second processing device, and determine whether the creation time is later than the target time. If the creation time is later than the target time, it indicates that the target file corresponding to the first identifier on the second processing device was created after the time corresponding to the target file to be recovered, and the target file corresponding to the first identifier on the second processing device should not exist at the target time. In this case, the recovery operation of the target file at the target time is not performed first, but a file deletion request is sent to the second processing device, so that the second processing device deletes the target file on the second processing device, ensuring that the state of the target file on the second processing device is in the state of the time required for file recovery. For example, the target time is a certain time t0_1 between t0 and t1, and the creation time of the target file corresponding to the first identifier F1 on the second processing device is t1_2, and the creation time t1_2 is later than the target time t0_1. The file deletion request is sent through the second processing device, so that the second processing device deletes the target file with the creation time t1_2.

[0126] In one embodiment of the present application, the method further includes:

[0127] In the case that the target file corresponding to the first identifier does not exist in the second processing device, a file creation request is sent to the second processing device, so that the second processing device creates a target file.

[0128] In this embodiment, before performing a recovery operation on the target file at the target moment, the first identifier of the target file in the first storage device is obtained, and based on the first identifier, it is determined whether there is a target file corresponding to the first identifier in the second processing device. In the case that the target file corresponding to the first identifier does not exist in the second processing device, it indicates that the target file in the second processing device is deleted after the target moment. In this case, a file creation request is sent to the second processing device, so that the second processing device creates a target file, ensuring that the state of the target file existing on the second processing device is in the state required for file recovery. For example, the target moment is a time t0_1 between t0 and t1, the first identifier corresponding to the target file on the second processing device is F1, and there is no target file in the second processing device that was created earlier than the target moment t0_1. A file creation request is sent through the second processing device, so that the second processing device creates a target file corresponding to the first identifier F1.

[0129] The embodiment of the present application also provides a method for backing up files, which is applied to a first storage device. The first storage device may be a backup server, which is used to back up and store files. The first storage device may also be a terminal device, for example, the terminal device may be a data security storage box. The target file is a file stored by the second processing device, which may be a file server, a client, a terminal device, etc. The target file to be backed up on the second processing device has a corresponding first identifier, which is a unique identifier of the target file. The target file includes multiple file blocks, and each file block included in the target file has a second identifier associated with the first identifier; the second identifier of each file block forms a mapping association with the first identifier of the target file.

[0130] Figure 5 A schematic diagram of the process of backing up files of the present application is shown, as follows: Figure 5 As shown, the method includes:

[0131] S201, receiving file blocks corresponding to all second identifiers associated with the first identifier on the second processing device;

[0132] S202, performing a full backup operation on the file blocks corresponding to all the second identifiers;

[0133] S203, forming a full backup record corresponding to the full backup operation; wherein the full backup record includes at least the following associated information: the first identifier, version numbers of file blocks corresponding to all second identifiers associated with the first identifier, and backup time;

[0134] S204, receiving a changed block, wherein the changed block is a file block in the target file corresponding to the first identifier on the second processing device that has changed after the last backup operation;

[0135] S205, performing an incremental backup operation on the changed blocks;

[0136] S206, forming an incremental backup record corresponding to the incremental backup operation; wherein the incremental backup record includes at least the following associated information: the first identifier, the second identifier corresponding to each of the changed blocks, the version number corresponding to each of the changed blocks, and the backup time.

[0137] In this embodiment, during the process of backing up the target file, the target file can be fully backed up within a predetermined time period according to the backup requirements of the second processing device. First, the second processing device sends the file blocks corresponding to all the second identifiers associated with the first identifier to the first storage device. The first storage device performs a full backup operation on the file blocks corresponding to all the second identifiers at the current backup time. The full backup is a backup operation performed on all file blocks in the target file. After a full backup is performed on each file block contained in the target file, a full backup record corresponding to the full backup operation can be obtained; the full backup record includes at least the following related information: the first identifier of the target file, the version number of the file blocks corresponding to all the second identifiers associated with the first identifier, and the backup time.

[0138] For example, the target file has four file blocks a, b, c, and d, the first identifier of the target file is recorded as F1, and the second identifiers of file blocks a, b, c, and d are recorded as F1a, F1b, F1c, and F1d, respectively. As shown in Table 2, after the target file is fully backed up at time t1, the full version numbers corresponding to file blocks a, b, c, and d are all v1.0; the full backup record of the target file at time t1 includes: the first identifier F1 of the target file, the full version number v1.0 corresponding to file blocks a, b, c, and d, and the backup time t1. If the target file is fully backed up at time t5, the full version number corresponding to file blocks a, b, c, and d is v2.0; the full backup record of the target file at time t5 includes: the first identifier F1 of the target file, the full version number v2.0 corresponding to file blocks a, b, c, and d, and the backup time t5. As shown in Table 1a, the version number of the target file that is fully backed up at backup time t1 is v1.0, and the full backup ID can be recorded as 101; the version number of the target file that is fully backed up at backup time t5 is v2.0, and the full backup ID can be recorded as 105. After the target file is fully backed up at different times, the backup time, full backup version number, and full backup ID of the full backup operation can be updated in Table 1a.

[0139] Backup ID Backup time Backup version number Backup storage path 101 t1 v1.0 First storage device (specific path omitted) 105 t5 v2.0 First storage device (specific path omitted) …… …… …… ……

[0140] Table 1a: Schematic diagram of full backup operation related information

[0141] In the case where the file blocks included in the target file of the second processing device change, it is necessary to perform an incremental backup operation on the changed file blocks at the time when the file blocks change. First, the second processing device determines the file blocks that have changed after the last backup operation as changed blocks based on the target file corresponding to the first identifier, and sends the changed blocks to the first storage device. The first storage device can perform an incremental backup operation on the changed blocks based on the second identifier corresponding to the changed blocks and the time when the change occurs. The incremental backup is a backup operation performed when the file blocks in the target file change. After performing an incremental backup on the changed blocks, an incremental backup record corresponding to the incremental backup operation can be obtained; wherein the incremental backup record includes at least the following associated information: the first identifier, the second identifier corresponding to each of the changed blocks, the version number corresponding to each of the changed blocks, and the backup time. The version number corresponding to the changed block can be generated based on the version number of the changed block in the most recent full backup.

[0142] For example, if file block a and file block b included in the target file at time t2 are changed after the last backup operation, file block a and file block b are determined as changed blocks and sent to the first storage device, and the first storage device performs an incremental backup operation on file block a and file block b. Since the version number corresponding to the most recent incremental operation of the changed file block is 1.0, the version number generated for the changed file block can be generated based on 1.0, as shown in Table 2, and the incremental version number corresponding to file block a and file block b is recorded as v1.1; the incremental backup record of file block a and file block b included in the target file at time t2 includes: the first identifier F1 of the target file, the second identifier F1a of file block a, the second identifier F1b of file block b, the incremental version number v1.1 corresponding to file block a and file block b, and the backup time t2.

[0143] If file block a and file block c included in the target file are changed after the last backup operation at time t3, file block a and file block c are determined as changed blocks, and file block a and file block c are determined as changed blocks and sent to the first storage device, and the first storage device performs an incremental backup operation on file block a and file block c. Since the version number corresponding to the most recent incremental operation of the changed file block is 1.0, the version number generated for the changed file block can be generated based on 1.0, as shown in Table 2, and the incremental version number corresponding to file block a and file block c is recorded as v1.2; the incremental backup record of file block a and file block c included in the target file at time t3 includes: the first identifier F1 of the target file, the second identifier F1a of file block a, the second identifier F1c of file block c, the incremental version number v1.2 corresponding to file block a and file block c, and the backup time t3. As shown in Table 1b, the version number of the incremental backup of the target file at backup time t2 is v1.1, and the full backup ID can be recorded as 101; the version number of the full backup of the target file at backup time t3 is v1.2, and the full backup ID can be recorded as 101; the version number of the full backup of the target file at backup time t4 is v1.3, and the full backup ID can be recorded as 101. After performing incremental backup on the file blocks of the target file at different times, the backup time, full backup version number, and full backup ID of the full backup operation can be updated in Table 1a and Table 2.

[0144]

[0145]

[0146] Table 1b: Schematic diagram of incremental backup operation related information

[0147]

[0148] Table 2: Record table of file block related information

[0149] The present application sets a first identifier for the target file to be backed up in the above manner, and sets a second identifier associated with the first identifier for each file block contained in the target file. A full backup operation is performed on the file blocks corresponding to all the second identifiers to form a full backup record corresponding to the full backup operation; when the file blocks in the target file change, an incremental backup operation is performed on the changed file blocks to form an incremental backup record corresponding to the incremental backup operation. By setting an associated identifier for each file and file block, each file block contained in the target file is effectively tracked and managed, and by setting the identifier and version number of the backup file block, incremental backup is performed only after the content of the file block changes, thereby reducing redundant data storage and improving backup efficiency.

[0150] In one embodiment of the present application, Figure 6 As shown, before receiving the change block, the method further includes:

[0151] S207, sending a first time to the second processing device, where the first time is a backup time corresponding to the last backup operation;

[0152] S208, receiving all second identifiers and corresponding first file fingerprints when the update time of the target file corresponding to the first identifier is later than the first time; wherein the first file fingerprint is a file fingerprint of a file block on the second processing device;

[0153] S209, determining a file block having the same second identifier but different corresponding first file fingerprint and second file fingerprint as a changed block; wherein the second file fingerprint is a file fingerprint of a file block having a latest version number on the first storage device;

[0154] S210, adding the second identifier corresponding to the changed block to a list to be backed up;

[0155] S211: Send the to-be-backed-up list to the second processing device, so that the second processing device searches for a changed block according to a second identifier included in the to-be-backed-up list.

[0156] In this embodiment, when the second processing device stores the target file, it can generate a corresponding file fingerprint for each file block included in the target file based on algorithms such as SHA-256. If the file block changes, the corresponding file fingerprint will also change, and the file fingerprint of the file block on the second processing device is determined as the first file fingerprint. After the first storage device backs up each file block of the target file, it will generate a corresponding file fingerprint. If the file block is backed up again, the corresponding file fingerprint will also change, and the file fingerprint of the file block with the latest version number on the first storage device is determined as the second file fingerprint. If the content of the file block on the second processing device is the same as that of the file block with the same second identifier on the first storage device, the corresponding first file fingerprint and the second file fingerprint are the same; if the content of the file block on the second processing device is different from that of the file block with the same second identifier on the first storage device, the corresponding first file fingerprint and the second file fingerprint are different.

[0157] If the target file on the second processing device is updated, and the update time of the target file is later than the backup time corresponding to the last backup operation, all the second identifiers and corresponding first file fingerprints corresponding to the file blocks included in the target file on the second processing device are sent to the first storage device, and the first file fingerprint and the second file fingerprint corresponding to the file blocks with the same second identifier are compared. If the first file fingerprint and the second file fingerprint are different, it indicates that after the target file on the second processing device is updated, the content of the file blocks included in the target file has changed, and the file blocks in the target file on the second processing device with the same second identifier but different corresponding first file fingerprints and second file fingerprints are determined as changed blocks. The second identifiers corresponding to all changed blocks in the target file are added to the list to be backed up, and the list to be backed up is sent to the second processing device, so that the second processing device searches for all changed blocks in the target file according to the second identifiers included in the list to be backed up. After all changed blocks in the target file are determined, incremental backup operations can be performed on the changed blocks. For example, as shown in Table 2, the second file fingerprint of file block a with the second identifier F1a on the first storage device is Code.a.1.1, and the first file fingerprint of file block a with the second identifier F1a on the second processing device is Code.a.1.2. Since the second file fingerprint and the first file fingerprint of file block a with the second identifier F1a are different, it can be determined that file block a is a changed block, and the change time t3 of file a can be determined. The file block a of the second processing device can be incrementally backed up, and the second file fingerprint of file block a on the first storage device can be updated to Code.a.1.2 at time t3.

[0158] In the case that the target file on the second processing device is updated after the backup time corresponding to the last backup operation, by comparing the first file fingerprint and the second file fingerprint corresponding to the file blocks with the same second identifier, it is possible to determine whether the content of the target file on the second processing device has changed, and in the case that the content of the target file has changed, determine the file blocks in the target file that have changed, thereby speeding up the processing speed of whether the target file needs to be incrementally backed up.

[0159] In one embodiment of the present application, Figure 7 As shown, before receiving the change block, the method further includes:

[0160] S212, sending a first time to the second processing device, where the first time is a backup time corresponding to a previous backup operation;

[0161] S213, receiving a second identifier corresponding to an update block and a corresponding first file fingerprint, wherein the update block is a file block determined from file blocks of a target file corresponding to the first identifier on the second processing device and updated later than the first time; and the first file fingerprint is a file fingerprint of the file block on the second processing device;

[0162] S214, determining the update block having the same second identifier but different corresponding first file fingerprint and second file fingerprint as a changed block; wherein the second file fingerprint is the file fingerprint of the file block having the latest version number on the first storage device;

[0163] S215, adding the second identifier corresponding to the changed block to the to-be-backed-up list;

[0164] S216: Send the to-be-backed-up list to the second processing device, so that the second processing device searches for a changed block according to a second identifier included in the to-be-backed-up list.

[0165] In this embodiment, if the target file on the second processing device is updated and the update time of the target file is later than the backup time corresponding to the last backup operation, the second processing device can record the update time of the target file and determine whether the file block in the target file has changed due to the update of the target file.

[0166] The second processing device can determine the file blocks in the target file corresponding to the first identifier, which are updated later than the first time, as update blocks, and send the second identifier corresponding to the update block and the corresponding first file fingerprint to the first storage device. The first storage device determines the file blocks with the same second identifier according to the second identifier of the update block, and compares the first file fingerprint and the second file fingerprint corresponding to the update block and the file block with the same second identifier. If the first file fingerprint and the second file fingerprint are different, it indicates that the content of the update block has changed at the update time, and it is necessary to perform an incremental backup operation on the updated block that has changed. In the target file on the second processing device, the update blocks with the same second identifier but different corresponding first file fingerprint and second file fingerprint are determined as change blocks. The second identifiers corresponding to all the change blocks in the target file are added to the list to be backed up, and the list to be backed up is sent to the second processing device, so that the second processing device searches for the change blocks according to the second identifier included in the list to be backed up. After all the change blocks in the target file are determined, an incremental backup operation can be performed on the change blocks.

[0167] For example, as shown in Table 2, the second identifier F1c and the corresponding first file fingerprint Code.c.1.3 corresponding to the file block c updated by the second processing device are sent to the first storage device. The second file fingerprint of the file block c with the second identifier F1c on the first storage device is Code.c.1.2. By comparing the first file fingerprint and the second file fingerprint, the second file fingerprint of the file block c with the second identifier F1c is different from the first file fingerprint. It can be determined that the file block c is a changed block, and the change time t4 of the file c is determined. The file block c of the second processing device can be incrementally backed up, and the second file fingerprint of the file block c on the first storage device can be updated to Code.c.1.3 at time t4.

[0168] In the case where the target file on the second processing device is updated after the backup time corresponding to the last backup operation, by screening the update blocks corresponding to the update time and comparing the first file fingerprint and the second file fingerprint corresponding to the update blocks and file blocks with the same second identifier, it can be determined whether the content of the update blocks on the second processing device has changed, and the update blocks with changed content are determined as the file blocks that have changed in the target file, thereby reducing the number of comparisons of the first storage device, reducing the processing pressure of the first storage device, and speeding up the processing speed of incremental backup. This solution uses multiple checks to screen out file blocks that have not been updated and file blocks that have been updated but whose content has not changed in the end, further reducing storage redundancy during the backup process and improving the resource utilization efficiency of the first storage device.

[0169] An embodiment of the present application also provides a method for backing up files, which is applied to a second processing device. The second processing device can be a file server, a client, and a terminal device. The target file to be backed up on the second processing device has a corresponding first identifier, and the first identifier is a unique identifier of the target file. The target file includes multiple file blocks, and each file block contained in the target file has a second identifier associated with the first identifier; the second identifier of each file block forms a mapping association with the first identifier of the target file.

[0170] Figure 8 A schematic diagram of the process of backing up files of the present application is shown, as follows: Figure 8 As shown, the method includes:

[0171] S301, sending the file blocks corresponding to all the second identifiers associated with the first identifier on the second processing device to the first storage device, so that the first storage device performs a full backup operation and forms a full backup record corresponding to the full backup operation; wherein the full backup record includes at least the following associated information: the first identifier, the version numbers of the file blocks corresponding to all the second identifiers associated with the first identifier, and the backup time;

[0172] S302, sending the changed blocks to the first storage device, causing the first storage device to perform an incremental backup operation and form an incremental backup record corresponding to the incremental backup operation; wherein the changed blocks are file blocks in the target file corresponding to the first identifier on the second processing device, which have changed after the last backup operation; the incremental backup record includes at least the following related information: the first identifier, the second identifier corresponding to each of the changed blocks, the version number corresponding to each of the changed blocks, and the backup time.

[0173] In this embodiment, in the process of backing up the target file, the second processing device first sends the file blocks corresponding to all the second identifiers associated with the first identifier to the first storage device. The first storage device is used to back up and store the file, and can perform a full backup of the target file within a predetermined time period according to the backup requirements of the second processing device. The first storage device performs a full backup operation on the file blocks corresponding to all the second identifiers at the current backup time. The full backup is a backup operation performed on all file blocks in the target file. After the first storage device performs a full backup on each file block contained in the target file, a full backup record corresponding to the full backup operation can be obtained; the full backup record includes at least the following related information: the first identifier of the target file, the version number of the file blocks corresponding to all the second identifiers associated with the first identifier, and the backup time.

[0174] For example, the target file has four file blocks a, b, c, and d. The first identifier of the target file is recorded as F1, and the second identifiers of file blocks a, b, c, and d are recorded as F1a, F1b, F1c, and F1d, respectively. After the target file is fully backed up at time t1, the full version numbers corresponding to file blocks a, b, c, and d are all v1.0; the full backup record of the target file at time t1 includes: the first identifier F1 of the target file, the full version number v1.0 corresponding to file blocks a, b, c, and d, and the backup time t1. If the target file is fully backed up at time t5, the full version number corresponding to file blocks a, b, c, and d is v2.0; the full backup record of the target file at time t5 includes: the first identifier F1 of the target file, the full version number v2.0 corresponding to file blocks a, b, c, and d, and the backup time t5.

[0175] In the case where the file blocks included in the target file of the second processing device change, it is necessary to perform an incremental backup operation on the changed file blocks at the time when the file blocks change. First, the second processing device determines the file blocks that have changed after the last backup operation as changed blocks based on the target file corresponding to the first identifier, and sends the changed blocks to the first storage device. The first storage device can perform an incremental backup operation on the changed blocks based on the second identifier corresponding to the changed blocks and the time when the change occurs. The incremental backup is a backup operation performed when the file blocks in the target file change. After performing an incremental backup on the changed blocks, an incremental backup record corresponding to the incremental backup operation can be obtained; wherein the incremental backup record includes at least the following associated information: the first identifier, the second identifier corresponding to each of the changed blocks, the version number corresponding to each of the changed blocks, and the backup time. The version number corresponding to the changed block can be generated based on the version number of the changed block in the most recent full backup.

[0176] For example, if file block a and file block b included in the target file at time t2 change after the last backup operation, file block a and file block b are determined as changed blocks and sent to the first storage device, and the first storage device performs an incremental backup operation on file block a and file block b. Since the version number corresponding to the most recent incremental operation of the changed file block is 1.0, the version number generated for the changed file block can be generated based on 1.0, and the incremental version number corresponding to file block a and file block b is recorded as v1.1; the incremental backup record of file block a and file block b included in the target file at time t2 includes: the first identifier F1 of the target file, the second identifier F1a of file block a, the second identifier F1b of file block b, the incremental version number v1.1 corresponding to file block a and file block b, and the backup time t2.

[0177] If file block a and file block c included in the target file are changed after the last backup operation at time t3, file block a and file block c are determined as changed blocks, and file block a and file block c are determined as changed blocks and sent to the first storage device, and the first storage device performs an incremental backup operation on file block a and file block c. Since the version number corresponding to the most recent incremental operation of the changed file block is 1.0, the version number generated for the changed file block can be generated based on 1.0, and the incremental version number corresponding to file block a and file block c is recorded as v1.2; the incremental backup record of file block a and file block c included in the target file at time t3 includes: the first identifier F1 of the target file, the second identifier F1a of file block a, the second identifier F1c of file block c, the incremental version number v1.2 corresponding to file block a and file block c, and the backup time t3.

[0178] The present application sets a first identifier for the target file to be backed up in the above manner, and sets a second identifier associated with the first identifier for each file block contained in the target file. A full backup operation is performed on the file blocks corresponding to all the second identifiers to form a full backup record corresponding to the full backup operation; when the file blocks in the target file change, an incremental backup operation is performed on the changed file blocks to form an incremental backup record corresponding to the incremental backup operation. By setting an associated identifier for each file and file block, each file block contained in the target file is effectively tracked and managed, and by setting the identifier and version number of the backup file block, incremental backup is performed only after the content of the file block changes, thereby reducing redundant data storage and improving backup efficiency.

[0179] In one embodiment of the present application, before sending the change block to the first storage device, the method further includes:

[0180] Acquire a first time, where the first time is a backup time corresponding to the last backup operation;

[0181] When the update time of the target file corresponding to the first identifier is later than the first time, sending all second identifiers and corresponding first file fingerprints to the first storage device, wherein the first file fingerprint is the file fingerprint of the file block on the second processing device;

[0182] Receive a list to be backed up, the list to be backed up includes a second identifier corresponding to a changed block; wherein the changed block is a file block having the same second identifier but a corresponding first file fingerprint and a corresponding second file fingerprint that are different; the second file fingerprint is a file fingerprint of a file block having a latest version number on the first storage device;

[0183] The changed block is searched according to the second identifier included in the to-be-backed-up list.

[0184] In this embodiment, when the second processing device stores the target file, it will generate a corresponding file fingerprint for each file block included in the target file based on the SHA-256 algorithm. If the file block changes, the corresponding file fingerprint will also change, and the file fingerprint of the file block on the second processing device will be determined as the first file fingerprint. After the first storage device backs up each file block of the target file, it will generate a corresponding file fingerprint. If the file block is backed up again, the corresponding file fingerprint will also change, and the file fingerprint of the file block with the latest version number on the first storage device will be determined as the second file fingerprint. If the content of the file block on the second processing device is the same as that of the file block with the same second identifier on the first storage device, the corresponding first file fingerprint and the second file fingerprint are the same; if the content of the file block on the second processing device is different from that of the file block with the same second identifier on the first storage device, the corresponding first file fingerprint and the second file fingerprint are different.

[0185] If the target file on the second processing device is updated, and the update time of the target file is later than the backup time corresponding to the last backup operation, all the second identifiers and corresponding first file fingerprints corresponding to the file blocks included in the target file on the second processing device are sent to the first storage device, and the first file fingerprint and the second file fingerprint corresponding to the file blocks with the same second identifier are compared. If the first file fingerprint and the second file fingerprint are different, it indicates that after the target file on the second processing device is updated, the content of the file blocks included in the target file has changed, and the file blocks in the target file on the second processing device with the same second identifier but different corresponding first file fingerprints and second file fingerprints are determined as changed blocks. The first storage device adds the second identifiers corresponding to all changed blocks in the target file to the list to be backed up, and sends the list to be backed up to the second processing device. The second processing device searches for all changed blocks in the target file according to the second identifiers included in the list to be backed up. After the second processing device determines all changed blocks in the target file, it can send the changed blocks to the first storage device for incremental backup operations. In the case that the target file on the second processing device is updated after the backup time corresponding to the last backup operation, by comparing the first file fingerprint and the second file fingerprint corresponding to the file blocks with the same second identifier, it is possible to determine whether the content of the target file on the second processing device has changed, and in the case that the content of the target file has changed, determine the file blocks in the target file that have changed, thereby speeding up the processing speed of whether the target file needs to be incrementally backed up.

[0186] In one embodiment of the present application, before sending the change block to the first storage device, the method further includes:

[0187] Acquire a first time, where the first time is a backup time corresponding to the last backup operation;

[0188] Determine an updated block from the file blocks of the target file corresponding to the first identifier, the updated block being a file block updated later than the first time on the second processing device;

[0189] Sending a second identifier corresponding to the update block and a corresponding first file fingerprint to the first storage device, wherein the first file fingerprint is a file fingerprint of the file block on the second processing device;

[0190] Receive a list to be backed up, the list to be backed up includes a second identifier corresponding to a changed block; wherein the changed block is an update block having the same second identifier but a corresponding first file fingerprint and a corresponding second file fingerprint that are different; the second file fingerprint is a file fingerprint of a file block having a latest version number on the first storage device;

[0191] The changed block is searched according to the second identifier included in the to-be-backed-up list.

[0192] In this embodiment, if the target file on the second processing device is updated and the update time of the target file is later than the backup time corresponding to the last backup operation, the second processing device can record the update time of the target file and determine whether the file block in the target file has changed due to the update of the target file.

[0193] The second processing device may determine the file block whose update time is later than the first time in the file block of the target file corresponding to the first identifier as the update block, and send the second identifier corresponding to the update block and the corresponding first file fingerprint to the first storage device. The first storage device determines the file block with the same second identifier according to the second identifier of the update block, and compares the first file fingerprint and the second file fingerprint corresponding to the update block and the file block with the same second identifier. If the first file fingerprint and the second file fingerprint are different, it indicates that the content of the update block has changed at the update time, and it is necessary to perform an incremental backup operation on the updated block that has changed. The first storage device determines the update block with the same second identifier but different first file fingerprint and second file fingerprint in the target file on the second processing device as the change block, and adds the second identifier corresponding to all the change blocks in the target file to the list to be backed up, and sends the list to be backed up to the second processing device. The second processing device searches for the change block according to the second identifier included in the list to be backed up. After the second processing device determines all the change blocks in the target file, it can send the change block to the first storage device for incremental backup operation.

[0194] In the case that the target file on the second processing device is updated after the backup time corresponding to the last backup operation, by screening the update blocks corresponding to the update time and comparing the first file fingerprint and the second file fingerprint corresponding to the update blocks and file blocks having the same second identifier, it is possible to determine whether the content of the update blocks on the second processing device has changed, and determine the update blocks with changed content as the file blocks that have changed in the target file, thereby reducing the number of comparisons on the first storage device, reducing the processing pressure on the first storage device, and speeding up the processing speed of incremental backup.

[0195] The present application also provides a storage device, such as Fig.10 As shown, the first storage device stores a full backup record corresponding to at least one full backup operation of the backed up target file, and an incremental backup record corresponding to at least one incremental backup operation; wherein the target file has a corresponding first identifier, and each file block contained in the target file has a second identifier associated with the first identifier; the full backup record includes at least the following associated information: the first identifier, the full version number of the file block corresponding to each of the second identifiers associated with the first identifier, and the backup time; the incremental backup record includes at least the following associated information: the first identifier, the second identifier corresponding to each of the changed blocks, the incremental version number corresponding to each of the changed blocks, and the backup time; including:

[0196] A first acquisition module is configured to receive a recovery request sent by the second processing device, wherein the recovery request is used to request recovery of a target file at a target time;

[0197] A first determination module is configured to determine a target backup record, wherein the target backup record includes: a full backup record corresponding to the most recent full backup operation before the target time, and all incremental backup records between the backup time corresponding to the most recent full backup operation and the target time;

[0198] The first determination module is further configured to determine, based on the target backup record, the latest version number corresponding to each second identifier;

[0199] The first processing module is configured to send the file blocks corresponding to the latest version number to the second processing device, so that the second processing device combines the file blocks corresponding to the latest version number to obtain the target file at the target time.

[0200] The present application also provides a storage device, such as Fig.11 As shown, including:

[0201] A second acquisition module is configured to receive file blocks corresponding to all second identifiers associated with the first identifier on the second processing device; wherein the target file to be backed up on the second processing device has a corresponding first identifier, and each file block included in the target file has a second identifier associated with the first identifier;

[0202] A first backup module is configured to perform a full backup operation on the file blocks corresponding to all the second identifiers;

[0203] A second determination module is configured to form a full backup record corresponding to the full backup operation; wherein the full backup record includes at least the following associated information: the first identifier, version numbers of file blocks corresponding to all second identifiers associated with the first identifier, and backup time;

[0204] The second acquisition module is further configured to receive a changed block, wherein the changed block is a file block in the target file corresponding to the first identifier on the second processing device that has changed after the last backup operation;

[0205] A second backup module configured to perform an incremental backup operation on the changed blocks;

[0206] The second determination module is also configured to form an incremental backup record corresponding to the incremental backup operation; wherein the incremental backup record includes at least the following associated information: the first identifier, the second identifier corresponding to each of the changed blocks, the version number corresponding to each of the changed blocks, and the backup time.

[0207] The present application also provides a processing device, such as Fig.12 As shown, including:

[0208] A third acquisition module is configured to send the file blocks corresponding to all the second identifiers associated with the first identifier on the second processing device to the first storage device, so that the first storage device performs a full backup operation and forms a full backup record corresponding to the full backup operation; wherein the target file to be backed up has a corresponding first identifier, and each file block included in the target file has a second identifier associated with the first identifier; the full backup record includes at least the following associated information: the first identifier, the version numbers of the file blocks corresponding to all the second identifiers associated with the first identifier, and the backup time;

[0209] The third determination module is configured to send the changed blocks to the first storage device, so that the first storage device performs an incremental backup operation and forms an incremental backup record corresponding to the incremental backup operation; wherein the changed blocks are file blocks in the target file corresponding to the first identifier on the second processing device, which have changed after the last backup operation; and the incremental backup record includes at least the following related information: the first identifier, the second identifier corresponding to each of the changed blocks, the version number corresponding to each of the changed blocks, and the backup time.

[0210] On the other hand, an embodiment of the present application further provides a computer program product storing a computer program, which, when executed by a processor, implements the method provided by any embodiment of the present invention, including the above-mentioned method for recovering files and the method for backing up files.

[0211] An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above method are executed.

[0212] Optionally, in this embodiment, the above-mentioned storage medium may include, but is not limited to, various media that can store program codes, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk. Optionally, the specific examples in this embodiment can refer to the examples described in the above-mentioned embodiment and the optional implementation mode, and this embodiment will not be repeated here. Obviously, it should be understood by those skilled in the art that the above-mentioned steps of the present application can be implemented with a general computing device, which can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices. Optionally, they can be implemented with executable program codes of computing devices, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that here, or they can be made into individual integrated circuit modules respectively, or multiple modules or steps therein can be made into a single integrated circuit module to implement. In this way, the present application is not limited to any specific combination of hardware and software.

[0213] Although the preferred embodiments of the present application have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.

[0214] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A method for restoring a file, characterized in that: Applied to a first storage device, the first storage device stores a full backup record corresponding to at least one full backup operation of a backed up target file, and an incremental backup record corresponding to at least one incremental backup operation; wherein the target file has a corresponding first identifier, and each file block included in the target file has a second identifier associated with the first identifier; the full backup record includes at least the following associated information: the first identifier, the full version number of the file block corresponding to each of the second identifiers associated with the first identifier, and the backup time; the incremental backup record includes at least the following associated information: the first identifier, the second identifier corresponding to each of the changed blocks, the incremental version number corresponding to each of the changed blocks, and the backup time; The method comprises: receiving a recovery request sent by the second processing device, wherein the recovery request is used to request recovery of a target file at a target time; Determine a target backup record, wherein the target backup record includes: a full backup record corresponding to the most recent full backup operation before the target time, and all incremental backup records between the backup time corresponding to the most recent full backup operation and the target time; Based on the target backup record, respectively determine the latest version number corresponding to each second identifier; The file blocks corresponding to the latest version number are sent to the second processing device, so that the second processing device combines the file blocks corresponding to the latest version number to obtain the target file at the target time.

2. The method for recovering files according to claim 1, characterized in that: The method further comprises: Generate a file list at the target time, the file list including each second identifier associated with the first identifier and the latest version number corresponding to each second identifier, the file list representing the state of the target file at the target time; The file list is sent to the second processing device, so that the second processing device performs file recovery on the file blocks received from the first storage device according to the file list.

3. The method according to any one of claims 1 to 2, characterized in that: After receiving the recovery request sent by the second processing device, the method further includes: receiving file blocks corresponding to all second identifiers associated with the first identifier on the second processing device; Performing a temporary backup operation on the file blocks corresponding to all the second identifiers, and forming a temporary backup record corresponding to the temporary backup operation; When the second processing device obtains the target file at the target time, in response to a rollback request sent from the second processing device, all file blocks backed up by the temporary backup operation are sent to the second processing device based on the temporary backup record.

4. The method according to any one of claims 1 to 3, characterized in that The method further comprises: Acquire a creation time of a target file corresponding to the first identifier on the second processing device; If the creation time is later than the target time, a file deletion request is sent to the second processing device, so that the second processing device deletes the target file on the second processing device.

5. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: In the case that the target file corresponding to the first identifier does not exist in the second processing device, a file creation request is sent to the second processing device, so that the second processing device creates a target file.

6. A method for backing up files, characterized in that: Applied to the first storage device, the target file to be backed up on the second processing device has a corresponding first identifier, and each file block included in the target file has a second identifier associated with the first identifier; The method comprises: receiving file blocks corresponding to all second identifiers associated with the first identifier on the second processing device; Perform a full backup operation on all file blocks corresponding to the second identifiers; Forming a full backup record corresponding to the full backup operation; wherein the full backup record includes at least the following associated information: the first identifier, the version numbers of the file blocks corresponding to all the second identifiers associated with the first identifier, and the backup time; receiving a changed block, wherein the changed block is a file block in the target file corresponding to the first identifier on the second processing device that has changed after a last backup operation; Performing an incremental backup operation on the changed blocks; An incremental backup record corresponding to the incremental backup operation is formed; wherein the incremental backup record includes at least the following associated information: the first identifier, the second identifier corresponding to each of the changed blocks, the version number corresponding to each of the changed blocks, and the backup time.

7. The method according to claim 6, characterized in that Before receiving the change block, the method further includes: Sending a first time to the second processing device, where the first time is a backup time corresponding to a previous backup operation; In the case where the update time of the target file corresponding to the first identifier is later than the first time, receiving all second identifiers and corresponding first file fingerprints; wherein the first file fingerprint is a file fingerprint of a file block on the second processing device; Determine a file block having the same second identifier but different corresponding first file fingerprint and second file fingerprint as a changed block; wherein the second file fingerprint is a file fingerprint of a file block having a latest version number on the first storage device; Adding the second identifier corresponding to the changed block to the to-be-backed-up list; The to-be-backed-up list is sent to the second processing device, so that the second processing device searches for the changed block according to the second identifier included in the to-be-backed-up list.

8. The method according to claim 6, characterized in that Before receiving the change block, the method further includes: Sending a first time to the second processing device, where the first time is a backup time corresponding to a previous backup operation; receiving a second identifier corresponding to an update block and a corresponding first file fingerprint, wherein the update block is a file block determined from file blocks of a target file corresponding to the first identifier on the second processing device and updated later than the first time; and the first file fingerprint is a file fingerprint of the file block on the second processing device; Determine the update block with the same second identifier but different corresponding first file fingerprint and second file fingerprint as a change block; wherein the second file fingerprint is the file fingerprint of the file block with the latest version number on the first storage device; Adding the second identifier corresponding to the changed block to the to-be-backed-up list; The to-be-backed-up list is sent to the second processing device, so that the second processing device searches for the changed block according to the second identifier included in the to-be-backed-up list.

9. A method for backing up files, characterized in that: Applied to the second processing device, the target file to be backed up has a corresponding first identifier, and each file block included in the target file has a second identifier associated with the first identifier; The method comprises: Sending the file blocks corresponding to all the second identifiers associated with the first identifier on the second processing device to the first storage device, so that the first storage device performs a full backup operation and forms a full backup record corresponding to the full backup operation; wherein the full backup record includes at least the following associated information: the first identifier, the version numbers of the file blocks corresponding to all the second identifiers associated with the first identifier, and the backup time; Send the changed blocks to the first storage device, so that the first storage device performs an incremental backup operation and forms an incremental backup record corresponding to the incremental backup operation; wherein the changed blocks are file blocks in the target file corresponding to the first identifier on the second processing device, which have changed after the last backup operation; the incremental backup record includes at least the following related information: the first identifier, the second identifier corresponding to each of the changed blocks, the version number corresponding to each of the changed blocks, and the backup time.

10. The method according to claim 9, characterized in that Before sending the changed block to the first storage device, the method further includes: Acquire a first time, where the first time is a backup time corresponding to the last backup operation; When the update time of the target file corresponding to the first identifier is later than the first time, sending all second identifiers and corresponding first file fingerprints to the first storage device, wherein the first file fingerprint is the file fingerprint of the file block on the second processing device; Receive a list to be backed up, the list to be backed up includes a second identifier corresponding to a changed block; wherein the changed block is a file block having the same second identifier but a corresponding first file fingerprint and a corresponding second file fingerprint that are different; the second file fingerprint is a file fingerprint of a file block having a latest version number on the first storage device; The changed block is searched according to the second identifier included in the to-be-backed-up list.

11. The method according to claim 9, characterized in that Before sending the changed block to the first storage device, the method further includes: Acquire a first time, where the first time is a backup time corresponding to the last backup operation; Determine an updated block from the file blocks of the target file corresponding to the first identifier, the updated block being a file block updated later than the first time on the second processing device; Sending a second identifier corresponding to the update block and a corresponding first file fingerprint to the first storage device, wherein the first file fingerprint is a file fingerprint of the file block on the second processing device; Receive a list to be backed up, the list to be backed up includes a second identifier corresponding to a changed block; wherein the changed block is an update block having the same second identifier but a corresponding first file fingerprint and a corresponding second file fingerprint that are different; the second file fingerprint is a file fingerprint of a file block having a latest version number on the first storage device; The changed block is searched according to the second identifier included in the to-be-backed-up list.

12. A storage device, characterized in that: The first storage device stores a full backup record corresponding to at least one full backup operation of the backed up target file and an incremental backup record corresponding to at least one incremental backup operation; wherein the target file has a corresponding first identifier, and each file block included in the target file has a second identifier associated with the first identifier; the full backup record includes at least the following associated information: the first identifier, the full version number of the file block corresponding to each of the second identifiers associated with the first identifier, and the backup time; the incremental backup record includes at least the following associated information: the first identifier, the second identifier corresponding to each of the changed blocks, the incremental version number corresponding to each of the changed blocks, and the backup time; including: A first acquisition module is configured to receive a recovery request sent by the second processing device, wherein the recovery request is used to request recovery of a target file at a target time; A first determination module is configured to determine a target backup record, wherein the target backup record includes: a full backup record corresponding to the most recent full backup operation before the target time, and all incremental backup records between the backup time corresponding to the most recent full backup operation and the target time; The first determination module is further configured to determine, based on the target backup record, the latest version number corresponding to each second identifier; The first processing module is configured to send the file blocks corresponding to the latest version number to the second processing device, so that the second processing device combines the file blocks corresponding to the latest version number to obtain the target file at the target time.

13. A storage device, characterized in that: include: A second acquisition module is configured to receive file blocks corresponding to all second identifiers associated with the first identifier on the second processing device; wherein the target file to be backed up on the second processing device has a corresponding first identifier, and each file block included in the target file has a second identifier associated with the first identifier; A first backup module is configured to perform a full backup operation on the file blocks corresponding to all the second identifiers; A second determination module is configured to form a full backup record corresponding to the full backup operation; wherein the full backup record includes at least the following associated information: the first identifier, version numbers of file blocks corresponding to all second identifiers associated with the first identifier, and backup time; The second acquisition module is further configured to receive a changed block, wherein the changed block is a file block in the target file corresponding to the first identifier on the second processing device that has changed after the last backup operation; A second backup module configured to perform an incremental backup operation on the changed blocks; The second determination module is also configured to form an incremental backup record corresponding to the incremental backup operation; wherein the incremental backup record includes at least the following associated information: the first identifier, the second identifier corresponding to each of the changed blocks, the version number corresponding to each of the changed blocks, and the backup time.

14. A processing device, characterized in that: include: A third acquisition module is configured to send the file blocks corresponding to all the second identifiers associated with the first identifier on the second processing device to the first storage device, so that the first storage device performs a full backup operation and forms a full backup record corresponding to the full backup operation; wherein the target file to be backed up has a corresponding first identifier, and each file block included in the target file has a second identifier associated with the first identifier; the full backup record includes at least the following associated information: the first identifier, the version numbers of the file blocks corresponding to all the second identifiers associated with the first identifier, and the backup time; The third determination module is configured to send the changed blocks to the first storage device, so that the first storage device performs an incremental backup operation and forms an incremental backup record corresponding to the incremental backup operation; wherein the changed blocks are file blocks in the target file corresponding to the first identifier on the second processing device, which have changed after the last backup operation; and the incremental backup record includes at least the following related information: the first identifier, the second identifier corresponding to each of the changed blocks, the version number corresponding to each of the changed blocks, and the backup time.

15. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores instructions, and when the instructions are executed on a computer, the computer is enabled to execute the method according to any one of claims 1 to 11.

16. A computer program, characterized in that The computer program comprises computer instructions, and when the computer instructions are executed on a computer device, the computer device is caused to execute the method according to any one of claims 1 to 11.

Citation Information

Patent Citations

  • Database backup and recovery method, apparatus and system

    CN105446828A

  • File backup and recovery method and device

    CN111309526A

  • Data recovery processing method and device, equipment, storage medium and program product

    CN115292094A

  • File backup method and device, file recovery method and device, equipment and storage medium

    CN115328704A

  • Method and device for recovering data file and client

    CN115357429A