Method for restoring file, method for backing up file, storage device, processing device, and storage medium
By setting identifiers and version numbers for file blocks, the problems of redundant storage and complex recovery in file backup are solved, achieving efficient and accurate file recovery and reducing redundant storage.
Patent Information
- Application Number
- CN202411992204.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-11-18
- Estimated Expiration
- 2044-12-31
AI Technical Summary
In existing technologies, full backup and incremental backup methods lead to increased file redundancy, occupy storage space and computing resources, and the recovery operation is complex and time-consuming, making it impossible to achieve fine-grained recovery.
By setting a first and second identifier for file blocks and recording full and incremental backup records, including version numbers and backup times, accurate recovery of file blocks and reduction of redundant storage can be achieved.
It optimizes the efficiency and accuracy of file recovery, reduces redundant data storage, and implements a flexible recovery mechanism.
Smart Images

Figure CN119847822B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of file backup, 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
[0002] File backup and recovery is an important way to ensure data security and integrity. In the prior art, full backup and incremental backup are usually used to backup files. This method optimizes the problem of file redundancy caused by the need to backup all files every time. However, due to the simplicity of the incremental backup detection method, the incremental backup also leads to repeated backup of files. Especially in the backup process of large files, it is easy to increase redundant data, which occupies a large amount of storage space and computing resources. In addition, the inventors have found that the recovery operation often needs to rely on a complete backup chain, and the recovery process can be complex and time-consuming, and a fine-grained recovery mechanism cannot be performed. Therefore, it is urgent to improve the accuracy and efficiency of backup, reduce redundant storage, and implement a more flexible recovery mechanism. SUMMARY
[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] In one aspect, the embodiments of the present application provide a method for restoring a file, applied to a first storage device, the first storage device storing a full backup record corresponding to at least one full backup operation of a 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 at least includes the following associated information: the first identifier, a full version number of each file block corresponding to all second identifiers associated with the first identifier, and a backup time; the incremental backup record at least includes the following associated information: the first identifier, each second identifier corresponding to a changed block, an incremental version number corresponding to each changed block, and a backup time;
[0005] The method comprises:
[0006] receiving a recovery request sent by a second processing device, the recovery request being used to request to restore a target file at a target time;
[0007] determining a target backup record, wherein the target backup record includes: a full backup record corresponding to a latest full backup operation before the target time, and all incremental backup records between the backup time corresponding to the latest full backup operation and the target time;
[0008] Based on the target backup record, determine the latest version number corresponding to each second identifier respectively;
[0009] Send the file block corresponding to the latest version number to the second processing device, so that the second processing device combines the file block corresponding to the latest version number to obtain the target file at the target time.
[0010] Optionally, the method further comprises:
[0011] Generate 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;
[0012] Send the file list to the second processing device, so that the second processing device performs file recovery on the file block 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 comprises:
[0014] Receive the file block corresponding to each second identifier associated with the first identifier on the second processing device;
[0015] Perform a temporary backup operation on the file block corresponding to each second identifier to form a temporary backup record corresponding to the temporary backup operation;
[0016] In the case that the second processing device obtains the target file at the target time, in response to the rollback request sent by the second processing device, send all file blocks backed up by the temporary backup operation to the second processing device based on the temporary backup record.
[0017] Optionally, the method further comprises:
[0018] Obtain the creation time of the target file corresponding to the first identifier on the second processing device;
[0019] If the creation time is later than the target time, send a file deletion request to the second processing device to make the second processing device delete 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, send a file creation request to the second processing device to make the second processing device create a target file.
[0022] On the other hand, this application provides a method for backing up files, characterized in that it is applied to a first storage device, and the target file to be backed up on a second processing device has a corresponding first identifier, and each file block contained in the target file has a second identifier associated with the first identifier;
[0023] The method includes:
[0024] Receive the file blocks corresponding to each of the second identifiers associated with the first identifier on the second processing device;
[0025] Perform a full backup of the file blocks corresponding to each of the second identifiers;
[0026] A full backup record corresponding to the full backup operation is formed; wherein, the full backup record includes at least the following associated information: the first identifier, the version number of the file block corresponding to each of the second identifiers associated with the first identifier, and the backup time;
[0027] Receive a modified block, wherein the modified block is a file block in the target file corresponding to the first identifier on the second processing device that has been modified since the last backup operation;
[0028] Perform incremental backup operations on the changed blocks;
[0029] An incremental backup record is formed 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 modified blocks, the version number corresponding to each of the modified blocks, and the backup time.
[0030] Optionally, before receiving the modified block, the method further includes:
[0031] Send a first time to the second processing device, wherein the first time is the backup time corresponding to the previous backup operation;
[0032] If the update time of the target file corresponding to the first identifier is later than the first time, all second identifiers and the corresponding first file fingerprints are received; wherein, the first file fingerprint is the file fingerprint of the file block on the second processing device;
[0033] File blocks with the same second identifier but different corresponding first and second file fingerprints are identified as variable blocks; wherein, the second file fingerprint is the file fingerprint of the file block with the latest version number on the first storage device;
[0034] Add the second identifier corresponding to the modified block to the backup list;
[0035] The backup list is sent to the second processing device so that the second processing device can locate the change block according to the second identifier included in the backup list.
[0036] Optionally, before receiving the modified block, the method further includes:
[0037] Send a first time to the second processing device, wherein the first time is the backup time corresponding to the previous backup operation;
[0038] The system receives a second identifier corresponding to an update block and a corresponding first file fingerprint, wherein the update block is a file block determined from the file blocks of the target file corresponding to the first identifier on the second processing device, and the update time is later than the first time; the first file fingerprint is the file fingerprint of the file block on the second processing device.
[0039] Update blocks that have the same second identifier but different corresponding first and second file fingerprints are identified as change blocks; wherein, the second file fingerprint is the file fingerprint of the file block with the latest version number on the first storage device;
[0040] Add the second identifier corresponding to the modified block to the backup list;
[0041] The backup list is sent to the second processing device so that the second processing device can locate the change block according to the second identifier included in the backup list.
[0042] On the other hand, this application embodiment proposes another method for backing up files, applied to a second processing device, wherein the target file to be backed up has a corresponding first identifier, and each file block contained in the target file has a second identifier associated with the first identifier;
[0043] The method includes:
[0044] The second processing device sends the file blocks corresponding to each of the second identifiers associated with the first identifier 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 number of the file blocks corresponding to each of the second identifiers associated with the first identifier, and the backup time;
[0045] The modified block is sent 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 modified block is a file block in the target file corresponding to the first identifier on the second processing device that has changed since the last backup operation; the incremental backup record includes at least the following associated information: the first identifier, the second identifier corresponding to each of the modified blocks, the version number corresponding to each of the modified blocks, and the backup time.
[0046] Optionally, before sending the modified block to the first storage device, the method further includes:
[0047] Obtain the first time, which is the backup time corresponding to the previous backup operation;
[0048] If the update time of the target file corresponding to the first identifier is later than the first time, all second identifiers and the corresponding first file fingerprints are sent 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 with the same second identifier but different corresponding first file fingerprint and second file fingerprint; the second file fingerprint is the file fingerprint of a file block with the latest version number on the first storage device;
[0050] The changed blocks are located based on the second identifier included in the list to be backed up.
[0051] Optionally, before sending the modified block to the first storage device, the method further includes:
[0052] Obtain the first time, which is the backup time corresponding to the previous backup operation;
[0053] The update block is determined from the file block of the target file corresponding to the first identifier, wherein the update block is the file block on the second processing device whose update time is later than the first time;
[0054] The second identifier corresponding to the update block and the corresponding first file fingerprint are sent to the first storage device, wherein the first file fingerprint is the 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 updated block with the same second identifier but different corresponding first file fingerprint and second file fingerprint; the second file fingerprint is the file fingerprint of a file block with a latest version number on the first storage device;
[0056] The changed blocks are located based on the second identifier included in the list to be backed up.
[0057] On the other hand, embodiments of this application propose a storage device, wherein the first storage device stores full backup records corresponding to at least one full backup operation of a backed-up target file, and incremental backup records 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 each file block corresponding to all 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 modified block, the incremental version number corresponding to each modified block, and the backup time; including:
[0058] The first acquisition module is configured to receive a recovery request sent by the second processing device, wherein the recovery request is used to request the recovery of the target file at the target time.
[0059] The first determining module is configured to determine the target backup record, wherein the target backup record includes: the 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 determining module is further configured to determine the latest version number corresponding to each second identifier based on the target backup record;
[0061] The first processing module is configured to send the file block corresponding to the latest version number to the second processing device, so that the second processing device can combine the file block corresponding to the latest version number to obtain the target file at the target time.
[0062] On the other hand, embodiments of this application propose a storage device, including:
[0063] The 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 contained in the target file has a second identifier associated with the first identifier.
[0064] The first backup module is configured to perform a full backup operation on the file blocks corresponding to each of the second identifiers.
[0065] The second determining module is configured to generate 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 number of the file block corresponding to each of the second identifiers associated with the first identifier, and the backup time;
[0066] The second acquisition module is further configured to receive a modified block, wherein the modified block is a file block in the target file corresponding to the first identifier on the second processing device that has been modified after the last backup operation;
[0067] The second backup module is configured to perform incremental backup operations on the changed block.
[0068] The second determining module is further 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, embodiments of this application propose a processing apparatus, including:
[0070] The third acquisition module is configured to send the file blocks corresponding to all 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 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 version number of the file block corresponding to all second identifiers associated with the first identifier, and the backup time;
[0071] The third determining module is configured to send the changed block 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 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; 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.
[0072] On the other hand, embodiments of this disclosure provide a computer program product storing a computer program that, when executed by a processor, implements the steps of the above-described method.
[0073] On the other hand, embodiments of this disclosure provide a storage medium carrying one or more computer programs that, when executed by a processor, implement the steps of the above-described method.
[0074] This application enables file recovery at a specified time by setting identifiers and version numbers for backup file blocks. It optimizes recovery efficiency and accuracy for recovery requests at different points in time, ensuring the recovery of the required files. Furthermore, by setting associated identifiers for each file and file block, this application effectively tracks and manages each file block within the target file. Moreover, by setting identifiers and version numbers for backup file blocks, incremental backups are performed only after changes to the content of the file blocks, reducing redundant data storage and improving backup efficiency. Attached Figure Description
[0075] Figure 1 This is a flowchart of a method for recovering files according to an embodiment of this application;
[0076] Figure 2 This is another flowchart illustrating the method for recovering files according to an embodiment of this application;
[0077] Figure 3 This is another flowchart illustrating the method for recovering files according to an embodiment of this application;
[0078] Figure 4 This is another flowchart illustrating the method for recovering files according to an embodiment of this application;
[0079] Figure 5 This is a flowchart illustrating a method for backing up files according to an embodiment of this application;
[0080] Figure 6 This is another flowchart illustrating a method for backing up files according to an embodiment of this application;
[0081] Figure 7 This is yet another flowchart illustrating a method for backing up files according to an embodiment of this application;
[0082] Figure 8 A flowchart illustrating another method for backing up files according to an embodiment of this application;
[0083] Figure 9 This is a flowchart illustrating the process of backing up files according to an embodiment of this application.
[0084] Figure 10 This is a structural block diagram of a storage device according to an embodiment of this application.
[0085] Figure 11 This is a structural block diagram of a storage device according to another embodiment of this application.
[0086] Figure 12This is a structural block diagram of a processing apparatus according to an embodiment of this application. Detailed Implementation
[0087] Various embodiments and features of this application are described herein with reference to the accompanying drawings.
[0088] It should be understood that various modifications can be made to the embodiments described herein. Therefore, the above description should not be considered as limiting, but merely as an example of embodiments. Other modifications within the scope and spirit of this application will be apparent to those skilled in the art.
[0089] The accompanying drawings, which are included in and form part of this 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 features of this application will become apparent from the following description of preferred forms of embodiments given as non-limiting examples, with reference to the accompanying drawings.
[0091] It should also be understood that although this application has been described with reference to some specific examples, those skilled in the art can certainly implement many other equivalent forms of this application.
[0092] The above and other aspects, features and advantages of this application will become more apparent when taken in conjunction with the accompanying drawings and in view of the following detailed description.
[0093] Specific embodiments of this application are described thereafter with reference to the accompanying drawings; however, it should be understood that the claimed embodiments are merely examples of this application, which can be implemented in various ways. Well-known and / or repeated functions and structures are not described in detail to avoid unnecessary or redundant details that could obscure the application. Therefore, the specific structural and functional details claimed herein are not intended to be limiting, but merely serve as the basis and representative basis for the claims to teach those skilled in the art to use this application in a variety of substantially any suitable detailed structures.
[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 this application.
[0095] This application provides a method for recovering files. The method is applied to a first storage device, which can be a backup server used for backing up and storing files. The first storage device can also be a terminal device, such as a secure storage box. The target file is a file stored by a second processing device, which can be a file server, client, or terminal device. The target file can be a text file, an image file, or other similar file. After storing the target file, the second processing device needs to back it up. This backup is performed through the first storage device. After backing up the target file, the first storage device stores at least one full backup record corresponding to a full backup operation and at least one incremental backup record corresponding to an incremental backup operation. A full backup is a backup operation performed on all file blocks in the target file, while an incremental backup is a backup operation performed when file blocks in the target file change. The target file has a corresponding first identifier, which is a unique identifier for 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 dividing the target file into multiple file blocks, a unique second identifier can be assigned to each file block. 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. The full backup record includes at least the following associated information: the first identifier, the full version number of each file block corresponding to all 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. The incremental backup record includes at least the following associated information: the first identifier, the second identifier corresponding to each modified block, the incremental version number corresponding to each modified block, and the backup time.
[0096] For example, a target file has four file blocks a, b, c, and d. The first identifier of the target file is denoted as F1, and the second identifiers of file blocks a, b, c, and d are denoted as F1a, F1b, F1c, and F1d, respectively. After a full backup operation is performed on the target file at time t1, the full version number corresponding to file blocks a, b, c, and d is 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 a full backup operation is performed on the target file 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 blocks a and b contained in the target file change after the last backup operation at time t2, file blocks a and b are identified as changed blocks, and an incremental backup operation is performed on file blocks a and b. The incremental version number corresponding to file blocks a and b is recorded as v1.1. The incremental backup record of file blocks a and b contained 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 blocks a and b, and the backup time t2.
[0098] If file blocks a and c contained in the target file have changed since the last backup operation at time t3, file blocks a and c are identified as changed blocks, and an incremental backup operation is performed on file blocks a and c. The incremental version number corresponding to file blocks a and c is recorded as v1.2. The incremental backup record of file blocks a and c contained 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 blocks a and c, and the backup time t3.
[0099] Figure 1 A flowchart illustrating the method for recovering files according to this application is shown, as follows: Figure 1 and Figure 9 As shown, the method includes:
[0100] S101, Receive a recovery request sent by the second processing device, the recovery request being used to request the recovery of the target file at the target time;
[0101] In this embodiment, when the second processing device needs to restore the target file at a target time, it can send a restoration request to the first storage device. The restoration request requests the restoration of 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 restoration request sent by the second processing device, the first storage device can restore the target file at the target time according to the restoration request.
[0102] S102, determine the target backup record, wherein the target backup record includes: the 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 recovered based on 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 for 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 records corresponding to the most recent incremental backup operation for the file blocks in the target file that have changed between the backup time corresponding to the most recent full backup operation and the target time.
[0104] For example, if the target time is a certain 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 corresponding to the most recent full backup operation and the target time t3_4 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; and 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, determine 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 its corresponding latest version number. For example, based on the target backup record at target time t3_4, it can be determined that the latest version number corresponding to the second identifier F1a of file block a in the target file is v1.2, the latest version number corresponding to the second identifier F1b of file block b is v1.1, the latest version number corresponding to the second identifier F1c of file block c is v1.2, and the latest version number corresponding to the second identifier F1d of file block d is v1.0.
[0107] S104, 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 block 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, the file block corresponding to the latest version number can be determined to be the file block with the latest version number relative to the target time. The file block corresponding to the latest version number is sent to the second processing device, which combines the file blocks corresponding to the latest version number according to the second identifier and the corresponding latest version number of each file block in the set. This allows the target file required at the target time to be restored, and the target file is the latest version file relative to the target time. For example, based on the target backup record at target time t3_4, the latest version number of file block a in the target file is determined to be v1.2, the latest version number of file block b is v1.1, the latest version number of file block c is v1.2, and the latest version number of file block d is v1.0. Combining the file blocks a, b, c, and d corresponding to the latest version numbers yields the file with the latest version number relative to the target time t3_4.
[0109] This application, through the aforementioned method, when it is necessary to restore a target file at a target time, obtains the full backup record corresponding to the most recent full backup operation before the target time for the file blocks of the target file, as well as all incremental backup records between the backup time of the most recent full backup operation and the target time. It then identifies the file blocks corresponding to the latest version number and combines these file blocks to obtain the target file at the target time. By setting the identifier and version number of the backup file blocks, this application achieves file recovery at a specified time, optimizing the efficiency and accuracy of recovery for recovery requests at different time points, and can recover the required files.
[0110] In one embodiment of this application, such as Figure 2 As shown, the method further includes:
[0111] S105, 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 status of the target file at the target time;
[0112] S106, the file list is sent to the second processing device, so that the second processing device can perform 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 determining the latest version number corresponding to each second identifier, a file list for 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. The second processing device can determine the file blocks that are the latest version relative to the target time required to recover the target file according to the latest version number corresponding to each second identifier in the file list. It also receives the corresponding file blocks from the first storage device according to the latest version number corresponding to each second identifier in the file list. The file blocks with the latest version numbers corresponding to each second identifier in the file list are combined to obtain the target file, which is the latest version relative to the target time, that is, the file that needs to be recovered.
[0115] For example, based on the target backup record at target time t3_4, the latest version number corresponding to the second identifier F1a of file block a is determined to be v1.2, the latest version number corresponding to the second identifier F1b of file block b is v1.1, the latest version number corresponding to the second identifier F1c of file block c is v1.2, and the latest version number corresponding to the second identifier F1d of file block d is v1.0. A file list for the target time is generated based on the information of the above file blocks. The file list includes the first identifier F1, the latest version number v1.2 corresponding to the second identifier F1a of file block a, the latest version number v1.1 corresponding to the second identifier F1b of file block b, the latest version number v1.2 corresponding to the second identifier F1c of file block c, and the latest version number v1.0 corresponding to the second identifier F1d of file block d. Based on 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 this application, such as Figure 3 As shown, after receiving the recovery request sent by the second processing device, the method further includes:
[0117] S107, Receive the file blocks corresponding to each of the second identifiers associated with the first identifier on the second processing device;
[0118] S108, Perform temporary backup operations on the file blocks corresponding to each of the second identifiers to form 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 the 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 receiving a recovery request from the second processing device, the second processing device sends the file blocks corresponding to each of the second identifiers associated with the first identifier to the first storage device. The first storage device performs a temporary backup operation on the file blocks corresponding to each of the received second identifiers, forming a temporary backup record corresponding to the temporary backup operation. For example, when restoring a target file at a target time, the second processing device performs a full backup operation on the current target file. 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 file blocks a, b, c, and d contained in the target file, and the backup time t0.
[0121] If the second processing device obtains the target file at the target time, and the restored target file contains errors or is restored to a version other than the one the user intended due to user error, the second processing device can send a rollback request to the first storage device. In response to the rollback request from 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 second processing device's recovery operation. This ensures that if the target file restored by the second processing device contains errors, the current state of the target file is reverted to the state of the target file at the time the recovery request was sent.
[0122] In one embodiment of this application, such as Figure 4 As shown, the method further includes:
[0123] S110, Obtain the creation time of the target file corresponding to the first identifier on the second processing device;
[0124] S111, 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.
[0125] In this embodiment, before performing the recovery operation on the target file at the target time, the first storage device obtains the creation time of the target file corresponding to the first identifier on the second processing device and determines 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 should not exist on the second processing device at the target time. In this case, the recovery operation on the target file at the target time is not performed first, but a file deletion request is sent to the second processing device to delete the target file on the second processing device, ensuring that the state of the target file on the second processing device is the state required for file recovery. For example, if 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, a file deletion request is sent through the second processing device to delete the target file with the creation time t1_2.
[0126] In one embodiment of this application, the method further includes:
[0127] If 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 to cause the second processing device to create a target file.
[0128] In this embodiment, before performing the recovery operation on the target file at the target time, a first identifier of the target file in the first storage device is obtained, and based on the first identifier, it is determined whether a target file corresponding to the first identifier exists in the second processing device. If a 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 was deleted after the target time. In this case, a file creation request is sent to the second processing device, causing the second processing device to create a target file, ensuring that the state of the target file existing on the second processing device is at the state required for file recovery. For example, if the target time is a certain 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 whose creation time is earlier than the target time t0_1, a file creation request is sent by the second processing device to cause the second processing device to create a target file corresponding to the first identifier F1.
[0129] This application also provides a method for backing up files. The method is applied to a first storage device, which can be a backup server used for backing up and storing files. The first storage device can also be a terminal device, such as a data security storage box. The target file is a file stored on a second processing device, which can be a file server, client, 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 for the target file. The target file includes multiple file blocks, and each file block 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 flowchart illustrating the method for backing up files according to this application is shown, as follows: Figure 5 As shown, the method includes:
[0131] S201, Receive the file blocks corresponding to each of the second identifiers associated with the first identifier on the second processing device;
[0132] S202, Perform a full backup operation on the file blocks corresponding to each of the second identifiers;
[0133] S203, a full backup record corresponding to the full backup operation is formed; wherein, the full backup record includes at least the following associated information: the first identifier, the version number of the file block corresponding to each of the second identifiers associated with the first identifier, and the backup time;
[0134] S204, Receive a modified block, wherein the modified block is a file block in the target file corresponding to the first identifier on the second processing device that has been modified after the last backup operation;
[0135] S205, perform incremental backup operation on the changed block;
[0136] S206, 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 modified blocks, the version number corresponding to each of the modified blocks, and the backup time.
[0137] In this embodiment, during the backup of the target file, a full backup of the target file can be performed 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 second identifiers associated with the first identifier to the first storage device. At the current backup time, the first storage device performs a full backup operation on all file blocks corresponding to the second identifiers. A full backup is a backup operation performed on all file blocks in the target file. After performing 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 associated information: the first identifier of the target file, the version number of each file block corresponding to all second identifiers associated with the first identifier, and the backup time.
[0138] For example, a target file has four file blocks a, b, c, and d. The first identifier of the target file is denoted as F1, and the second identifiers of file blocks a, b, c, and d are denoted as F1a, F1b, F1c, and F1d, respectively. As shown in Table 2, after a full backup of the target file at time t1, the full version number corresponding to file blocks a, b, c, and d is 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 a full backup of the target file is performed 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 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 fully backed up at backup time t5 is v2.0, and the full backup ID can be recorded as 105. After performing full backups of the target file at different times, the backup time, 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: A table illustrating information related to a full backup operation
[0141] When file blocks in the target file of the second processing device change, an incremental backup operation needs to be performed on the changed file blocks at the time of the change. First, the second processing device, based on the target file corresponding to the first identifier, identifies the file blocks that have changed since the last backup operation as changed blocks and sends them to the first storage device. The first storage device can then perform an incremental backup operation on the changed blocks based on the second identifier corresponding to the changed blocks and the time of the change. Incremental backups are backup operations performed when 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. This 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 blocks a and b contained in the target file change after the last backup operation at time t2, file blocks a and b are identified as changed blocks and sent to the first storage device. The first storage device performs incremental backup operations on file blocks a and b. Since the version number corresponding to the most recent incremental operation of the changed file blocks is 1.0, the version number generated for the changed file blocks can be based on 1.0. As shown in Table 2, the incremental version number corresponding to file blocks a and b is recorded as v1.1. The incremental backup record of file blocks a and b contained 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 blocks a and b, and the backup time t2.
[0143] If file blocks a and c contained in the target file change after the last backup operation at time t3, file blocks a and c are identified as changed blocks and sent to the first storage device. The first storage device performs incremental backup operations on file blocks a and c. Since the version number corresponding to the most recent incremental operation of the changed file blocks is 1.0, the version number generated for the changed file blocks can be based on 1.0, as shown in Table 2. The incremental version number corresponding to file blocks a and c is recorded as v1.2. The incremental backup record of file blocks a and c contained 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 blocks a and c, and the backup time t3. As shown in Table 1b, the version number of the target file incrementally backed up at backup time t2 is v1.1, and the full backup ID can be recorded as 101; the version number of the target file full backup at backup time t3 is v1.2, and the full backup ID can be recorded as 101; the version number of the target file full backup at backup time t4 is v1.3, and the full backup ID can be recorded as 101. After incremental backups of the file blocks of the target file are performed at different times, the backup time, full backup version number, and full backup ID of the full backup operation can be updated in Tables 1a and 2.
[0144]
[0145]
[0146] Table 1b: A schematic table of information related to incremental backup operations
[0147]
[0148] Table 2: Record table of file block related information
[0149] This application sets a first identifier for the target file to be backed up, 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 all file blocks corresponding to each second identifier, forming a full backup record corresponding to the full backup operation. When a file block in the target file changes, an incremental backup operation is performed on the changed file block, forming 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. Furthermore, by setting the identifier and version number of the backup file block, incremental backups are performed only after the content of the file block changes, reducing redundant data storage and improving backup efficiency.
[0150] In one embodiment of this application, such as Figure 6 As shown, before receiving the variable block, the method further includes:
[0151] S207, send a first time to the second processing device, the first time being the backup time corresponding to the previous backup operation;
[0152] S208, if the update time of the target file corresponding to the first identifier is later than the first time, receive all second identifiers and the corresponding first file fingerprint; wherein, the first file fingerprint is the file fingerprint of the file block on the second processing device;
[0153] S209, file blocks with the same second identifier but different corresponding first and second file fingerprints are identified as variable blocks; wherein, the second file fingerprint is the file fingerprint of the file block with the latest version number on the first storage device;
[0154] S210, add the second identifier corresponding to the modified block to the backup list;
[0155] S211, the backup list is sent to the second processing device so that the second processing device can find the change block according to the second identifier included in the backup list.
[0156] In this embodiment, when the second processing device stores the target file, it can, for example, generate a corresponding file fingerprint for each file block contained in the target file based on algorithms such as SHA-256. If a 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 generates 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 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 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 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. The first file fingerprints and second file fingerprints corresponding to file blocks with the same second identifier are compared. If the first file fingerprint and the second file fingerprint are different, it indicates that the content of the file blocks included in the target file has changed after the target file on the second processing device was updated. The file blocks in the target file on the second processing device with the same second identifier but different first and second file fingerprints are identified as changed blocks. The second identifiers corresponding to all changed blocks in the target file are added to the backup list, and the backup list is sent to the second processing device so that the second processing device can find all changed blocks in the target file according to the second identifiers included in the backup list. After all changed blocks in the target file are identified, 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 of file block a with the second identifier F1a is different from the first file fingerprint, file block a can be determined to be a changed block, and the change time t3 of file a can be determined. 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] If 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 block with the same second identifier, it can be determined whether the content of the target file on the second processing device has changed. Furthermore, if the content of the target file has changed, the modified file block in the target file can be identified, thereby speeding up the processing speed of whether the target file needs to be incrementally backed up.
[0159] In one embodiment of this application, such as Figure 7 As shown, before receiving the variable block, the method further includes:
[0160] S212, send a first time to the second processing device, the first time being the backup time corresponding to the previous backup operation;
[0161] S213, receive the second identifier corresponding to the update block and the corresponding first file fingerprint, wherein the update block is a file block determined from the file block of the target file corresponding to the first identifier on the second processing device, and the update time is later than the first time; the first file fingerprint is the file fingerprint of the file block on the second processing device;
[0162] S214, an update block with the same second identifier but different corresponding first file fingerprint and second file fingerprint is identified 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;
[0163] S215, add the second identifier corresponding to the modified block to the backup list;
[0164] S216, the backup list is sent to the second processing device so that the second processing device can find the change block according to the second identifier included in the backup 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 blocks in the target file have changed due to the update of the target file.
[0166] The second processing device can identify file blocks in the target file whose update time is later than the first time as updated blocks, and send the second identifier and corresponding first file fingerprint of the updated block to the first storage device. The first storage device identifies file blocks with the same second identifier based on the second identifier of the updated block, and compares the first file fingerprint and second file fingerprint corresponding to each updated block and file block with the same second identifier. If the first file fingerprint and second file fingerprint are different, it indicates that the content of the updated block has changed at the update time, and an incremental backup operation is required for the changed updated block. Update blocks in the target file on the second processing device that have the same second identifier but different first and second file fingerprints are identified as changed blocks. The second identifiers corresponding to all changed blocks in the target file are added to the backup list, and the backup list is sent to the second processing device so that the second processing device can find the changed blocks based on the second identifiers included in the backup list. After identifying all changed blocks in the target file, an incremental backup operation can be performed on the changed 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 updated file block c of 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. 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 is updated to Code.c.1.3 at time t4.
[0168] If the target file on the second processing device is updated after the backup time corresponding to the last backup operation, by filtering the update blocks corresponding to the update time and comparing the first and second file fingerprints corresponding to update blocks with the same second identifier and file blocks, it can be determined whether the content of the update blocks on the second processing device has changed. Update blocks with changed content are identified as the changed file blocks in the target file, reducing the number of comparisons on the first storage device, reducing the processing pressure on the first storage device, and accelerating the incremental backup processing speed. This scheme, through multiple verifications, filters out unupdated file blocks and file blocks that, although updated, ultimately have unchanged content, further reducing storage redundancy during the backup process and improving the resource utilization efficiency of the first storage device.
[0169] This application also provides a method for backing up files. The method is applied to a second processing device, which may be a file server, a client, or a terminal device. 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 in the target file has a second identifier associated with the first identifier. The second identifier of each file block is mapped to the first identifier of the target file.
[0170] Figure 8 A flowchart illustrating the method for backing up files according to this application is shown, as follows: Figure 8 As shown, the method includes:
[0171] S301, 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 full backup record includes at least the following associated information: the first identifier, the version number of the file blocks corresponding to all the second identifiers associated with the first identifier, and the backup time;
[0172] S302, the changed block is sent 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 block is a file block in the target file corresponding to the first identifier on the second processing device that has changed since the last backup operation; 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.
[0173] In this embodiment, during the backup of the target file, the second processing device first sends the file blocks corresponding to each of 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. At the current backup time, the first storage device performs a full backup operation on the file blocks corresponding to each of the second identifiers. A full backup is a backup operation performed on all file blocks in the target file. After the first storage device performs a full backup of each file block contained in the target file, it can obtain a full backup record corresponding to the full backup operation. The full backup record includes at least the following associated information: the first identifier of the target file, the version number of each file block corresponding to each of the second identifiers associated with the first identifier, and the backup time.
[0174] For example, a target file has four file blocks a, b, c, and d. The first identifier of the target file is denoted as F1, and the second identifiers of file blocks a, b, c, and d are denoted as F1a, F1b, F1c, and F1d, respectively. After a full backup operation is performed on the target file at time t1, the full version number corresponding to file blocks a, b, c, and d is 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 a full backup operation is performed on the target file 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] When file blocks in the target file of the second processing device change, an incremental backup operation needs to be performed on the changed file blocks at the time of the change. First, the second processing device, based on the target file corresponding to the first identifier, identifies the file blocks that have changed since the last backup operation as changed blocks and sends them to the first storage device. The first storage device can then perform an incremental backup operation on the changed blocks based on the second identifier corresponding to the changed blocks and the time of the change. Incremental backups are backup operations performed when 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. This 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 blocks a and b contained in the target file change after the last backup operation at time t2, file blocks a and b are identified as changed blocks and sent to the first storage device. The first storage device performs incremental backup operations on file blocks a and b. Since the version number corresponding to the most recent incremental operation of the changed file blocks is 1.0, the version number generated for the changed file blocks can be based on 1.0. The incremental version number corresponding to file blocks a and b is recorded as v1.1. The incremental backup record of file blocks a and b contained 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 blocks a and b, and the backup time t2.
[0177] If file blocks a and c contained in the target file have changed since the last backup operation at time t3, file blocks a and c are identified as changed blocks and sent to the first storage device. The first storage device performs incremental backup operations on file blocks a and c. Since the version number corresponding to the most recent incremental operation of the changed file blocks is 1.0, the version number generated for the changed file blocks can be based on 1.0. The incremental version number corresponding to file blocks a and c is recorded as v1.2. The incremental backup record of file blocks a and c contained 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 blocks a and c, and the backup time t3.
[0178] This application sets a first identifier for the target file to be backed up, 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 all file blocks corresponding to each second identifier, forming a full backup record corresponding to the full backup operation. When a file block in the target file changes, an incremental backup operation is performed on the changed file block, forming 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. Furthermore, by setting the identifier and version number of the backup file block, incremental backups are performed only after the content of the file block changes, reducing redundant data storage and improving backup efficiency.
[0179] In one embodiment of this application, before sending the modified block to the first storage device, the method further includes:
[0180] Obtain the first time, which is the backup time corresponding to the previous backup operation;
[0181] If the update time of the target file corresponding to the first identifier is later than the first time, all second identifiers and the corresponding first file fingerprints are sent 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 with the same second identifier but different corresponding first file fingerprint and second file fingerprint; the second file fingerprint is the file fingerprint of a file block with the latest version number on the first storage device;
[0183] The changed blocks are located based on the second identifier included in the list to be backed up.
[0184] In this embodiment, when the second processing device stores the target file, it generates a corresponding file fingerprint for each file block contained in the target file based on the SHA-256 algorithm. If a file block changes, the corresponding file fingerprint will also change. 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 generates a corresponding file fingerprint. If the file block is backed up again, the corresponding file fingerprint will also change. 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 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 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 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. The first file fingerprints and second file fingerprints corresponding to file blocks with the same second identifier are compared. If the first file fingerprint and the second file fingerprint are different, it indicates that the content of the file blocks included in the target file has changed after the target file on the second processing device was updated. The file blocks in the target file on the second processing device with the same second identifier but different first and second file fingerprints are identified as changed blocks. The first storage device adds the second identifiers corresponding to all changed blocks in the target file to the backup list and sends the backup list 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 backup list. 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 operation. If 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 block with the same second identifier, it can be determined whether the content of the target file on the second processing device has changed. Furthermore, if the content of the target file has changed, the modified file block in the target file can be identified, thereby speeding up the processing speed of whether the target file needs to be incrementally backed up.
[0186] In one embodiment of this application, before sending the modified block to the first storage device, the method further includes:
[0187] Obtain the first time, which is the backup time corresponding to the previous backup operation;
[0188] The update block is determined from the file block of the target file corresponding to the first identifier, wherein the update block is the file block on the second processing device whose update time is later than the first time;
[0189] The second identifier corresponding to the update block and the corresponding first file fingerprint are sent to the first storage device, wherein the first file fingerprint is the 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 updated block with the same second identifier but different corresponding first file fingerprint and second file fingerprint; the second file fingerprint is the file fingerprint of a file block with a latest version number on the first storage device;
[0191] The changed blocks are located based on the second identifier included in the list to be backed up.
[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 blocks in the target file have changed due to the update of the target file.
[0193] The second processing device can identify file blocks in the target file whose update time is later than the first time as updated blocks, and send the second identifier and corresponding first file fingerprint of the updated block to the first storage device. The first storage device identifies file blocks with the same second identifier based on the second identifier of the updated block, and compares the first file fingerprint and second file fingerprint of each updated block and file block with the same second identifier. If the first file fingerprint and second file fingerprint are different, it indicates that the content of the updated block has changed at the update time, and an incremental backup operation is required for the changed updated block. The first storage device identifies updated blocks in the target file on the second processing device with the same second identifier but different first file fingerprints and second file fingerprints as changed blocks, and adds the second identifiers corresponding to all changed blocks in the target file to the backup list, and sends the backup list to the second processing device. The second processing device searches for changed blocks based on the second identifiers included in the backup list. After identifying all changed blocks in the target file, the second processing device can send the changed blocks to the first storage device for incremental backup operation.
[0194] If the target file on the second processing device is updated after the backup time corresponding to the last backup operation, by filtering the update blocks corresponding to the update time and comparing the first file fingerprint and second file fingerprint corresponding to the update blocks with the same second identifier and the file blocks respectively, it can be determined whether the content of the update blocks on the second processing device has changed, and the update blocks whose content has changed are identified as the file blocks in the target file that have changed. This reduces the number of comparisons on the first storage device, reduces the processing pressure on the first storage device, and speeds up the incremental backup processing speed.
[0195] This application also provides a storage device, such as... Figure 10 As shown, 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; 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 each file block corresponding to all 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 modified block, the incremental version number corresponding to each modified block, and the backup time; including:
[0196] The first acquisition module is configured to receive a recovery request sent by the second processing device, wherein the recovery request is used to request the recovery of the target file at the target time.
[0197] The first determining module is configured to determine the target backup record, wherein the target backup record includes: the 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 determining module is further configured to determine the latest version number corresponding to each second identifier based on the target backup record;
[0199] The first processing module is configured to send the file block corresponding to the latest version number to the second processing device, so that the second processing device can combine the file block corresponding to the latest version number to obtain the target file at the target time.
[0200] This application also provides a storage device, such as... Figure 11 As shown, it includes:
[0201] The 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 contained in the target file has a second identifier associated with the first identifier.
[0202] The first backup module is configured to perform a full backup operation on the file blocks corresponding to each of the second identifiers.
[0203] The second determining module is configured to generate 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 number of the file block corresponding to each of the second identifiers associated with the first identifier, and the backup time;
[0204] The second acquisition module is further configured to receive a modified block, wherein the modified block is a file block in the target file corresponding to the first identifier on the second processing device that has been modified after the last backup operation;
[0205] The second backup module is configured to perform incremental backup operations on the changed block.
[0206] The second determining module is further 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] This application also provides a processing device, such as... Figure 12 As shown, it includes:
[0208] The third acquisition module is configured to send the file blocks corresponding to all 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 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 version number of the file block corresponding to all second identifiers associated with the first identifier, and the backup time;
[0209] The third determining module is configured to send the changed block 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 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; 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.
[0210] On the other hand, this application also provides a computer program product storing a computer program that, when executed by a processor, implements the methods provided in any embodiment of the present invention, including the above-described methods for restoring files and backing up files.
[0211] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the steps of the above-described method.
[0212] Optionally, in this embodiment, the storage medium may include, but is not limited to, various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk. Optionally, specific examples in this embodiment can be found in the examples described in the above embodiments and optional implementations, and will not be repeated here. Obviously, those skilled in the art should understand that the steps of this application described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. Optionally, they can be implemented using computer-executable program code, thereby storing them in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than presented here, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, this application is not limited to any specific hardware and software combination.
[0213] Although preferred embodiments of this application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of this application.
[0214] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.
Claims
1. A method for recovering files, characterized in that, The method is applied to a first storage device, which stores at least one full backup record corresponding to a full backup operation of a backed-up target file, and at least one incremental backup record corresponding to an incremental backup operation. 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 each file block corresponding to all 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 changed block, the incremental version number corresponding to each changed block, and the backup time. The changed block is a file block in the target file corresponding to the first identifier on a second processing device that has changed since the last backup operation. The method includes: Receive a recovery request sent by the second processing device, the recovery request being used to request the recovery of the target file at the target time; The target backup record is determined, wherein the target backup record includes: the full backup record corresponding to the most recent full backup operation before the target time, and all incremental backup records between the backup time of the most recent full backup operation and the target time. Based on the target backup record, determine the latest version number corresponding to each second identifier; 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 block corresponding to the latest version number to obtain the target file at the target time. 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 status of the target file at the target time; The file list is sent to the second processing device, which then performs file recovery on the file blocks received from the first storage device based on the file list.
2. The method as described in claim 1, characterized in that, After receiving the recovery request sent by the second processing device, the method further includes: Receive the file blocks corresponding to each of the second identifiers associated with the first identifier on the second processing device; Perform temporary backup operations on the file blocks corresponding to each of the second identifiers to form temporary backup records corresponding to the temporary backup operations; When the second processing device obtains the target file at the target time, in response to the 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.
3. The method according to any one of claims 1 to 2, characterized in that, The method further includes: Obtain the creation time of the 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, causing the second processing device to delete the target file on the second processing device.
4. The method according to any one of claims 1 to 2, characterized in that, The method further includes: If 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 to cause the second processing device to create a target file.
5. A method for backing up files, characterized in that, The target file to be backed up on the first storage device and the second processing device has a corresponding first identifier, and each file block contained in the target file has a second identifier associated with the first identifier. The method includes: Receive the file blocks corresponding to each of the second identifiers associated with the first identifier on the second processing device; Perform a full backup of the file blocks corresponding to each of the second identifiers; A full backup record corresponding to the full backup operation is formed; wherein, the full backup record includes at least the following associated information: the first identifier, the version number of the file block corresponding to each of the second identifiers associated with the first identifier, and the backup time; Receive a modified block, wherein the modified block is a file block in the target file corresponding to the first identifier on the second processing device that has been modified since the last backup operation; Perform incremental backup operations on the changed blocks; An incremental backup record is generated 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; before receiving the changed blocks, the method further includes: Send a first time to the second processing device, wherein the first time is the backup time corresponding to the previous backup operation; If the update time of the target file corresponding to the first identifier is later than the first time, all second identifiers and the corresponding first file fingerprints are received; wherein, the first file fingerprint is the file fingerprint of the file block on the second processing device; File blocks with the same second identifier but different corresponding first and second file fingerprints are identified as variable blocks; wherein, the second file fingerprint is the file fingerprint of the file block with the latest version number on the first storage device; Add the second identifier corresponding to the modified block to the backup list; The backup list is sent to the second processing device so that the second processing device can locate the change block according to the second identifier included in the backup list.
6. The method as described in claim 5, characterized in that, Before receiving the modified block, the method further includes: Send a first time to the second processing device, wherein the first time is the backup time corresponding to the previous backup operation; The system receives a second identifier corresponding to an update block and a corresponding first file fingerprint, wherein the update block is a file block determined from the file blocks of the target file corresponding to the first identifier on the second processing device, and the update time is later than the first time; the first file fingerprint is the file fingerprint of the file block on the second processing device. Update blocks that have the same second identifier but different corresponding first and second file fingerprints are identified as change blocks; wherein, the second file fingerprint is the file fingerprint of the file block with the latest version number on the first storage device; Add the second identifier corresponding to the modified block to the backup list; The backup list is sent to the second processing device so that the second processing device can locate the change block according to the second identifier included in the backup list.
7. A method for backing up files, characterized in that, Applied to a second processing device, the target file to be backed up has a corresponding first identifier, and each file block contained in the target file has a second identifier associated with the first identifier; The method includes: The second processing device sends the file blocks corresponding to each of the second identifiers associated with the first identifier 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 number of the file blocks corresponding to each of the second identifiers associated with the first identifier, and the backup time; The method involves sending the modified block to a first storage device, causing the first storage device to perform an incremental backup operation and generate an incremental backup record corresponding to the incremental backup operation; wherein the modified block is a file block in the target file corresponding to the first identifier on the second processing device that has changed since the last backup operation; the incremental backup record includes at least the following associated information: the first identifier, the second identifier corresponding to each modified block, the version number corresponding to each modified block, and the backup time; before sending the modified block to the first storage device, the method further includes: Obtain the first time, which is the backup time corresponding to the previous backup operation; If the update time of the target file corresponding to the first identifier is later than the first time, all second identifiers and the corresponding first file fingerprints are sent 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 with the same second identifier but different corresponding first file fingerprint and second file fingerprint; the second file fingerprint is the file fingerprint of a file block with the latest version number on the first storage device; The changed blocks are located based on the second identifier included in the list to be backed up.
8. The method as described in claim 7, characterized in that, Before sending the modified block to the first storage device, the method further includes: Obtain the first time, which is the backup time corresponding to the previous backup operation; The update block is determined from the file block of the target file corresponding to the first identifier, wherein the update block is the file block on the second processing device whose update time is later than the first time; The second identifier corresponding to the update block and the corresponding first file fingerprint are sent 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 an updated block with the same second identifier but different corresponding first file fingerprint and second file fingerprint; the second file fingerprint is the file fingerprint of a file block with a latest version number on the first storage device; The changed blocks are located based on the second identifier included in the list to be backed up.
9. A storage device, characterized in that, The 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; 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 each file block corresponding to all 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 changed block, the incremental version number corresponding to each changed block, and the backup time; 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; including: The first acquisition module is configured to receive a recovery request sent by the second processing device, wherein the recovery request is used to request the recovery of the target file at the target time. The first determining module is configured to determine the target backup record, wherein the target backup record includes: the 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 determining module is further configured to determine the latest version number corresponding to each second identifier based on the target backup record; The first processing module is configured to send the file block corresponding to the latest version number to the second processing device, so that the second processing device can combine the file block corresponding to the latest version number to obtain the target file at the target time. The first processing module is further configured to 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 status of the target file at the target time; The file list is sent to the second processing device, which then performs file recovery on the file blocks received from the storage device based on the file list.
10. A storage device, characterized in that, include: The 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 contained in the target file has a second identifier associated with the first identifier. The first backup module is configured to perform a full backup operation on the file blocks corresponding to each of the second identifiers. The second determining module is configured to generate 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 number of the file block corresponding to each of the second identifiers associated with the first identifier, and the backup time; The second acquisition module is further configured to receive a modified block, wherein the modified block is a file block in the target file corresponding to the first identifier on the second processing device that has been modified after the last backup operation; The second backup module is configured to perform incremental backup operations on the changed block. The second determining module is further 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; The second backup module is further configured to send a first time to the second processing device, wherein the first time is the backup time corresponding to the last backup operation; If the update time of the target file corresponding to the first identifier is later than the first time, all second identifiers and the corresponding first file fingerprints are received; wherein, the first file fingerprint is the file fingerprint of the file block on the second processing device; File blocks with the same second identifier but different corresponding first and second file fingerprints are identified as variable blocks; wherein, the second file fingerprint is the file fingerprint of the file block with the latest version number on the storage device; Add the second identifier corresponding to the modified block to the backup list; The backup list is sent to the second processing device so that the second processing device can locate the change block according to the second identifier included in the backup list.
11. A processing apparatus, characterized in that, include: The third acquisition module is configured to send the file blocks corresponding to all second identifiers associated with the first identifier on the 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 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 version number of the file block corresponding to all second identifiers associated with the first identifier, and the backup time; The third determining module is configured to send the changed block 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 block is a file block in the target file corresponding to the first identifier on the processing device that has changed since the last backup operation; 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 third determining module is further configured to obtain a first time, wherein the first time is the backup time corresponding to the previous backup operation; If the update time of the target file corresponding to the first identifier is later than the first time, all second identifiers and the corresponding first file fingerprints are sent to the first storage device, wherein the first file fingerprint is the file fingerprint of the file block on the 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 with the same second identifier but different corresponding first file fingerprint and second file fingerprint; the second file fingerprint is the file fingerprint of a file block with the latest version number on the first storage device; The changed blocks are located based on the second identifier included in the list to be backed up.
12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores instructions that, when executed on a computer, cause the computer to perform the method according to any one of claims 1-8.
13. A computer program, characterized in that, The computer program includes computer instructions that, when executed on a computer device, cause the computer device to perform the method according to any one of claims 1-8.
Citation Information
Patent Citations
Data recovery processing method and device, equipment, storage medium and program product
CN115292094A
Method and device for recovering data file and client
CN115357429A