Storage equipment data protection method and device, electronic equipment and storage medium

By independently copying multiple replica LUNs in the storage device and using the differential bitmap and replica flow number management mechanism, the shortcomings of data protection in the prior art when hard disasters and soft disasters occur simultaneously, achieving efficient and reliable data replication and recovery.

CN119883739AActive Publication Date: 2025-04-25MACROSAN TECH
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411976560.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-30
Publication Date
2025-04-25
Estimated Expiration
2044-12-30

AI Technical Summary

Technical Problem

Existing data protection methods cannot effectively protect data when hard disasters and soft disasters occur simultaneously, especially when data is copied between multiple replica LUNs, which can easily lead to data being unrecoverable.

Method used

By realizing independent replication of multiple replica LUNs in storage devices, using the differential bitmap and replica flow number management mechanism, we ensure that each replica LUN replica replication in different historical time planes, avoiding data loss caused by hard disasters and snapshot failures.

Benefits of technology

The ability to efficiently copy data between multiple replica LUNs is achieved, ensuring that data can still be recovered in the event of hard disasters and soft disasters, improving the reliability and efficiency of data protection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119883739A_ABST
    Figure CN119883739A_ABST
Patent Text Reader

Abstract

The invention provides a storage equipment data protection method and device, electronic equipment and a storage medium. Through the mode provided by the invention, the data of the source LUN in different historical time planes can be copied by using a plurality of copy LUNs, namely, the method provided by the invention supports one-to-many copying, and an effective data protection scheme can be provided for various scenes. Moreover, due to the fact that the mode that the difference bitmap of the source LUN and the difference bitmaps stored in the associated LUN of the target LUN are combined and the incremental data in the source LUN are synchronized to the target LUN based on the combined difference bitmap is adopted, data are copied between the source LUN and the target LUN according to an incremental mode, and the copying efficiency can be improved to the maximum extent. Moreover, because copying is completed by the storage device, backup software of the server is not needed, the process that the backup software reads the data from the storage device and writes the data in is omitted, and the backup efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] With the advent of the big data era, the amount of data is increasing and becoming more and more important. Therefore, data protection is becoming more and more important.

[0003] Replication is one of the important means to maintain data persistence protection, and it is also a common solution for dealing with "hard disasters". Hard disasters, as the name suggests, refer to "hard" disasters, usually referring to physical damage or unreadable production data due to factors such as RAID failure, earthquake, and fire. At present, the usual replication method is to store production data in the logical unit number (Logical Unit Number, LUN) of the storage device. The LUN is used as the production data volume (also called the source LUN). The storage device creates a replica data volume (also known as the replica LUN) for the production data volume to store data copies. The source LUN and the replica LUN constitute a replication pair, and data is copied from the source LUN to the replica LUN according to the policy. The two LUNs in the replication pair are usually located in two different storage devices. Since the replica LUN and the source LUN are physically independent, when a hard disaster occurs to the source LUN, the replica LUN can be used for data recovery.

[0004] Snapshots are a common solution for dealing with "soft disasters". As the name implies, soft disasters refer to "soft" disasters, usually referring to logical damage to data in a production data volume (also known as a source LUN) due to program bugs, viruses, misoperation, and other factors. Through snapshot technology, multiple snapshots can be created for the source LUN. Each snapshot corresponds to the data of the source LUN at a certain moment. When a soft disaster occurs to the source LUN, the snapshot can be used to retrieve the data of the source LUN at a certain historical moment before logical damage occurs. In the snapshot implementation scheme, an incremental snapshot method is usually adopted. That is, when there are multiple snapshots on a source LUN, each snapshot only records the changes within a part of the time period. When it is necessary to retrieve data at a certain historical moment through a snapshot, it is necessary to first obtain the data of all snapshots at and after the historical moment and the data of the source LUN. That is, there is a dependency between multiple snapshots, and multiple snapshots are dependent on the source LUN.

[0005] In response to the threat of hard disasters and soft disasters occurring at the same time, the commonly used data protection method is to enable snapshots for the source LUN and the replica LUN of the replication pair, create snapshots on the source LUN and the replica LUN, and record the data of the source LUN and the replica LUN at multiple historical moments. However, when a hard disaster and a soft disaster occur on the source LUN, the soft disaster may have been transmitted to the replica LUN. If some extreme abnormalities occur on the replica LUN, such as snapshot failure or a hard disaster on the replica LUN, the data cannot be recovered.

[0006] In addition, this data protection method is not applicable in a data protection scenario. For example, the data protection scenario requires creating 30 replica data volumes for the production data volume, and these 30 replica data volumes respectively copy the data of the production data volume in 30 historical time planes. In this scenario, the above data protection method is not applicable and this requirement cannot be achieved through storage devices. Summary of the invention

[0007] In view of this, embodiments of the present application provide a storage device data protection method, apparatus, electronic device, and storage medium, so as to enable multiple replica LUNs to respectively copy the data of the source LUN at different historical time planes.

[0008] The present application provides a storage device data protection method, which is applied to a storage device, wherein the storage device includes a source logical unit number LUN to be copied; the method includes:

[0009] When it is determined to start a replication of data in the source LUN, a replica LUN whose available status is the primary status is obtained from the current replica LUN list corresponding to the source LUN as the target LUN to which the data is replicated this time; if the available status of any replica LUN in the current replica LUN list is the primary status, it indicates that data replication is currently allowed for the replica LUN; if the available status of any replica LUN is the standby status, it indicates that data replication is currently not allowed for the replica LUN;

[0010] Obtain the copy serial number of the target LUN from the current copy LUN list; if the copy serial number of any copy LUN in the current copy LUN list is the first value, it indicates that the copy LUN has not been replicated; if the copy serial number of any copy LUN is not the first value, it is used to indicate the order of the replication that the copy LUN has executed the most recent replication from the current time point in the replication that all copy LUNs have executed;

[0011] If the copy serial number of the target LUN is the first value, the difference bitmap of the source LUN is sent to the target LUN, so that the target LUN saves the received difference bitmap and copies all the data of the source LUN to the target LUN; the difference bitmap of the source LUN is used to record the latest data increment of the source LUN;

[0012] If the replica serial number of the target LUN is not the first value, the difference bitmap of the source LUN is sent to the target LUN, so that the target LUN updates the saved difference bitmap based on the received difference bitmap, and when there are at least two replica LUNs in the current replica LUN list, the difference bitmap of the source LUN and the difference bitmaps saved by the associated LUNs of the target LUN are merged, and the incremental data in the source LUN is synchronized to the target LUN based on the merged difference bitmap; the associated LUNs of the target LUN refer to each replica LUN in the current replica LUN list whose replica serial number is not the first value except the target LUN;

[0013] Change the available status of the target LUN in the current copy LUN list to the standby status, change the copy serial number of the target LUN to M+K, where M is the maximum copy serial number in the current copy LUN list, and K is greater than or equal to 1; and change the available status of the next copy LUN of the target LUN in the current copy LUN list to the primary status.

[0014] The embodiment of the present application also provides a storage device data protection device, which is applied to a storage device, wherein the storage device includes a source logical unit number LUN to be copied; the device includes:

[0015] The first obtaining module is used to obtain a copy LUN whose available state is the primary state from the current copy LUN list corresponding to the source LUN as the target LUN to which the data is copied this time when it is determined to start a copy of the data in the source LUN; if the available state of any copy LUN in the current copy LUN list is the primary state, it indicates that the copy LUN is currently allowed to copy data, and if the available state of any copy LUN is the standby state, it indicates that the copy LUN is currently not allowed to copy data;

[0016] The second obtaining module is used to obtain the copy serial number of the target LUN from the current copy LUN list; if the copy serial number of any copy LUN in the current copy LUN list is the first value, it indicates that the copy LUN has not been copied, and if the copy serial number of any copy LUN is not the first value, it is used to indicate the order of the most recent copy executed by the copy LUN from the current time point in the copy that has been executed by all the copy LUNs;

[0017] The replication module is used to send the difference bitmap of the source LUN to the target LUN if the copy serial number of the target LUN is the first value, so that the target LUN saves the received difference bitmap and fully replicates the data of the source LUN to the target LUN; the difference bitmap of the source LUN is used to record the latest data increment of the source LUN;

[0018] If the replica serial number of the target LUN is not the first value, the difference bitmap of the source LUN is sent to the target LUN, so that the target LUN updates the saved difference bitmap based on the received difference bitmap, and when there are at least two replica LUNs in the current replica LUN list, the difference bitmap of the source LUN and the difference bitmaps saved by the associated LUNs of the target LUN are merged, and the incremental data in the source LUN is synchronized to the target LUN based on the merged difference bitmap; the associated LUNs of the target LUN refer to each replica LUN in the current replica LUN list whose replica serial number is not the first value except the target LUN;

[0019] The status modification module is used to change the available status of the target LUN in the current copy LUN list to the standby status, change the copy serial number of the target LUN to M+K, where M is the maximum copy serial number in the current copy LUN list, and K is greater than or equal to 1; and change the available status of the next copy LUN of the target LUN in the current copy LUN list to the primary status 0.

[0020] An embodiment of the present application also provides an electronic device, including: a processor and a memory for storing computer program instructions, and when the computer program instructions are executed by the processor, the processor executes the steps of the above method.

[0021] An embodiment of the present application also provides a machine-readable storage medium, which stores computer program instructions. When the computer program instructions are executed, the steps of the above method can be implemented.

[0022] It can be seen from the above technical solution that in the embodiment of the present application, when it is determined to start a copy of the data in the source LUN, a copy LUN with an available state of the master state is obtained from the current copy LUN list corresponding to the source LUN as the target LUN to which the data is copied this time, and the copy serial number of the target LUN is obtained from the current copy LUN list. Afterwards, if the copy serial number of the target LUN is the first value, the difference bitmap of the source LUN is sent to the target LUN, so that the target LUN saves the received difference bitmap and copies the data of the source LUN to the target LUN in full; if the copy serial number of the target LUN is not the first value, the difference bitmap of the source LUN is sent to the target LUN, so that the target LUN updates the saved difference bitmap based on the received difference bitmap, and when there are at least two copy LUNs in the current copy LUN list, the difference bitmap of the source LUN and the difference bitmap saved by the associated LUN of the target LUN are merged, and the incremental data in the source LUN is synchronized to the target LUN based on the merged difference bitmap. Finally, the available state of the target LUN in the current copy LUN list is changed to the standby state, and the copy serial number of the target LUN is changed to M+K; and the available state of the next copy LUN or the first copy LUN of the target LUN in the current copy LUN list is changed to the primary state.

[0023] In an embodiment of the present application, a source LUN can be configured with multiple replica LUNs, and the multiple replica LUNs can be located in one storage device or in multiple storage devices, and the multiple replica LUNs are physically completely independent. During the replication process, multiple replica LUNs are used in sequence to save the data of the source LUN in multiple historical time planes, which can avoid the situation where the replica LUN has a hard disaster and the data cannot be recovered. It can also avoid the situation where the snapshot on the replica LUN fails and multiple snapshots are unavailable, which in turn makes it impossible to restore the source LUN to the data of a historical moment when logical damage has not occurred. In this way, when there are multiple replica LUNs in the current replica LUN list, these multiple replica LUNs can be used in the above manner to copy the data of the source LUN in different historical time planes respectively, that is, the method provided by the present application supports one-to-many replication and can provide effective data protection solutions for a variety of scenarios.

[0024] Furthermore, when the copy serial number of the target LUN is not the first value, the difference bitmap of the source LUN and the difference bitmap saved by the associated LUN of the target LUN are merged, and the incremental data in the source LUN is synchronized to the target LUN based on the merged difference bitmap. At this time, data is copied between the source LUN and the target LUN in an incremental manner, which can maximize the copying efficiency.

[0025] Furthermore, since the above-mentioned replication is completed by the storage device, there is no need to rely on the backup software of the server, which saves the process of the backup software reading data from the storage device and writing data, thereby improving the backup efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] Figure 1 A schematic diagram of a storage device data protection method provided in an embodiment of the present application;

[0027] Figure 2 A schematic diagram of a process for removing a replica LUN provided in an embodiment of the present application;

[0028] Figure 3 A schematic diagram of the process of adding a replica LUN provided in an embodiment of the present application;

[0029] Figure 4 A schematic diagram of the structure of the device provided in the embodiment of the present application;

[0030] Figure 5 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0031] In order to enable those skilled in the art to better understand the technical solutions provided by the embodiments of the present application and to make the above-mentioned purposes, features and advantages of the embodiments of the present application more obvious and understandable, the technical solutions in the embodiments of the present application are further described in detail below in conjunction with the accompanying drawings.

[0032] See also Figure 1 , Figure 1 A flow chart of a storage device data protection method provided in an embodiment of the present application. The method is applied to a storage device, which includes a source LUN to be copied. The copy LUN is a LUN used to store data copied from the source LUN. It should be noted that the source LUN and the copy LUN can be located in the same storage device or in different storage devices, which is not specifically limited in the embodiment of the present application.

[0033] like Figure 1 As shown, the process may include the following steps:

[0034] S101, when it is determined to start a replication of data in a source LUN, a replica LUN whose available state is the master state is obtained from a current replica LUN list corresponding to the source LUN as a target LUN to which the data is replicated this time.

[0035] In this embodiment, the replication of data in the source LUN is triggered at intervals of a set time period, that is, the replication of data in the source LUN is triggered periodically. For example, the replication of the source LUN is triggered once at 22:00:00 every day, that is, the replication of the source LUN is triggered once every 24 hours.

[0036] S102: Obtain the copy serial number of the target LUN from the current copy LUN list.

[0037] In this embodiment, the current copy LUN list records the information of each copy LUN. As an embodiment, as shown in Table 1 below, the current copy LUN list records the IP address of the storage device to which each copy LUN belongs, the name of the copy LUN, the available status, and the copy serial number.

[0038] In this embodiment, the initial setting value of the replica serial number of any replica LUN is a first value, such as 0. When the replica serial number of the replica is the initial setting value, it indicates that the replica LUN has not been replicated. When the replica serial number of the replica LUN is not the initial setting value, it indicates that the replica LUN has been replicated. At this time, the replica serial number is used to indicate the order of the replication tasks that have been executed, that is, the replica serial number is used to indicate the order of the most recent replication executed by the replica LUN from the current time point in the replication that has been executed by all replica LUNs.

[0039] Table 1

[0040] IP address of the device to which the replica LUN belongs Replica LUN name Available status Copy serial number 127.0.0.1 LUNA1 Active state 0 127.0.0.1 LUNA2 Alternate state 0 127.0.0.1 LUNA3 Alternate state 0

[0041] For example, the initial setting value of the replica serial number of each replica LUN is 0. After that, each time the replication is triggered, the serial number starts from 1, and the order of the executed replication tasks is represented by decimal numbers. For example, replica LUNA1, replica LUNA2, replica LUNA3, ..., replica LUNA30 are selected as target replica LUNs for replication in order from front to back, then the replica serial numbers of replica LUNA1, replica LUNA2, replica LUNA3, ..., replica LUNA30 are changed from 0 to 1, 2, 3, ..., 30, and so on.

[0042] S103: If the copy serial number of the target LUN is the first value, the difference bitmap of the source LUN is sent to the target LUN, so that the target LUN saves the received difference bitmap and fully copies the data of the source LUN to the target LUN.

[0043] In this embodiment, the difference bitmap of the source LUN is the latest difference bitmap on the source LUN, which is used to record the latest data increment of the source LUN. For the source LUN, when it is replicated for the first time, the source LUN has not recorded the difference bitmap, and the source LUN notifies the target LUN to modify the status of the difference bitmap saved on the target LUN to invalid. Starting from the second replication, the difference bitmap of the source LUN records the data changes on the source LUN during the period from the time point Tn that triggered the current replication to the time point Tn-1 that triggered the previous replication of the current replication.

[0044] In conventional technical solutions, when a source LUN starts a new replication, the source LUN first initializes a difference bitmap so that the difference bitmap re-records the changes on the source LUN to achieve the purpose of recording the data changes on the source LUN between two adjacent replications, which will not be elaborated in the present invention.

[0045] For example, if replication is triggered once a day at 22:00:00, the difference bitmap of the source LUN at 22:00:00 today records the data changes on the source LUN within 24 hours from 22:00:00 yesterday to 22:00:00 today.

[0046] In this embodiment, since the copy serial number of the target LUN is the first value, it has not been copied. Therefore, after the source LUN sends the difference bitmap to the target LUN, the target LUN receives the difference bitmap for the first time. At this time, the target LUN only needs to save the difference bitmap.

[0047] It should be noted that the local difference bitmap of the replica LUN is synchronized from the source LUN and is not used to record data changes of the replica LUN.

[0048] S104, if the copy serial number of the target LUN is not the first value, the difference bitmap of the source LUN is sent to the target LUN, so that the target LUN updates the saved difference bitmap based on the received difference bitmap, and when there are at least two copy LUNs in the current copy LUN list, the difference bitmap of the source LUN and the difference bitmaps saved by the associated LUNs of the target LUN are merged, and the incremental data in the source LUN is synchronized to the target LUN based on the merged difference bitmap.

[0049] In this embodiment, since the copy serial number of the target LUN is not the first value, it has been copied before and has received a difference bitmap before (that is, the difference bitmap previously saved by the target LUN). After receiving the difference bitmap from the source LUN this time, the newly received difference bitmap is used to replace the originally saved difference bitmap to achieve the update of the difference bitmap saved by the target LUN.

[0050] In this embodiment, the associated LUN of the target LUN refers to each copy LUN in the current copy LUN list whose copy serial number is not the first value except the target LUN, that is, the associated LUN refers to all copy LUNs in the current copy LUN list that have completed replication and are not the target LUN. When the source LUN performs a new replication, it is necessary to obtain the difference bitmap on the copy LUNs that have been replicated except the target LUN, so as to perform incremental replication in the following steps.

[0051] In this embodiment, there are many ways to merge the difference bitmap of the source LUN and the difference bitmaps saved by the associated LUNs of the target LUN in specific implementation. For example, in one embodiment, in the difference bitmap, 1 bit corresponds to the change of 32KB storage space. If the value of a bit is 1, the 32KB corresponding to the bit is different. After receiving the difference bitmap sent by each associated LUN, the source LUN merges its own difference bitmap with the difference bitmap bits received from each associated LUN. If the values ​​of the same bits are all 0, the value after merging is 0, otherwise the value after merging is 1, thereby obtaining the merged difference bitmap, and then obtaining the data changes on the source LUN after the target LUN performs the last replication.

[0052] S105, change the available status of the target LUN in the current copy LUN list to the standby status, change the copy serial number of the target LUN to M+K, where M is the maximum copy serial number in the current copy LUN list, and K is greater than or equal to 1; and change the available status of the next copy LUN of the target LUN in the current copy LUN list to the primary status.

[0053] In this embodiment, after the replication is completed, if the target LUN is the last replica LUN in the current replica LUN list, the available status of the first replica LUN in the current replica LUN list is modified to the primary status. If the target LUN is not the last replica LUN in the current replica LUN list, the available status of the next replica LUN of the target LUN in the current replica LUN list is modified to the primary status. That is to say, in the case where no replica LUN is added or deleted in the current replica LUN list, the available status of each replica LUN is set to the primary status in turn according to the record order of each replica LUN in the current replica LUN list.

[0054] So far, completed Figure 1 The process shown.

[0055] pass Figure 1In the process shown, in the embodiment of the present application, when it is determined to start a copy of the data in the source LUN, a copy LUN with an available state of the master state is obtained from the current copy LUN list corresponding to the source LUN as the target LUN to which the data is copied this time, and the copy serial number of the target LUN is obtained from the current copy LUN list. Afterwards, if the copy serial number of the target LUN is the first value, the difference bitmap of the source LUN is sent to the target LUN, so that the target LUN saves the received difference bitmap and copies the data of the source LUN to the target LUN in full; if the copy serial number of the target LUN is not the first value, the difference bitmap of the source LUN is sent to the target LUN, so that the target LUN updates the saved difference bitmap based on the received difference bitmap, and when there are at least two copy LUNs in the current copy LUN list, the difference bitmap of the source LUN and the difference bitmap saved by the associated LUN of the target LUN are merged, and the incremental data in the source LUN is synchronized to the target LUN based on the merged difference bitmap. Finally, the available state of the target LUN in the current copy LUN list is changed to the standby state, and the copy serial number of the target LUN is changed to M+K; and the available state of the next copy LUN or the first copy LUN of the target LUN in the current copy LUN list is changed to the primary state.

[0056] In an embodiment of the present application, a source LUN can be configured with multiple replica LUNs, and the multiple replica LUNs can be located in one storage device or in multiple storage devices, and the multiple replica LUNs are physically completely independent. During the replication process, multiple replica LUNs are used in sequence to save the data of the source LUN in multiple historical time planes, which can avoid the situation where the replica LUN has a hard disaster and the data cannot be recovered. It can also avoid the situation where the snapshot on the replica LUN fails and multiple snapshots are unavailable, which in turn makes it impossible to restore the source LUN to the data of a historical moment when logical damage has not occurred. In this way, when there are multiple replica LUNs in the current replica LUN list, these multiple replica LUNs can be used in the above manner to copy the data of the source LUN in different historical time planes respectively, that is, the method provided by the present application supports one-to-many replication and can provide effective data protection solutions for a variety of scenarios.

[0057] Furthermore, when the copy serial number of the target LUN is not the first value, the difference bitmap of the source LUN and the difference bitmap saved by the associated LUN of the target LUN are merged, and the incremental data in the source LUN is synchronized to the target LUN based on the merged difference bitmap. At this time, data is copied between the source LUN and the target LUN in an incremental manner, which can maximize the copying efficiency.

[0058] Furthermore, since the above-mentioned replication is completed by the storage device, there is no need to rely on the backup software of the server, which saves the process of the backup software reading data from the storage device and writing data, thereby improving the backup efficiency.

[0059] As an embodiment, considering that the source LUN may fail when using the difference bitmap to record data changes, so that the difference bitmap does not record the data changes, that is, the difference bitmap is in an invalid state, therefore, after determining the target LUN, it is necessary to determine whether the state of the difference bitmap of the source LUN is valid. If the state of the difference bitmap of the source LUN is invalid, the data of the source LUN is fully copied to the target LUN, and the target LUN is notified to modify the state of the difference bitmap stored on the target LUN to invalid.

[0060] If the status of the difference bitmap of the source LUN is valid, execute the above step S201 to obtain the copy serial number of the target LUN from the current copy LUN list, that is, obtain the copy serial number of the target LUN from the current copy LUN list, which is performed under the premise that the status of the difference bitmap of the source LUN is valid.

[0061] As an embodiment, based on the above description, it can be known that the difference bitmap saved by the replica LUN may sometimes be invalid. Therefore, after the source LUN obtains the difference bitmap saved by each of the associated LUNs of the target LUN, if it is learned that the status of the difference bitmap saved by any of the associated LUNs of the target LUN is invalid, the difference bitmap of the source LUN is sent to the target LUN, so that the target LUN saves the received difference bitmap and copies all the data of the source LUN to the target LUN.

[0062] If the status of the difference bitmap saved by any associated LUN is invalid, it means that the difference corresponding to the associated LUN is lost, and this replication cannot perform incremental replication, and can only perform full replication. Before performing full replication, the source LUN sends the difference bitmap to the target LUN so that the target LUN can save the latest difference bitmap of the source LUN.

[0063] If the status of the difference bitmaps saved by each associated LUN is valid, then the difference bitmap of the source LUN and the difference bitmaps saved by the associated LUNs of the target LUN in step S104 are merged. That is, the difference bitmap of the source LUN and the difference bitmaps saved by the associated LUNs of the target LUN are merged on the premise that the status of the difference bitmaps saved by each associated LUN of the target LUN is valid.

[0064] As an embodiment, the replica LUN list can be changed, such as adding a replica LUN or removing a replica LUN.

[0065] The following is a detailed description of removing a replica LUN from the replica LUN list:

[0066] See also Figure 2 , Figure 2 A schematic diagram of the process of removing a replica LUN provided in an embodiment of the present application.

[0067] like Figure 2 As shown, the process may include the following steps:

[0068] S201, when a removal instruction is received, if there are at least two copy LUNs in the current copy LUN list, obtain the copy serial number and available status of the first copy LUN from the current copy LUN list.

[0069] It should be noted that if there is only one replica LUN in the current replica LUN list, it will be deleted directly.

[0070] S202: If the copy serial number of the first copy LUN is the first value, or if the copy serial number of the first copy LUN is the smallest value among the copy serial numbers recorded in the current copy LUN list that are not the first value, delete the first copy LUN from the current copy LUN list.

[0071] In this embodiment, if the copy serial number of the first copy LUN is the first value, it indicates that the first copy LUN has not been copied. Directly deleting the first copy LUN from the current copy LUN list will not affect other copy LUNs. Therefore, the first copy LUN is directly deleted.

[0072] If the replica serial number of the first replica LUN is the smallest value among the replica serial numbers that are not the first value recorded in the current replica LUN list, it indicates that the time point of the latest replication of the first replica LUN is the farthest from the current time point among all the replica LUNs in the current replica LUN list. Directly deleting the first replica LUN can still achieve data replication when the remaining replica LUNs are selected as target LUNs for data replication. Therefore, directly deleting the first replica LUN is selected.

[0073] S203, if the replica serial number of the first replica LUN is not the smallest value among the replica serial numbers that are not the first value recorded in the current replica LUN list, then: find the second replica LUN from the current replica LUN list; the second replica LUN refers to a replica LUN whose replica serial number is not the first value and is second larger than the replica serial number of the first replica LUN; send the difference bitmap saved in the first replica LUN to the second replica LUN, so that the second replica LUN merges the received difference bitmap with the saved difference bitmap to update the saved difference bitmap; delete the first replica LUN from the current replica LUN list.

[0074] In this embodiment, if the copy serial number of the first copy LUN is not the smallest value among the copy serial numbers that are not the first value recorded in the current copy LUN list, it indicates that the first copy LUN is not the one in all the copy LUNs in the current copy LUN list, and the time point at which the latest copy is performed is the farthest from the current time point. The first copy LUN is directly deleted, and data loss will occur when the remaining copy LUNs are selected as target LUNs for data replication. Therefore, it is necessary to execute step S203 to send the difference bitmap saved by the first copy LUN to the second copy LUN, so that the second copy LUN merges the received difference bitmap with the saved difference bitmap to update the saved difference bitmap. After this operation, the first copy LUN is deleted from the current copy LUN list.

[0075] As an embodiment, after searching for the second copy LUN from the current copy LUN list in the above step S203, it is necessary to determine the state of the difference bitmap stored in the first copy LUN.

[0076] If the status of the difference bitmap saved in the first copy LUN is valid, the above-mentioned sending of the difference bitmap saved in the first copy LUN to the second copy LUN is executed, that is, the above-mentioned sending of the difference bitmap saved in the first copy LUN to the second copy LUN is executed on the premise that the status of the difference bitmap saved in the first copy LUN is valid.

[0077] If the status of the difference bitmap stored in the first copy LUN is invalid, the second copy LUN is notified to change the status of the difference bitmap stored in the second copy LUN to invalid. In this case, the above-mentioned sending of the difference bitmap stored in the first copy LUN to the second copy LUN is also not performed.

[0078] S204, if the available status of the first copy LUN is the master status, when the first copy LUN is not the last copy LUN in the current copy LUN list, the available status of the next copy LUN of the first copy LUN in the current copy LUN list is modified to the master status; when the first copy LUN is the last LUN in the current copy LUN list, the available status of the first copy LUN in the current copy LUN list is modified to the master status.

[0079] After deleting the first copy, if the target LUN is the last copy LUN in the current copy LUN list, the available state of the first copy LUN in the current copy LUN list is changed to the primary state. If the target LUN is not the last copy LUN in the current copy LUN list, the available state of the next copy LUN of the target LUN in the current copy LUN list is changed to the primary state.

[0080] The above describes in detail how to remove a replica LUN from the replica LUN list.

[0081] The following is a detailed description of adding a replica LUN to the replica LUN list:

[0082] As an embodiment, when a new adding instruction is received, the new adding instruction is used to instruct to add a third replica LUN to the current replica LUN list.

[0083] In one implementation, when a third copy LUN is added to the current copy LUN list, if there is no copy LUN in the current copy LUN list, the third copy LUN is added to the current copy LUN list, the availability status of the third copy LUN is set to the primary status, and the copy serial number of the third copy LUN is set to the first value.

[0084] In another implementation, when a third copy LUN is added to the current copy LUN list, if there is a copy LUN in the current copy LUN list, the third copy LUN is added to the end of the current copy LUN list, the available status of the third copy LUN is set to the standby status, and the copy serial number of the third copy LUN is set to the first value.

[0085] In yet another implementation, if there are at least two replica LUNs in the current replica LUN list, the third replica LUN is different from any of the replica LUNs in the current replica LUN list. In order to make full use of the newly added third replica LUN, that is, to be selected as the target LUN for replication as soon as possible, execute Figure 3 The following steps are shown:

[0086] like Figure 3 As shown, the process may include the following steps:

[0087] S301, if there are at least two replica LUNs in the current replica LUN list, determine whether there is a replica LUN in the current replica LUN list whose available status is the standby status and whose replica serial number is the first value. If so, use the first replica LUN whose replica serial number is the first value as the fourth replica LUN; if not, execute the following step S302.

[0088] S302: Search for the replica LUN corresponding to the smallest replica serial number in the current replica LUN list from among the replica LUNs in the available state of the standby state in the current replica LUN list, and use the found replica LUN as the fourth replica LUN.

[0089] S303: Add a third copy LUN between the fourth copy LUN and the previous copy LUN of the fourth copy LUN in the current copy LUN list, set the available state of the third copy LUN to a standby state, and set the copy serial number of the third copy LUN to the first value.

[0090] The above describes in detail how to add a replica LUN to the replica LUN list.

[0091] In order to explain the method provided by the present application in more detail, the scheme provided by the present application is described in more detail below in the form of specific embodiments.

[0092] In this embodiment, the first value is set to 0, K=1.

[0093] In the first part, when the source LUNA triggers a new replication, the method includes the following steps:

[0094] 1. When starting a replication of data in the source LUNA, obtain a replica LUN in the active state from the current replica LUN list corresponding to the source LUNA as the target LUN to which the data is replicated, assuming it is LUNAy.

[0095] 2. The source LUNA obtains the replica serial number of LUNAy from the current replica LUN list, and determines the status of its own difference bitmap and the replica serial number of LUNAy; 3.

[0097] (1) If the status of the source LUNA difference bitmap is invalid, then:

[0098] Copy all the data from the source LUNA to LUNAy.

[0099] Notify LUNAy to change the status of the difference bitmap saved on LUNAy to invalid.

[0100] (2) If the status of the source LUNA difference bitmap is valid, and the copy serial number of LUNAy is 0, then:

[0101] The source LUNA sends the difference bitmap to LUNAy;

[0102] LUNAy saves the difference bitmap;

[0103] Copy all the data from the source LUNA to LUNAy.

[0104] (3) If the status of the difference bitmap of the source LUNA is valid and the replica serial number of LUNAy is not 0, then search the current replica LUN list for a list of all replica LUNs whose replica serial numbers are not 0.

[0105] 1) If the search list contains only LUNAy: then:

[0106] The source LUNA sends the difference bitmap to LUNAy;

[0107] LUNAy saves the difference bitmap;

[0108] The source LUNA incrementally copies the data to LUNAy based on the difference bitmap.

[0109] 2) If the search list contains only multiple LUNs, then:

[0110] The source LUNA sends the difference bitmap to LUNAy;

[0111] LUNAy saves the difference bitmap;

[0112] The source LUNA obtains the difference bitmaps of multiple LUNs (i.e., each associated LUN) in the search list except LUNAy one by one;

[0113] If the difference bitmap sent by any associated LUN is in invalid state, the data of the source LUNA will be fully copied to LUNAy;

[0114] If the status of the difference bitmap sent by each associated LUN is valid, the difference bitmap of the source LUNA and the difference bitmap of each associated LUN are merged to obtain a merged difference bitmap, and the source LUNA incrementally copies the data to LUNAy based on the merged difference bitmap.

[0115] 4. After the replication from source LUNA to LUNAy is completed, the maximum value M of the replica serial number in the current replica LUN list is obtained, and the replica serial number of LUNAy in the current replica LUN list is modified to (M+1).

[0116] 5. If the replica LUN list contains multiple records and LUNAy is not the last record, change the available status of the record corresponding to LUNAy to the standby status, and change the available status of the next record of LUNAy to the primary status.

[0117] If LUNAy is the last record, the first record is taken as the next record.

[0118] The second part, when deleting the copy LUNAx,

[0119] The removal instruction is to delete the replica LUNAx from the current replica LUN list. Deleting the replica LUNAx specifically includes the following steps:

[0120] 1. If only the replica LUNAx exists in the current replica LUN list, remove the replica LUNAx.

[0121] 2. If the replica serial number value of LUNAx in the current replica LUN list is 0, or the replica serial number of LUNAx in the replica LUN list is not 0 and is the minimum value among all non-0 replica serial numbers, then:

[0122] 1) If the available state of LUNAx in the current replica LUN list is the master state, and if LUNAx is the last record in the current replica LUN list, the available state of the first record in the current replica LUN list is changed to the master state, and then LUNAx is removed from the current replica LUN list. And if LUNAx is not the last record in the current replica LUN list, the available state of the next record of LUNAx is changed to the master state, and then LUNAx is removed from the current replica LUN list.

[0123] 2) If the availability status of LUNAx in the current replica LUN list is a standby status, directly remove LUNAx from the current replica LUN list.

[0124] 3. If the replica serial number M of LUNAx in the replica LUN list is not 0 and is not the minimum value among all non-0 replica serial numbers, then:

[0125] 1) Search the current replica LUN list for a replica serial number N that is larger than the replica serial number M and is not zero. Assume that the replica corresponding to the replica serial number N is LUN n.

[0126] 2) The source LUNA obtains the difference bitmap saved by LUNAx from LUNAx;

[0127] 3) If the status of the difference bitmap saved by LUNAx is invalid, LUNA notifies LUNn to change the status of its difference bitmap to invalid;

[0128] If the status of the difference bitmap saved by LUNAx is valid, LUNA sends the acquired difference bitmap of LUNAx to LUNn, and LUNn merges the difference bitmap of LUNAx with its own difference bitmap of LUNn, and notifies LUNA that the merging is completed.

[0129] 4) If the available state of LUNAx in the current replica LUN list is the master state, and if LUNAx is the last record in the current replica LUN list, the available state of the first record in the current replica LUN list is changed to the master state, and then LUNAx is removed from the current replica LUN list. And if LUNAx is not the last record in the current replica LUN list, the available state of the next record of LUNAx is changed to the master state, and then LUNAx is removed from the current replica LUN list.

[0130] If the availability status of LUNAx in the current replica LUN list is a standby status, LUNAx is directly removed from the current replica LUN list.

[0131] Part 3: When adding a new copy LUNAx,

[0132] The new command is to add a new replica LUNAx to the current replica LUN list. The specific steps of adding a new replica LUNAx are as follows:

[0133] 1. If there is no replica LUN in the current replica LUN list, add the replica LUNAx to the current replica LUN list, set the available state of the replica LUNAx to the master state, and set the replica serial number of LUNAx to 0.

[0134] 2. If there is a replica LUN in the current replica LUN list, add a replica LUNAx to the end of the current replica LUN list, set the available state of the replica LUNAx to the standby state, and set the replica serial number of the replica LUNAx to the first value.

[0135] For example, if there is a replica LUN in the current replica LUN list, and the availability status of the replica LUN is the primary status, that is, LUNA1 in the table below, a replica LUNAx is added after LUNA1, the availability status of LUNAx is the backup status, and the replica serial number is 0.

[0136] IP address of the device to which the replica LUN belongs Replica LUN name Available status Copy serial number 127.0.0.1 LUNA1 Active state 0

[0137] The current replica LUN list status after creating LUNAx is shown in the following table:

[0138] IP address of the device to which the replica LUN belongs Replica LUN name Available status Copy serial number 127.0.0.1 LUNAx Alternate state 0 127.0.0.1 LUNA1 Active state 0

[0139] 3. If there are at least two replica LUNs in the current replica LUN list, perform the following steps:

[0140] 1) Find the location LUN used to locate the newly added replica LUNAx from the current replica LUN list of the source LUNA.

[0141] 1-1) When searching for the first replica LUN whose available state is standby state and whose replica serial number is 0, if it is found, the found replica LUN is determined as the above positioning LUN. If it cannot be found, the following step 1-2 is executed. For example, LUNA3 in the following table is the positioning LUN.

[0142] IP address of the device to which the replica LUN belongs Replica LUN name Available status Copy serial number 127.0.0.1 LUNA1 Alternate state 1 127.0.0.1 LUNA2 Active state 0 127.0.0.1 LUNA3 Alternate state 0

[0143] 1-2) Find the replica LUN whose replica serial number is not 0 and has the smallest value, and determine the found replica LUN as the above-mentioned positioning LUN.

[0144] For example, LUNA1 in the following table is the positioning LUN.

[0145] IP address of the device to which the replica LUN belongs Replica LUN name Available status Copy serial number 127.0.0.1 LUNA1 Alternate state 1 127.0.0.1 LUNA2 Alternate state 2 127.0.0.1 LUNA3 Active state 0

[0146] 2. Create a new LUNAx between the located LUN and the previous copy LUN of the located LUN in the current copy LUN list.

[0147] 3. Set the available state of LUNAx in the current replica LUN list to the standby state, and set the replica serial number of LUNAx in the current replica LUN list to 0.

[0148] In the above three cases, after creating a new LUNAx, the following three tables are shown:

[0149]

[0150]

[0151] IP address of the device to which the replica LUN belongs Replica LUN name Available status Copy serial number 127.0.0.1 LUNAx Alternate state 0 127.0.0.1 LUNA1 Alternate state 1 127.0.0.1 LUNA2 Alternate state 2 127.0.0.1 LUNA3 Active state 0

[0152] At this point, the description of the method provided in this embodiment is completed. The following describes the device provided in this embodiment of the application:

[0153] See also Figure 4 , Figure 4 This is a schematic diagram of the structure of the device provided in the embodiment of the present application. Figure 4 As shown, the apparatus is applied to a storage device, which includes a source logical unit number LUN to be copied; the apparatus 400 includes: a first obtaining module 401, a second obtaining module 402, a copying module 403 and a state modifying module 404.

[0154] The first obtaining module 401 is used to obtain a copy LUN whose available state is the primary state from the current copy LUN list corresponding to the source LUN as the target LUN to which the data is copied this time when it is determined to start a copy of the data in the source LUN. If the available state of any copy LUN in the current copy LUN list is the primary state, it indicates that the copy LUN is currently allowed to copy data, and if the available state of any copy LUN is the standby state, it indicates that the copy LUN is currently not allowed to copy data;

[0155] The second obtaining module 402 is used to obtain the copy serial number of the target LUN from the current copy LUN list; if the copy serial number of any copy LUN in the current copy LUN list is the first value, it indicates that the copy LUN has not been replicated; if the copy serial number of any copy LUN is not the first value, it is used to indicate the order of the most recent replication executed by the copy LUN from the current time point among the replications that have been executed by all the copy LUNs;

[0156] The replication module 403 is used to send the difference bitmap of the source LUN to the target LUN if the copy serial number of the target LUN is the first value, so that the target LUN saves the received difference bitmap and fully replicates the data of the source LUN to the target LUN; the difference bitmap of the source LUN is used to record the latest data increment of the source LUN;

[0157] If the replica serial number of the target LUN is not the first value, the difference bitmap of the source LUN is sent to the target LUN, so that the target LUN updates the saved difference bitmap based on the received difference bitmap, and when there are at least two replica LUNs in the current replica LUN list, the difference bitmap of the source LUN and the difference bitmaps saved by the associated LUNs of the target LUN are merged, and the incremental data in the source LUN is synchronized to the target LUN based on the merged difference bitmap; the associated LUNs of the target LUN refer to each replica LUN in the current replica LUN list whose replica serial number is not the first value except the target LUN;

[0158] The status modification module 404 is used to modify the available status of the target LUN in the current replica LUN list to a standby status, modify the copy serial number of the target LUN to M+K, where M is the maximum copy serial number in the current replica LUN list, and K is greater than or equal to 1; and modify the available status of the next copy LUN of the target LUN in the current replica LUN list to a primary status.

[0159] As an embodiment, the replication module is further used to:

[0160] When the availability status of the next replica LUN of the target LUN in the current replica LUN list is changed to the primary status, if the target LUN is the last LUN in the current replica LUN list, the availability status of the first replica LUN in the current replica LUN list is changed to the primary status.

[0161] As an embodiment, obtaining the copy serial number of the target LUN from the current copy LUN list is performed on the premise that the state of the difference bitmap of the source LUN is valid, and the replication module is specifically further used for:

[0162] If the status of the difference bitmap of the source LUN is invalid, the data of the source LUN is fully copied to the target LUN, and the target LUN is notified so that the status of the difference bitmap saved on the target LUN is changed to invalid.

[0163] As an embodiment, merging the difference bitmap of the source LUN and the difference bitmaps respectively stored in the associated LUNs of the target LUN is performed on the premise that the status of the difference bitmap stored in each associated LUN of the target LUN is valid. The replication module is further configured to:

[0164] If it is learned that the status of the difference bitmap saved in any associated LUN of the target LUN is invalid, the difference bitmap of the source LUN is sent to the target LUN, so that the target LUN saves the received difference bitmap and fully copies the data of the source LUN to the target LUN.

[0165] As an embodiment, the device further includes:

[0166] A removal module, configured to, when receiving a removal instruction, obtain a copy serial number and an available status of a first copy LUN from the current copy LUN list when there are at least two copy LUNs in the current copy LUN list; the removal instruction is used to instruct to remove the first copy LUN from the current copy LUN list, the first copy LUN being any copy LUN in the current copy LUN list;

[0167] If the copy serial number of the first copy LUN is the first value, or if the copy serial number of the first copy LUN is the smallest value among the copy serial numbers recorded in the current copy LUN list that are not the first value, then delete the first copy LUN from the current copy LUN list;

[0168] After deleting the first copy LUN, if the available status of the first copy LUN is the primary status, when the first copy LUN is not the last copy LUN in the current copy LUN list, the available status of the next copy LUN of the first copy LUN in the current copy LUN list is changed to the primary status; when the first copy LUN is the last LUN in the current copy LUN list, the available status of the first copy LUN in the current copy LUN list is changed to the primary status.

[0169] As an embodiment, the removal module is further configured to:

[0170] If the replica serial number of the first replica LUN is not the smallest value among the replica serial numbers that are not the first value recorded in the current replica LUN list, then:

[0171] Find the second replica LUN from the current replica LUN list; the second replica LUN refers to a replica LUN whose replica serial number is not the first value and is second larger than the replica serial number of the first replica LUN;

[0172] Sending the difference bitmap saved by the first replica LUN to the second replica LUN, so that the second replica LUN merges the received difference bitmap with the saved difference bitmap to update the saved difference bitmap;

[0173] Delete the first replica LUN from the current replica LUN list.

[0174] As an embodiment, sending the difference bitmap stored in the first copy LUN to the second copy LUN is performed on the premise that the difference bitmap stored in the first copy LUN is valid, and the removal module is further configured to:

[0175] If the status of the difference bitmap stored in the first copy LUN is invalid, the second copy LUN is notified so that the status of the difference bitmap stored in the second copy LUN is modified to be invalid.

[0176] As an embodiment, the device further includes:

[0177] A new adding module, used for, when receiving a new adding instruction, the new adding instruction is used for instructing to add a third replica LUN to the current replica LUN list;

[0178] When a third replica LUN is added to the current replica LUN list, if there is no replica LUN in the current replica LUN list, the third replica LUN is added to the current replica LUN list, the availability state of the third replica LUN is set to the primary state, and the replica serial number of the third replica LUN is set to the first value;

[0179] If there is a copy LUN in the current copy LUN list, a third copy LUN is added to the end of the current copy LUN list, the available state of the third copy LUN is set to the standby state, and the copy serial number of the third copy LUN is set to the first value.

[0180] As an embodiment, the newly added module is further used for:

[0181] When the third replica LUN is added to the current replica LUN list, if there are at least two replica LUNs in the current replica LUN list, determine whether there is a replica LUN in the current replica LUN list whose available state is the standby state and whose replica serial number is the first value. If so, use the first replica LUN whose replica serial number is the first value as the fourth replica LUN; if not, then:

[0182] From each replica LUN in the current replica LUN list whose available status is standby, search for the replica LUN corresponding to the smallest replica serial number in the current replica LUN list, and use the found replica LUN as the fourth replica LUN;

[0183] A third copy LUN is added between the fourth copy LUN and the previous copy LUN of the fourth copy LUN in the current copy LUN list, the availability status of the third copy LUN is set to the standby status, and the copy serial number of the third copy LUN is set to the first value.

[0184] So far, completed Figure 4 Structural description of the device shown.

[0185] See also Figure 5 , Figure 5 This is a structural diagram of an electronic device provided in an embodiment of the present application. Figure 5 As shown, the hardware structure may include: a processor and a machine-readable storage medium, the machine-readable storage medium storing machine-executable instructions that can be executed by the processor; the processor is used to execute the machine-executable instructions to implement the method disclosed in the above example of this application.

[0186] Based on the same application concept as the above method, an embodiment of the present application also provides a machine-readable storage medium, on which a number of computer instructions are stored. When the computer instructions are executed by a processor, the method disclosed in the above example of the present application can be implemented.

[0187] Exemplarily, the above-mentioned machine-readable storage medium can be any electronic, magnetic, optical or other physical storage device that can contain or store information, such as executable instructions, data, etc. For example, the machine-readable storage medium can be: RAM (Radom Access Memory), volatile memory, non-volatile memory, flash memory, storage drive (such as hard disk drive), solid state drive, any type of storage disk (such as CD, DVD, etc.), or similar storage medium, or a combination thereof.

[0188] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims

1. A storage device data protection method, characterized in that: The method is applied to a storage device, the storage device includes a source logical unit number LUN to be copied; the method includes: When it is determined to start a replication of data in the source LUN, a replica LUN whose available status is the primary status is obtained from the current replica LUN list corresponding to the source LUN as the target LUN to which the data is replicated this time; if the available status of any replica LUN in the current replica LUN list is the primary status, it indicates that data replication is currently allowed for the replica LUN; if the available status of any replica LUN is the standby status, it indicates that data replication is currently not allowed for the replica LUN; Obtain the copy serial number of the target LUN from the current copy LUN list; if the copy serial number of any copy LUN in the current copy LUN list is the first value, it indicates that the copy LUN has not been replicated; if the copy serial number of any copy LUN is not the first value, it is used to indicate the order of the most recent replication executed by the copy LUN from the current time point among all the replications that have been executed by all the copy LUNs; If the copy serial number of the target LUN is the first value, the difference bitmap of the source LUN is sent to the target LUN, so that the target LUN saves the received difference bitmap and copies all the data of the source LUN to the target LUN; the difference bitmap of the source LUN is used to record the latest data increment of the source LUN; If the replica serial number of the target LUN is not the first value, the difference bitmap of the source LUN is sent to the target LUN, so that the target LUN updates the saved difference bitmap based on the received difference bitmap, and when there are at least two replica LUNs in the current replica LUN list, the difference bitmap of the source LUN and the difference bitmaps saved by the associated LUNs of the target LUN are merged, and the incremental data in the source LUN is synchronized to the target LUN based on the merged difference bitmap; the associated LUNs of the target LUN refer to each replica LUN in the current replica LUN list whose replica serial number is not the first value except the target LUN; Change the available status of the target LUN in the current copy LUN list to the standby status, change the copy serial number of the target LUN to M+K, where M is the maximum copy serial number in the current copy LUN list, and K is greater than or equal to 1; and change the available status of the next copy LUN of the target LUN in the current copy LUN list to the primary status.

2. The method according to claim 1, characterized in that: The method further comprises: When modifying the available state of the next copy LUN of the target LUN in the current copy LUN list to the primary state, if the target LUN is the last LUN in the current copy LUN list, the available state of the first copy LUN in the current copy LUN list is modified to the primary state.

3. The method according to claim 1, characterized in that The step of obtaining the copy serial number of the target LUN from the current copy LUN list is performed on the premise that the state of the difference bitmap of the source LUN is valid, and the method further includes: If the status of the difference bitmap of the source LUN is invalid, the data of the source LUN is fully copied to the target LUN, and the target LUN is notified to modify the status of the difference bitmap stored on the target LUN to invalid.

4. The method according to claim 3, characterized in that The merging of the difference bitmap of the source LUN and the difference bitmaps respectively stored in the associated LUNs of the target LUN is performed on the premise that the status of the difference bitmap stored in each associated LUN of the target LUN is valid, and the method further includes: If it is known that the status of the difference bitmap saved in any associated LUN of the target LUN is invalid, the difference bitmap of the source LUN is sent to the target LUN, so that the target LUN saves the received difference bitmap and fully copies the data of the source LUN to the target LUN.

5. The method according to claim 1, characterized in that The method further comprises: When a removal instruction is received, when there are at least two replica LUNs in the current replica LUN list, a replica serial number and an available status of the first replica LUN are obtained from the current replica LUN list; the removal instruction is used to instruct to remove the first replica LUN from the current replica LUN list, and the first replica LUN is any replica LUN in the current replica LUN list; If the copy serial number of the first copy LUN is a first value, or if the copy serial number of the first copy LUN is a minimum value among the copy serial numbers recorded in the current copy LUN list that are not the first value, deleting the first copy LUN from the current copy LUN list; After deleting the first copy LUN, if the available status of the first copy LUN is the primary status, when the first copy LUN is not the last copy LUN in the current copy LUN list, the available status of the next copy LUN of the first copy LUN in the current copy LUN list is changed to the primary status; when the first copy LUN is the last LUN in the current copy LUN list, the available status of the first copy LUN in the current copy LUN list is changed to the primary status.

6. The method according to claim 5, characterized in that The method further comprises: If the replica serial number of the first replica LUN is not the smallest value among the replica serial numbers that are not the first value and are recorded in the current replica LUN list, then: Find a second copy LUN from the current copy LUN list; the second copy LUN refers to a copy LUN whose copy serial number is not the first value and is second larger than the copy serial number of the first copy LUN; Sending the difference bitmap saved by the first replica LUN to the second replica LUN, so that the second replica LUN merges the received difference bitmap with the saved difference bitmap to update the saved difference bitmap; The first replica LUN is deleted from the current replica LUN list.

7. The method according to claim 6, characterized in that The sending of the difference bitmap stored in the first copy LUN to the second copy LUN is performed on the premise that the difference bitmap stored in the first copy LUN is valid, and the method further includes: If the status of the difference bitmap stored in the first copy LUN is invalid, the second copy LUN is notified to modify the status of the difference bitmap stored in the second copy LUN to invalid.

8. The method according to claim 1, characterized in that The method further comprises: When a new adding instruction is received, the new adding instruction is used to instruct to add a third replica LUN to the current replica LUN list; When the third copy LUN is added to the current copy LUN list, if there is no copy LUN in the current copy LUN list, the third copy LUN is added to the current copy LUN list, the available state of the third copy LUN is set to the primary state, and the copy serial number of the third copy LUN is set to the first value; If there is a copy LUN in the current copy LUN list, the third copy LUN is added to the end of the current copy LUN list, the available state of the third copy LUN is set to the standby state, and the copy serial number of the third copy LUN is set to the first value.

9. The method according to claim 8, characterized in that The method further comprises: When the third copy LUN is added to the current copy LUN list, if there are at least two copy LUNs in the current copy LUN list, determine whether there is a copy LUN in the current copy LUN list whose available state is the standby state and whose copy serial number is the first value. If so, use the first copy LUN whose copy serial number is the first value as the fourth copy LUN; if not, then: From the replica LUNs in the current replica LUN list whose available status is the standby status, searching for the replica LUN corresponding to the smallest replica serial number in the current replica LUN list, and using the found replica LUN as the fourth replica LUN; The third copy LUN is added between the fourth copy LUN and the previous copy LUN of the fourth copy LUN in the current copy LUN list, the available state of the third copy LUN is set to the standby state, and the copy serial number of the third copy LUN is set to the first value.

10. A storage device data protection device, characterized in that: The device is applied to a storage device, the storage device includes a source logical unit number LUN to be copied; the device includes: The first obtaining module is used to obtain a copy LUN whose available state is the primary state from the current copy LUN list corresponding to the source LUN as the target LUN to which the data is copied this time when it is determined to start a copy of the data in the source LUN; if the available state of any copy LUN in the current copy LUN list is the primary state, it indicates that the copy LUN is currently allowed to copy data, and if the available state of any copy LUN is the standby state, it indicates that the copy LUN is currently not allowed to copy data; The second obtaining module is used to obtain the copy serial number of the target LUN from the current copy LUN list; if the copy serial number of any copy LUN in the current copy LUN list is the first value, it indicates that the copy LUN has not been copied, and if the copy serial number of any copy LUN is not the first value, it is used to indicate the order of the most recent copy executed by the copy LUN from the current time point in the copy that has been executed by all the copy LUNs; The replication module is used to send the difference bitmap of the source LUN to the target LUN if the copy serial number of the target LUN is the first value, so that the target LUN saves the received difference bitmap and fully replicates the data of the source LUN to the target LUN; the difference bitmap of the source LUN is used to record the latest data increment of the source LUN; If the replica serial number of the target LUN is not the first value, the difference bitmap of the source LUN is sent to the target LUN, so that the target LUN updates the saved difference bitmap based on the received difference bitmap, and when there are at least two replica LUNs in the current replica LUN list, the difference bitmap of the source LUN and the difference bitmaps saved by the associated LUNs of the target LUN are merged, and the incremental data in the source LUN is synchronized to the target LUN based on the merged difference bitmap; the associated LUNs of the target LUN refer to each replica LUN in the current replica LUN list whose replica serial number is not the first value except the target LUN; The status modification module is used to change the available status of the target LUN in the current copy LUN list to the standby status, change the copy serial number of the target LUN to M+K, where M is the maximum copy serial number in the current copy LUN list, and K is greater than or equal to 1; and change the available status of the next copy LUN of the target LUN in the current copy LUN list to the primary status.

11. The device according to claim 10, characterized in that The replication module is also used to: When modifying the available state of the next copy LUN of the target LUN in the current copy LUN list to the primary state, if the target LUN is the last LUN in the current copy LUN list, the available state of the first copy LUN in the current copy LUN list is modified to the primary state.

12. The device according to claim 10, characterized in that The obtaining of the copy serial number of the target LUN from the current copy LUN list is performed on the premise that the state of the difference bitmap of the source LUN is valid, and the copy module is further used for: If the status of the difference bitmap of the source LUN is invalid, the data of the source LUN is fully copied to the target LUN, and the target LUN is notified to modify the status of the difference bitmap stored on the target LUN to invalid.

13. The device according to claim 12, characterized in that The merging of the difference bitmap of the source LUN and the difference bitmaps respectively stored in the associated LUNs of the target LUN is performed on the premise that the status of the difference bitmap stored in each associated LUN of the target LUN is valid, and the replication module is further used for: If it is known that the status of the difference bitmap saved in any associated LUN of the target LUN is invalid, the difference bitmap of the source LUN is sent to the target LUN, so that the target LUN saves the received difference bitmap and fully copies the data of the source LUN to the target LUN.

14. The device according to claim 10, characterized in that The device also includes: A removal module, configured to, when receiving a removal instruction, obtain a copy serial number and an available status of a first copy LUN from the current copy LUN list when there are at least two copy LUNs in the current copy LUN list; the removal instruction is used to instruct to remove the first copy LUN from the current copy LUN list, the first copy LUN being any copy LUN in the current copy LUN list; If the copy serial number of the first copy LUN is the first value, or if the copy serial number of the first copy LUN is the smallest value among the copy serial numbers recorded in the current copy LUN list that are not the first value, deleting the first copy LUN from the current copy LUN list; After deleting the first copy LUN, if the available status of the first copy LUN is the primary status, when the first copy LUN is not the last copy LUN in the current copy LUN list, the available status of the next copy LUN of the first copy LUN in the current copy LUN list is changed to the primary status; when the first copy LUN is the last LUN in the current copy LUN list, the available status of the first copy LUN in the current copy LUN list is changed to the primary status.

15. The device according to claim 14, characterized in that The removal module is further used for: If the replica serial number of the first replica LUN is not the smallest value among the replica serial numbers that are not the first value and are recorded in the current replica LUN list, then: Find a second copy LUN from the current copy LUN list; the second copy LUN refers to a copy LUN whose copy serial number is not the first value and is second larger than the copy serial number of the first copy LUN; Sending the difference bitmap saved by the first replica LUN to the second replica LUN, so that the second replica LUN merges the received difference bitmap with the saved difference bitmap to update the saved difference bitmap; The first replica LUN is deleted from the current replica LUN list.

16. The device according to claim 15, characterized in that The sending of the difference bitmap stored in the first copy LUN to the second copy LUN is performed on the premise that the difference bitmap stored in the first copy LUN is valid, and the removal module is further configured to: If the status of the difference bitmap stored in the first copy LUN is invalid, the second copy LUN is notified to modify the status of the difference bitmap stored in the second copy LUN to invalid.

17. The device according to claim 10, characterized in that The device further includes: a new adding module, configured to, when receiving a new adding instruction, instruct to add a third replica LUN to the current replica LUN list; When the third copy LUN is added to the current copy LUN list, if there is no copy LUN in the current copy LUN list, the third copy LUN is added to the current copy LUN list, the available state of the third copy LUN is set to the primary state, and the copy serial number of the third copy LUN is set to the first value; If there is a copy LUN in the current copy LUN list, the third copy LUN is added to the end of the current copy LUN list, the available state of the third copy LUN is set to the standby state, and the copy serial number of the third copy LUN is set to the first value.

18. The device according to claim 17, characterized in that The newly added module is further used for: When the third copy LUN is added to the current copy LUN list, if there are at least two copy LUNs in the current copy LUN list, determine whether there is a copy LUN in the current copy LUN list whose available state is the standby state and whose copy serial number is the first value. If so, use the first copy LUN whose copy serial number is the first value as the fourth copy LUN; if not, then: From the replica LUNs in the current replica LUN list whose available status is the standby status, searching for the replica LUN corresponding to the smallest replica serial number in the current replica LUN list, and using the found replica LUN as the fourth replica LUN; The third copy LUN is added between the fourth copy LUN and the previous copy LUN of the fourth copy LUN in the current copy LUN list, the available state of the third copy LUN is set to the standby state, and the copy serial number of the third copy LUN is set to the first value.

19. An electronic device, characterized in that: The electronic device includes: Processor; and A computer-readable storage medium, in which computer program instructions are stored, and when the computer program instructions are executed by the processor, the processor executes the steps of the method according to any one of claims 1 to 9.

20. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, which, when executed by a processor, enable the processor to perform the steps of any one of the methods of claims 1 to 9.

Citation Information

Patent Citations

  • Data protection method, device and memory apparatus

    CN101241456A

  • Method and device for asynchronously copying data

    CN112632188A

  • Continuous data protection unit, recovery unit for data protection and method thereof

    CN116601610A

  • Data replication method and storage system

    US20160292250A1

  • Storage integrated differential block based backup

    US20230205636A1