Data backup methods, recovery methods, electronic devices, media and software products
By obtaining and recording the correspondence between the logical address and physical address of the target data in the storage dual-living volume technology, the problem of difficulty in recovering after data is damaged by viruses is solved, and the ability to recover quickly and disaster recovery and backup is achieved. promote.
Patent Information
- Application Number
- CN202411367307.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-29
- Publication Date
- 2024-12-20
- Estimated Expiration
- 2044-09-29
AI Technical Summary
After the data is implanted into a virus, the data of multiple storage devices will be damaged, making data recovery difficult and cannot effectively reduce RPO and RTO.
By obtaining the correspondence between the logical address and physical address of the target data, the original relationship is terminated and a new relationship is established, the data is written to different physical addresses, and the original relationship is recorded in the backup table, so that data is quickly rolled back when data is restored Go to the original data.
Reduces the difficulty of data recovery, ensures that data can be quickly recovered when storage device failures, reduces RPO and RTO, and enhances the disaster recovery and backup capabilities of storage dual live volumes.
Smart Images

Figure CN118897759B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of storage technology, and in particular to a data backup method, a recovery method, an electronic device, a medium, and a program product. Background Art
[0002] Storage active-active volume technology means that in a storage system, two or more groups of storage devices are running simultaneously, and these storage devices are mutually productive and backup. When one of the storage devices fails, the business can be switched to other storage devices. In this way, problems such as service interruption or data loss caused by the failure of a single storage device can be avoided, and the system has better disaster recovery and backup capabilities.
[0003] However, this storage technology also has some problems. When the data saved in one of the storage devices is implanted with a virus, the virus-infected data will also overwrite the data in other storage devices at the same time, causing the data in multiple storage devices to be destroyed, making data recovery more difficult. Summary of the invention
[0004] In view of this, the implementation method of the present disclosure provides a data backup method, a data recovery method, an electronic device, a computer-readable storage medium and a computer program product, which can reduce the difficulty of data recovery.
[0005] On the one hand, the present disclosure provides a data backup method, the method comprising:
[0006] Acquire a target logical address allocated for target data to be written into a storage device, and a first physical address in the storage device currently corresponding to the target logical address;
[0007] Removing the correspondence between the target logical address and the first physical address, and creating a correspondence between the target logical address and a second physical address in the storage device, wherein the first physical address and the second physical address are different;
[0008] Writing the target data into the second physical address;
[0009] When the target logical address is not found in the backup table, the corresponding relationship between the target logical address and the first physical address is written into the backup table.
[0010] The present disclosure provides a data recovery method, the method comprising:
[0011] In response to receiving a data recovery instruction for a storage device, obtaining a backup table of the storage device, wherein the backup table is obtained based on the data backup method as described above;
[0012] Searching the backup table for a correspondence between a target logical address and a first physical address in the storage device;
[0013] Determine a second physical address in the storage device currently corresponding to the target logical address;
[0014] The data at the second physical address is overwritten with the data at the first physical address.
[0015] Another aspect of the present disclosure provides an electronic device, which includes a processor and a memory, wherein the memory is used to store a computer program, and when the computer program is executed by the processor, the method described above is implemented.
[0016] Another aspect of the present disclosure further provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store a computer program, and when the computer program is executed by a processor, the method described above is implemented.
[0017] Another aspect of the present disclosure provides a computer program product, including a computer program, and when the computer program is executed by a processor, the method as described above is implemented.
[0018] In the technical solutions of some embodiments of the present disclosure, after obtaining the target logical address assigned to the target data and the first physical address corresponding to the target logical address, the physical address corresponding to the target logical address is modified from the first physical address to the second physical address, and the target data is written to the second physical address, and the correspondence between the target logical address and the first physical address is saved in the backup table. In this way, in addition to successfully modifying the data at the target logical address, when a storage device fails (for example, when the data in the storage device is implanted with a virus), based on the correspondence between the target logical address and the first physical address in the backup table, the original data stored at the target logical address can be found in time, and then the data at the target logical address can be rolled back and restored based on the original data, greatly reducing the difficulty of data recovery. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The features and advantages of the present disclosure will be more clearly understood by referring to the accompanying drawings, which are schematic and should not be construed as limiting the present disclosure in any way. In the accompanying drawings:
[0020] Figure 1 A schematic diagram of a module for storing active-active volumes provided by an embodiment of the present disclosure is shown;
[0021] Figure 2 A schematic diagram showing a flow chart of a data backup method provided by an embodiment of the present disclosure is shown;
[0022] Figure 3A schematic diagram of data storage provided by an embodiment of the present disclosure is shown;
[0023] Figure 4 A schematic diagram of data storage provided by another embodiment of the present disclosure is shown;
[0024] Figure 5 For Figure 4 A schematic diagram of the correspondence between the target logical address and the physical address obtained after the update;
[0025] Figure 6 A schematic diagram showing multiple preset time points provided by an embodiment of the present disclosure is shown;
[0026] Figure 7 A schematic diagram showing various backup tables corresponding to the current day and the new current day provided by an embodiment of the present disclosure is shown;
[0027] Figure 8 A schematic diagram showing various backup tables corresponding to the current day and the new current day provided by another embodiment of the present disclosure is shown;
[0028] Fig. 9 A schematic diagram of a data recovery method according to an embodiment of the present disclosure is shown;
[0029] Fig.10 A schematic diagram of an electronic device provided by an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0030] In order to make the purpose, technical scheme and advantages of the implementation method of the present disclosure clearer, the technical scheme in the implementation method of the present disclosure will be clearly and completely described below in conjunction with the drawings in the implementation method of the present disclosure. Obviously, the implementation method described is a part of the implementation method of the present disclosure, not all of the implementation methods. Based on the implementation method in the present disclosure, all other implementation methods obtained by those skilled in the art without creative work are within the scope of protection of the present disclosure.
[0031] Combined with reference Figure 1 , which is a schematic diagram of a module for storing active-active volumes provided in one embodiment of the present disclosure. Figure 1 In the dual-active volume, the active-active volume may include a primary volume, an auxiliary volume, a primary volume change volume, and an auxiliary volume change volume, and each volume may have a corresponding storage device. These storage devices are used to store data written into the corresponding volume.
[0032] The primary volume and the secondary volume can be in two geographically separated data centers. By using technologies such as storage virtualization and data mirroring across data centers, combined with upper-layer application clusters, the primary volume and the secondary volume can be in operation at the same time and in a synchronous replication relationship. The so-called synchronous replication means that the data between the primary volume and the secondary volume can be synchronized in real time. For example, if the data in the primary volume changes at 10:02, then this change will be synchronized to the secondary volume in real time. In this way, the data in the primary volume and the secondary volume is guaranteed to be the same in real time, so that when one of the primary and secondary volumes fails, the business can be switched to the other volume, thereby greatly improving the disaster recovery and backup capabilities of storage.
[0033] A bidirectional snapshot relationship can be formed between the primary volume and the primary volume change volume, and a bidirectional snapshot relationship can be formed between the secondary volume and the secondary volume change volume. The so-called bidirectional snapshot means that one volume can save the data of the other volume at a certain point in time. For example, the primary volume change volume can take a snapshot of the primary volume at 10:00, and the data in the primary volume change volume is fixed to the data of the primary volume at 10:00. In this way, based on the primary volume change volume and the secondary volume change volume, the data in the primary volume and the secondary volume can be backed up at a specified time point.
[0034] It should be noted that the bidirectional snapshot relationship between the primary volume and the primary volume change volume, and the bidirectional snapshot relationship between the secondary volume and the secondary volume change volume, can be different from the real-time data synchronization relationship between the primary volume and the secondary volume. For example, after the primary volume change volume takes a snapshot of the primary volume at 10:00, the data in the primary volume change volume is fixed to the data of the primary volume at 10:00. If the data in the primary volume changes at 10:02, this change may not be synchronized to the primary volume change volume in real time, but needs to be synchronized to the secondary volume in real time.
[0035] Based on the above description, applications that need to read and write data can be installed in the business host. When these applications need to store data (that is, write data to the storage device), the data can be written to the primary volume first, and then the data written to the primary volume can be synchronized to the secondary volume through the synchronous replication relationship between the primary volume and the secondary volume. Based on the bidirectional snapshot relationship between the primary volume and the primary volume change volume, and the bidirectional snapshot relationship between the secondary volume and the secondary volume change volume, the data written to the primary volume can be synchronized to the primary volume change volume and the secondary volume change volume at a specific time point.
[0036] Figure 1The storage active-active volume shown in the figure can have many advantages, which are specifically reflected in the RPO (Recovery Point Objective) and RTO (Recovery Time Objective) can be smaller. Among them, RPO can represent the amount of data loss when the storage device fails. RTO can represent the shortest time required for the storage device to recover from failure. In practical applications, Figure 1 The RPO of the storage active-active volume shown may be equal to 0 or close to 0, and the RTO may also be a relatively small value.
[0037] However, this type of storage active-active volume also has some problems. That is, when the data written to the primary volume is implanted with a virus (such as a ransomware virus), through synchronous replication, two-way snapshots and other operations, these virus-infected data will also be overwritten to the auxiliary volume, the primary volume change volume and the auxiliary volume change volume at the same time, thereby causing the data in all volumes to be destroyed. In this way, on the one hand, the storage active-active volume can no longer play the role of disaster recovery backup; on the other hand, because the data in all volumes is destroyed, the data recovery time will be correspondingly longer (that is, the RTO will also increase accordingly), and the data recovery difficulty will be higher, and the amount of data loss will also increase accordingly (that is, the RPO will also increase accordingly).
[0038] In view of this, the present disclosure provides a data backup method, which can reduce the difficulty of data recovery and enhance the disaster recovery and backup capabilities of active-active storage volumes while ensuring that RPO and RTO are small. Figure 1 Specifically, in the process of synchronizing the data in the primary volume to the secondary volume, the data backup method disclosed in the present disclosure can be executed simultaneously. Figure 2 , which is a flow chart of a data backup method provided by an embodiment of the present disclosure. Figure 2 In the data backup method, the data backup method includes the following steps:
[0039] Step S201 , obtaining a target logical address allocated for target data to be written into a storage device, and a first physical address in the storage device currently corresponding to the target logical address.
[0040] Specifically, the logical address is also called the virtual address, which is the address used during the running of the application. The physical address is also called the real address or binary address, which is the actual address in the storage device and is used to uniquely identify each storage unit in the storage device. In simple terms, each storage unit in the storage device can have its own corresponding physical address. Writing data to a physical address in the storage device means writing the data to the storage unit corresponding to the physical address.
[0041] There can be a corresponding relationship (also called a mapping relationship) between logical addresses and physical addresses. For example, when the physical addresses are discontinuous, these physical addresses can be mapped to continuous logical addresses, so that the storage space perceived by the application can be a continuous storage space. Of course, discontinuous physical addresses can also be mapped to discontinuous logical addresses. The mapping relationship between logical addresses and physical addresses can be determined according to actual needs.
[0042] Based on the above descriptions about logical addresses and physical addresses, the write instructions for target data issued by the application in the business host may include the target logical address assigned to the target data. Furthermore, based on the correspondence between the logical address and the physical address, the first physical address in the storage device that the target logical address currently corresponds to can be determined.
[0043] It should be noted that for the applications in the service host, these applications can only perceive the logical address, not the physical address. For example, after the application sends a write instruction for the target data, the application perceives that the target data is written to the target logical address (that is, as long as the target data can be accessed through the target logical address later), as for which physical address the target logical address corresponds to, the application may not be aware of it.
[0044] Step S202, canceling the correspondence between the target logical address and the first physical address, and creating a correspondence between the target logical address and a second physical address in the storage device, wherein the first physical address and the second physical address are different.
[0045] Combined with reference Figure 3 , is a schematic diagram of data storage provided by an embodiment of the present disclosure. In this embodiment, before receiving a write instruction for target data issued by an application in a service host, the first physical address currently corresponding to the target logical address may be empty or may have stored other data. For example Figure 3In the example, before receiving the write instruction for the target data, the physical data of file a may have been stored at the first physical address currently corresponding to the target logical address. Since the application in the business host is not aware of the physical address, what it perceives is that the physical data of file a has been stored at the target logical address. Due to business needs and other reasons, the application in the business host can issue a write instruction for the target data to request that the physical data of file a originally stored at the target logical address be changed to the target data. The data backup method disclosed in the present invention is to back up the data before the change at the target logical address (that is, to back up the physical data of file a) before the data is changed, so that when there is a problem with the target data written to the target logical address (such as a virus being implanted), the data at the target logical address can be restored to the data before the change based on the backed up data before the change through operations such as rollback.
[0046] For details, please refer to Figure 3 , the correspondence between the target logical address and the first physical address can be cancelled, and the correspondence between the target logical address and the second physical address can be created. In this way, the data at the first physical address can be kept unchanged, and the data at the first physical address can be used as the backup data at the target logical address, and the target data can be saved at the second physical address. Since the physical address corresponding to the target logical address is changed to the second physical address, the application in the business host accesses the target data through the target logical address. That is, for the application in the business host, it is equivalent to a successful change to the data saved at the target logical address.
[0047] The second physical address may be a physical address that is not corresponding to any other logical address, so as to avoid changing the data stored at other logical addresses when writing the target data at the second physical address.
[0048] Furthermore, since the first physical address is only used to store the backup data of the target logical address after the data at the target logical address is changed, it has no substantial correspondence with the target logical address. However, the first physical address at this time cannot establish a correspondence with other logical addresses. Therefore, after the correspondence between the target logical address and the first physical address is released, the first physical address can be marked to indicate that the first physical address cannot be used to establish a correspondence with other logical addresses. In this way, the problem of loss of the backup data at the target logical address can be prevented.
[0049] Step S203, writing the target data into the second physical address.
[0050] For details, please refer to the relevant description of step S202, which will not be repeated here.
[0051] Step S204: When the target logical address is not found in the backup table, the corresponding relationship between the target logical address and the first physical address is written into the backup table.
[0052] For details, please refer to Figure 3 After the correspondence between the target logical address and the first physical address is written into the backup table, the data originally stored at the target logical address before being changed can be found based on the correspondence in the backup table (for example Figure 3 In this way, when there is a problem with the written target data, the data stored at the target logical address can be quickly rolled back to the data before the change.
[0053] It should be noted that in Figure 3 In the backup table shown, only one correspondence between a target logical address and a first physical address is exemplarily listed, but it can be understood that in actual applications, the backup table may include multiple sets of correspondences between different target logical addresses and first physical addresses.
[0054] In summary, in the technical solutions of some embodiments of the present disclosure, after obtaining the target logical address allocated to the target data and the first physical address corresponding to the target logical address, the physical address corresponding to the target logical address is modified from the first physical address to the second physical address, and the target data is written to the second physical address, and the correspondence between the target logical address and the first physical address is saved in the backup table. In this way, in addition to successfully modifying the data at the target logical address, the data saved at the target logical address can also be quickly rolled back based on the correspondence in the backup table, thereby greatly reducing the difficulty of data recovery.
[0055] In addition, based on the corresponding relationship in the backup table, the data before the change at the target logical address is searched, and this process can be relatively simple. Therefore, in the data recovery process, the RTO can be made smaller. Also, because the scheme disclosed in the present invention saves the complete data before the change at the target logical address through the first physical address, the RPO can be equal to 0. That is, the purpose of reducing the difficulty of data recovery is achieved while ensuring that the RPO and RTO are small.
[0056] In some embodiments, when the target logical address is found in the backup table, the method of the present disclosure may further include:
[0057] It is determined whether the corresponding relationship between the target logical address and the third physical address in the storage device has been saved in the backup table. If so, the operation of writing the corresponding relationship between the target logical address and the first physical address into the backup table is interrupted.
[0058] Specifically, when the correspondence between the target logical address and the third physical address is stored in the backup table, it means that the data stored at the target logical address has been changed multiple times, and the data at the first physical address is not the most original data stored at the target logical address. That is, when performing a rollback operation, the data at the target logical address cannot be rolled back to the data at the first physical address, so it is not necessary to write the correspondence between the target logical address and the first physical address into the backup table.
[0059] For easier understanding, please refer to Figure 4 , is a schematic diagram of data storage provided by another embodiment of the present disclosure. Figure 4 In the example, it is assumed that the target logical address initially corresponds to the third physical address, that is, the original data stored at the target logical address is the entity data of file b. When the application in the service host makes the first change to the data at the target logical address, the entity data of file b can be changed to the entity data of file a. During the first change, the correspondence between the target logical address and the third physical address is released, and the correspondence between the target logical address and the first physical address is created. At the same time, the correspondence between the target logical address and the third physical address is written into the backup table. After the first change, due to business needs and other reasons, the application in the service host may make a second change to the data at the target logical address. During the second change, the correspondence between the target logical address and the first physical address is released, and the correspondence between the target logical address and the second physical address is created. At the same time, since the correspondence between the target logical address and the third physical address has been saved in the backup table, and the data saved at the first physical address is not the original data saved at the target logical address, it is not necessary to write the correspondence between the target logical address and the first physical address into the backup table.
[0060] In the above embodiment, by interrupting the operation of writing the correspondence between the target logical address and the first physical address into the backup table, it is possible to avoid multiple overwriting of the physical address corresponding to the target logical address in the backup table, thereby causing the problem of inaccurate data rollback.
[0061] In some embodiments, when the writing of the correspondence between the target logical address and the first physical address into the backup table is interrupted, the method of the present disclosure may further include:
[0062] The first physical address is reclaimed, wherein the reclaimed first physical address is allowed to be used to establish a corresponding relationship with other logical addresses except the target logical address.
[0063] For details, please refer to Figure 5 , for Figure 4Schematic diagram of the correspondence between the target logical address and the physical address obtained after the update. Figure 4 It can be seen from the relevant description that after the corresponding relationship between the target logical address and the second physical address is created, and the corresponding relationship between the target logical address and the first physical address is cancelled, at this time, what is saved in the backup table is the corresponding relationship between the target logical address and the third physical address. The target logical address actually corresponds to the second physical address, that is, the first physical address is equivalent to having no relationship with the target logical address. In this case, the first physical address can be recycled, and the first physical address can be used to establish a corresponding relationship with other logical addresses.
[0064] In the above embodiment, by timely reclaiming the first physical address, the storage space waste of the storage device can be reduced.
[0065] In some embodiments, there may be multiple backup tables, each backup table has its own corresponding preset time point, and the backup table can be used to record the correspondence between each target logical address and the first physical address obtained from the corresponding preset time point.
[0066] For details, please refer to Figure 6 , is a schematic diagram of multiple preset time points provided by an embodiment of the present disclosure. The multiple preset time points may exemplarily include the same target time point on the current day and N consecutive days before the current day, as well as the target time point on the mth day of each week, the target time point on the nth day of each month, etc. In this embodiment, the target time point is 00:00. Among them, the value of k is an integer less than or equal to N-1, and the value of N is an integer greater than 0. The values of m and n are integers greater than 0.
[0067] for example Figure 6 In the example, the preset time points may include 00:00 of the current day, 00:00 of the first day before the current day, 00:00 of the second day before the current day, 00:00 of this Monday, and 00:00 of the first day of this month. Backup Table 1 is used to record the correspondence between each target logical address obtained from 00:00 of the current day and the first physical address; Backup Table 2 is used to record the correspondence between each target logical address obtained from 0:00 of the first day before the current day and the first physical address, and so on. By way of example, it can be seen that the data in different backup tables may partially overlap. For example, both Backup Table 1 and Backup Table 2 include the correspondence between each target logical address obtained from 0:00 of the current day and the first physical address, but Backup Table 2 also includes the correspondence between each target logical address obtained between 0:00 of the first day before the current day and 0:00 of the current day and the first physical address.
[0068] By setting multiple backup tables, you can select the appropriate backup table to roll back the data at the target logical address according to actual needs, which can improve the accuracy of data rollback and minimize the amount of data rollback. For example, when it is found that data carrying a virus was written to the storage device on the second day before the current day, the data can be rolled back based on backup table 3 corresponding to 0:00 on the second day before the current day; when it is found that data carrying a virus was written to the storage device on the current day, the data can be rolled back based on backup table 1 corresponding to 0:00 on the current day.
[0069] Based on the above description, the above-mentioned writing the correspondence between the target logical address and the first physical address into the backup table may include:
[0070] In the case that the current time point is after each preset time point, the correspondence between the target logical address and the first physical address acquired at the current time point is written into the backup table corresponding to each preset time point respectively.
[0071] for example Figure 6 In the embodiment, the correspondence between the target logical address determined at the current time point and the first physical address is written into the backup tables 1 to 6 respectively.
[0072] In this way, the accuracy and completeness of the data in each backup table can be guaranteed.
[0073] In some embodiments, considering that writing data to multiple different backup tables each time will affect the speed of writing data, therefore, writing the correspondence between the target logical address determined at the current time point and the first physical address into the backup tables corresponding to each preset time point may include:
[0074] Writing the correspondence between the target logical address and the first physical address into the target backup table corresponding to the preset time point closest to the current time point;
[0075] At preset intervals, the corresponding relationships newly written into the target backup table are synchronized to other backup tables except the target backup table.
[0076] for example Figure 6 In the example, backup table 1 is the target backup table corresponding to the preset time point closest to the current time point. After determining the correspondence between the target logical address and the first physical address at the current time point, only the correspondence can be written into backup table 1. Then, every preset time period, backup table 1 is fully compared with each other backup table, and the correspondence that exists in backup table 1 but does not exist in other backup tables is written into other backup tables. In this way, data synchronization between backup table 1 and other backup tables is achieved.
[0077] Specifically, when synchronizing the data in the target backup table to other backup tables, it can be an operation performed regularly in the background, so that the impact on the business can be reduced.
[0078] In some embodiments, when reaching the target time point of the first day after the current day, the method of the present disclosure may further include:
[0079] The first day after the current day is taken as the new current day, and a new blank backup table is created as the backup table corresponding to the target time point of the new current day;
[0080] Copy the backup table corresponding to the target time point in the current day as the backup table corresponding to the target time point in the first day before the new current day, and copy the backup table corresponding to the target time point in the kth day before the current day as the backup table corresponding to the target time point in the k+1th day before the new current day.
[0081] For ease of understanding, assume that k is 1 and the target time is 00:00. Figure 7 , which is a schematic diagram of various backup tables corresponding to the current day and the new current day provided by an embodiment of the present disclosure. Figure 7 In the example, assuming that September 16 is the current day, then September 17 is the first day after the current day, i.e., the new current day. For September 16, the backup table corresponding to 00:00 on September 16 is backup table 1 corresponding to 00:00 on the current day, the backup table corresponding to 00:00 on September 15 is backup table 2 corresponding to 00:00 on the first day before the current day, and the backup table corresponding to 00:00 on September 14 is backup table 3 corresponding to 00:00 on the second day before the current day. However, for September 17, the backup table corresponding to 00:00 on September 16 should be backup table 2 corresponding to 00:00 on the first day before the new current day, and the backup table corresponding to 00:00 on September 15 should be backup table 3 corresponding to 00:00 on the second day before the new current day. At the same time, there is no backup table corresponding to 00:00 on the new current day, so a new blank backup table needs to be created as the backup table corresponding to 00:00 on the new current day.
[0082] In the above embodiment, the generation speed of the backup table can be greatly improved by copying the backup table. The copied backup table already includes the correspondence between the target logical address and the first physical address recorded before the target time point of the new day. In this way, the amount of data processing can be greatly reduced.
[0083] Furthermore, when the target time point of the new day is reached, the method of the present disclosure may further include:
[0084] Delete the backup table corresponding to the target time N days before the current day.
[0085] Continue reading Figure 7 . Assume N is 2. Then Figure 7 In the example, the backup table corresponding to the target time in the Nth day before the current day is the backup table 3 corresponding to 00:00 on September 14. In simple terms, for the new current day, September 17, 00:00 on September 14 is no longer the preset time point, so the backup table 3 corresponding to 00:00 on September 14 can be deleted.
[0086] By deleting obsolete backup tables in a timely manner, the amount of data storage can be reduced.
[0087] In some embodiments, when the target time point of the new day is reached, the method of the present disclosure may further include:
[0088] When the preset time point includes the target time point on the mth day of each week, if the current day is the mth day of the current week, the backup table corresponding to the target time point on the current day is copied as the backup table corresponding to the target time point on the mth day of the current week.
[0089] For example, suppose m and n are 1. Figure 8 , which is a schematic diagram of various backup tables corresponding to the current day and the new current day provided by another embodiment of the present disclosure. Figure 8 In the example, it is assumed that September 16 is the current day, September 17 is the new current day, and the current day is the first day of the current week. Then, when copying the backup table, the backup table 1 corresponding to 00:00 on September 14 can be copied as the backup table 4 corresponding to 00:00 on the first day of the current week. In this way, based on the backup table 4, the corresponding relationship between the target logical address and the first physical address obtained from 00:00 on the first day of the current week can continue to be recorded.
[0090] Similarly, when the preset time point includes the target time point on the nth day of each month, if the current day is the nth day of the current month, the backup table corresponding to the target time point on the current day is copied as the backup table corresponding to the target time point on the nth day of the current month.
[0091] In this way, the amount of data processing can be greatly reduced by copying the backup table.
[0092] Corresponding to the data backup method, the present disclosure also provides a data recovery method. The data recovery method can be applied to Figure 1 The auxiliary volume, primary volume, primary volume change volume, and auxiliary volume change volume in the Fig. 9 , which is a flow chart of a data recovery method provided by an embodiment of the present disclosure. Fig. 9 In the data recovery method, the data recovery method includes the following steps:
[0093] Step S901, in response to receiving a data recovery instruction for a storage device, obtaining a backup table of the storage device, where the backup table is obtained based on the above data backup method.
[0094] Step S902: Look up the correspondence between the target logical address and the first physical address in the storage device from the backup table.
[0095] Step S903: determine a second physical address in the storage device currently corresponding to the target logical address.
[0096] Step S904: Use the data at the first physical address to overwrite the data at the second physical address.
[0097] Specifically, the above steps S901 to S904 may be Figure 2 This is the reverse process of step S201 to step S204 in the embodiment, and the related principles are not described in detail here.
[0098] In the technical solutions of some embodiments of the present disclosure, after obtaining the target logical address assigned to the target data and the first physical address corresponding to the target logical address, the physical address corresponding to the target logical address is modified from the first physical address to the second physical address, and the target data is written to the second physical address, and the correspondence between the target logical address and the first physical address is saved in the backup table. In this way, in addition to successfully modifying the data at the target logical address, when a storage device fails (for example, when the data in the storage device is implanted with a virus), based on the correspondence between the target logical address and the first physical address in the backup table, the original data stored at the target logical address can be found in time, and then the data at the target logical address can be rolled back and restored based on the original data, greatly reducing the difficulty of data recovery.
[0099] In some embodiments, as described in the backup method, there are multiple backup tables, each backup table has a corresponding preset time point, and the backup table is used to record the corresponding relationship between each target logical address and the first physical address obtained from the corresponding preset time point. The above-mentioned acquisition of the backup table of the storage device may also include:
[0100] Extracting a first preset time point to which data in the storage device is to be restored from the data recovery instruction;
[0101] The first backup table corresponding to the first preset time point is used as the acquired backup table.
[0102] Specifically, in some embodiments, the data recovery instruction may include the time point when the storage device fails (such as the time point when it is infected by a virus), and based on the time point, the first preset time point to which the data in the storage device is to be restored can be determined. For example, assuming that the preset time points include 00:00 on the current day, 00:00 on the first day before the current day, 00:00 on the second day before the current day, 00:00 on the first day of the current week, and 00:00 on the first day of the current month, and the time point when the storage device fails is 12:30 on the second day before the current day, then it can be determined that the first preset time point to which the data in the storage device is to be restored is 00:00 on the second day before the current day, so that the first backup table corresponding to 00:00 on the second day before the current day can be used as the acquired backup table, and based on the first backup table corresponding to 00:00 on the second day before the current day, the data in the storage device is restored to 00:00 on the second day before the current day. In this way, data loss and other problems caused by the implantation of ransomware viruses in data are effectively avoided.
[0103] In other embodiments, the first preset time point in the data recovery instruction may be manually specified. For example, the maintenance personnel of the storage device inputs the first preset time point through the parameter configuration interface according to actual needs. In this case, the first preset time point may be the same as the preset time point corresponding to a specific backup table. For example, the maintenance personnel determines that the data in the storage device needs to be restored to 00:00 on the first day of the current week according to actual needs. Then, the date of the first day of the current week can be input through the configuration interface, and the time point is specified as 00:00. In this way, the data in the storage device can be rolled back and restored based on the first backup table corresponding to 00:00 on the first day of the current week.
[0104] In the above embodiment, the maintenance personnel can specify the first preset time point to which the data in the storage device is to be restored through the data recovery instruction according to actual needs, and the adaptability of the solution is better.
[0105] Further, based on the relevant description of the above data backup method, it can be known that in some embodiments, the correspondence between the target logical address and the first physical address is written into the target backup table corresponding to the preset time point closest to the current time point, and the data newly written into the target backup table is synchronized to other backup tables other than the target backup table at preset intervals. Since the data in the target backup table is synchronized to other backup tables on a regular basis (non-real time), some of the data in the target backup table may not be fully synchronized to other backup tables. The problem caused by this is that when performing data rollback or recovery operations based on other backup tables other than the target backup table, the data in these other backup tables may not be complete data, and then when the data is rolled back, some of the data that has not been synchronized between the backup tables will be omitted. In this way, the accuracy of data rollback will be reduced.
[0106] In view of this, in some embodiments, if there is a second preset time point after the first preset time point, the method of the present disclosure may further include:
[0107] Obtaining a second backup table corresponding to a second preset time point;
[0108] The first backup table and the second backup table are merged, and the merged backup table is used as the acquired backup table.
[0109] Specifically, if there is a second preset time point after the first preset time point, it means that the first backup table corresponding to the first preset time point is not the target backup table corresponding to the preset time point closest to the current time point, so there is a risk of incomplete data in the first backup table. In view of this, the second backup table corresponding to the second preset time point can be merged with the first backup table corresponding to the first preset time point, and data rollback is performed based on the merged backup table.
[0110] In this way, the accuracy of data rollback can be guaranteed.
[0111] Furthermore, considering that the target backup table corresponding to the preset time point closest to the current time point synchronizes data to each other backup table respectively, therefore, in the case where there are multiple second preset time points after the first preset time point, the first backup table corresponding to the first preset time point actually has data differences with the above-mentioned target backup table that are not synchronized (that is, this problem does not exist with other backup tables). Therefore, only the target backup table corresponding to the preset time point closest to the current time point can be used as the second backup table, and the first backup table and the second backup table can be merged. In this way, the amount of data processing caused by data merging can be greatly reduced.
[0112] For example, assuming that the first preset time point is 00:00 of the second day before the current day, there are two second preset time points after the first preset time point, namely 00:00 of the first day before the current day and 00:00 of the current day. In this case, the second backup table corresponding to 00:00 of the first day before the current day can be ignored, and the second backup table corresponding to 00:00 of the current day is merged with the first backup table corresponding to 00:00 of the second day before the current day, and the data in the storage device is rolled back based on the merged backup table.
[0113] Specifically, the second backup table and the first backup table may be merged as follows: traverse each target logical address in the first backup table. For any target logical address obtained through the traversal, it is possible to check whether the target logical address exists in the second backup table. If the target logical address is included in the second backup table, it is skipped and not processed; if the target logical address is not included in the second backup table, the corresponding relationship between the target logical address in the first backup table and the first physical address may be copied to the first backup table. In this way, the first backup table and the second backup table are merged.
[0114] In some embodiments, Figure 1 The storage device includes a primary volume and a secondary volume that can be used to store data, and the backup table can be generated when writing data to the secondary volume. The above-mentioned using the data at the first physical address to overwrite the data at the second physical address can include:
[0115] Using the data at the first physical address of the auxiliary volume to overwrite the data at the second physical address of the auxiliary volume;
[0116] determining a fourth physical address in the primary volume corresponding to the second physical address;
[0117] The data at the first physical address of the secondary volume is used to overwrite the data at the fourth physical address of the primary volume.
[0118] In this way, data rollback and recovery of different volumes in the storage active-active volume can be completed. Specifically, for the storage active-active volume, the specific operation of rollback can be as follows:
[0119] 1) Change the active-active relationship in the storage active-active volume to an idle state, that is, both the primary volume and the secondary volume can receive data;
[0120] 2) Traverse all target logical addresses in the backup table and update the data at the first physical address corresponding to the target logical address to the active-active volume;
[0121] 3) Restart the active-active relationship and synchronize the auxiliary volume data to the primary volume;
[0122] 4) Start the business with the restored data.
[0123] In the technical solution disclosed in the present invention, most data operations can be performed regularly in the background, such as replication between backup tables, data synchronization between backup tables, etc. In this way, the impact on the business can be reduced.
[0124] This completes the description of the method disclosed herein.
[0125] Combined with reference Fig.10 , is a schematic diagram of an electronic device provided by an embodiment of the present disclosure. The electronic device includes a processor and a memory, wherein the memory is used to store a computer program, and when the computer program is executed by the processor, the above method is implemented.
[0126] The processor may be a central processing unit (CPU). The processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or a combination of the above chips.
[0127] As a non-transitory computer-readable storage medium, the memory can be used to store non-transitory software programs, non-transitory computer executable programs and modules, such as program instructions / modules corresponding to the method in the embodiment of the present disclosure. The processor executes various functional applications and data processing of the processor by running the non-transitory software programs, instructions and modules stored in the memory, that is, implementing the method in the above method embodiment.
[0128] The memory may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created by the processor, etc. In addition, the memory may include a high-speed random access memory, and may also include a non-transitory memory, such as at least one disk storage device, a flash memory device, or other non-transitory solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0129] An embodiment of the present disclosure further provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store a computer program, and when the computer program is executed by a processor, the above method is implemented.
[0130] Although the implementation method of the present disclosure has been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present disclosure, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A data backup method, characterized in that: The method comprises: Acquire a target logical address allocated for target data to be written into a storage device, and a first physical address in the storage device currently corresponding to the target logical address; Removing the correspondence between the target logical address and the first physical address, and creating a correspondence between the target logical address and a second physical address in the storage device, wherein the first physical address and the second physical address are different; Writing the target data into the second physical address; If the target logical address is not found in the backup table, writing the corresponding relationship between the target logical address and the first physical address into the backup table; There are multiple backup tables, each of which has a corresponding preset time point, and the backup table is used to record the corresponding relationship between each target logical address and the first physical address obtained from the corresponding preset time point; The step of writing the correspondence between the target logical address and the first physical address into the backup table includes: In the case where the current time point is after each of the preset time points, the correspondence between the target logical address and the first physical address acquired at the current time point is written into the backup table corresponding to each of the preset time points respectively.
2. The method according to claim 1, characterized in that In the case where the target logical address is found in the backup table, the method further includes: Determine whether the corresponding relationship between the target logical address and the third physical address in the storage device is saved in the backup table, and if so, interrupt the operation of writing the corresponding relationship between the target logical address and the first physical address into the backup table.
3. The method according to claim 2, characterized in that In the case where the writing of the correspondence between the target logical address and the first physical address into the backup table is interrupted, the method further includes: The first physical address is reclaimed, wherein the reclaimed first physical address is allowed to be used to establish a corresponding relationship with other logical addresses except the target logical address.
4. The method according to claim 1, characterized in that The step of writing the correspondence between the target logical address and the first physical address acquired at the current time point into the backup table corresponding to each preset time point includes: Writing the correspondence between the target logical address and the first physical address into the target backup table corresponding to the preset time point closest to the current time point; At preset time intervals, the corresponding relationship newly written into the target backup table is synchronized to other backup tables except the target backup table.
5. The method according to claim 1, characterized in that The preset time point includes the same target time point in the current day and N consecutive days before the current day; When reaching the target time point of the first day after the current day, the method further comprises: Taking the first day after the current day as the new current day, creating a new blank backup table as the backup table corresponding to the target time point in the new current day; Copy the backup table corresponding to the target time point in the current day as the backup table corresponding to the target time point in the first day before the new current day, and copy the backup table corresponding to the target time point in the kth day before the current day as the backup table corresponding to the target time point in the k+1th day before the new current day; The value of k is an integer less than or equal to N-1, and the value of N is an integer greater than 0.
6. The method according to claim 5, characterized in that When the target time point of the new day is reached, the method further includes: Delete the backup table corresponding to the target time point N days before the current day.
7. The method according to claim 5, characterized in that The preset time point also includes the target time point on the mth day of each week, and / or the target time point on the nth day of each month; When the target time point of the new day is reached, the method includes: When the preset time point includes the target time point on the mth day of each week, if the current day is the mth day of the current week, the backup table corresponding to the target time point on the current day is copied as the backup table corresponding to the target time point on the mth day of the current week; When the preset time point includes the target time point on the nth day of each month, if the current day is the nth day of the current month, copy the backup table corresponding to the target time point on the current day as the backup table corresponding to the target time point on the nth day of the current month; The values of m and n are integers greater than 0.
8. A data recovery method, characterized in that: The method comprises: In response to receiving a data recovery instruction for a storage device, obtaining a backup table of the storage device, wherein the backup table is obtained based on the data backup method according to any one of claims 1 to 7; Searching the backup table for a correspondence between a target logical address and a first physical address in the storage device; Determine a second physical address in the storage device currently corresponding to the target logical address; The data at the second physical address is overwritten with the data at the first physical address.
9. The method according to claim 8, characterized in that There are multiple backup tables, each of which has a corresponding preset time point, and the backup table is used to record the corresponding relationship between each target logical address and the first physical address obtained from the corresponding preset time point; The obtaining the backup table of the storage device includes: Extracting a first preset time point to which the data in the storage device is to be restored from the data recovery instruction; The first backup table corresponding to the first preset time point is used as the acquired backup table.
10. The method according to claim 9, characterized in that If there is a second preset time point after the first preset time point, the method further includes: Acquire a second backup table corresponding to the second preset time point; The first backup table and the second backup table are merged, and the merged backup table is used as the acquired backup table.
11. The method according to claim 8, characterized in that The storage device includes a primary volume and a secondary volume for storing data, and the backup table is generated when writing data to the secondary volume; The using the data at the first physical address to overwrite the data at the second physical address comprises: Using the data at the first physical address of the auxiliary volume to overwrite the data at the second physical address of the auxiliary volume; determining a fourth physical address in the primary volume corresponding to the second physical address; The data at the fourth physical address of the primary volume is overwritten with the data at the first physical address of the secondary volume.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store a computer program, and when the computer program is executed by a processor, it implements the method according to any one of claims 1 to 7, or implements the method according to any one of claims 8 to 11.
13. An electronic device, characterized in that: The electronic device includes a processor and a memory, the memory is used to store a computer program, and when the computer program is executed by the processor, it implements the method according to any one of claims 1 to 7, or implements the method according to any one of claims 8 to 11.
14. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented, or the method according to any one of claims 8 to 11 is implemented.
Citation Information
Patent Citations
Data processing method and apparatus
CN103761190A
