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

By configuring multiple physically independent replica LUNs in the storage device, and utilizing differential bitmap and incremental replication technologies, the data protection problem when both hard and soft disasters occur simultaneously is solved, enabling data recovery and efficient replication in various scenarios.

CN119883739BActive Publication Date: 2025-11-07MACROSAN TECH
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

Existing data protection methods cannot effectively protect data when both hard and soft disasters occur simultaneously, especially in scenarios requiring multiple replica data volumes, where data recovery is impossible. Furthermore, existing technologies cannot cope with data loss caused by snapshot failures and hard disasters.

Method used

By configuring multiple physically independent replica LUNs in the storage device, and using difference bitmap and incremental replication technology, multiple replica LUNs are used sequentially to save data of the source LUN in different historical time planes, avoiding data loss caused by hard disasters and snapshot failures, and merging difference bitmaps between target LUNs for incremental synchronization.

Benefits of technology

It achieves effective data protection in various scenarios, avoids data loss, improves replication efficiency, reduces reliance on server backup software, and enhances backup efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119883739B_ABST
    Figure CN119883739B_ABST
Patent Text Reader

Abstract

The application provides a storage device data protection method and device, an electronic device and a storage medium. Through the method provided by the application, the data of the source LUN at different historical time planes can be respectively copied using multiple copy LUNs, that is, the method provided by the application supports one-to-many replication, and can provide an effective data protection scheme for various scenes. Moreover, since the difference bitmap of the source LUN and the difference bitmap respectively 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, the data between the source LUN and the target LUN is copied in an incremental manner, which can maximize the replication efficiency. Moreover, since the replication is completed by the storage device without the aid of the backup software of the server, the process of reading and writing data from the storage device by the backup software 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 and device, an electronic device, and a storage medium. BACKGROUND

[0002] With the advent of the big data era, data is becoming more and more important, and therefore, data protection is also becoming more and more important.

[0003] Replication is one of the important means to maintain data persistence protection, and is also a common solution to a "hard disaster". A hard disaster, as the name implies, refers to a "hard" disaster, usually referring to a production data physically damaged or unable to be read due to factors such as RAID failure, earthquake, fire, etc. At present, the usual replication method is to save production data in a logical unit number (LUN) of a storage device, and the LUN serves as a production data volume (also referred to as a source LUN). The storage device creates a copy data volume (also referred to as a copy LUN) for saving a data copy for the production data volume. The source LUN and the copy LUN form a replication pair, and data is replicated from the source LUN to the copy LUN according to a strategy. The two LUNs in the replication pair are usually located in two different storage devices. Since the copy LUN and the source LUN are physically independent, when a hard disaster occurs in the source LUN, the copy LUN can be used for data recovery.

[0004] A snapshot is a common solution to a "soft disaster". A soft disaster, as the name implies, refers to a "soft" disaster, usually referring to a production data volume (also referred to as a source LUN) in which data is logically damaged due to factors such as program bugs, viruses, and misoperations. Through snapshot technology, multiple snapshots can be created for the source LUN, and each snapshot corresponds to the data of the source LUN at a certain time. When a soft disaster occurs in the source LUN, the data of the source LUN at a historical time when the logical damage has not occurred can be found through the snapshot. In the snapshot implementation scheme, an incremental snapshot method is usually used, that is, when multiple snapshots exist on a source LUN, each snapshot only records the changes in a part of the time period. When the data at a certain historical time is needed to be found through the snapshot, the data of all snapshots after the historical time and the data of the source LUN need to be obtained, that is, there is a dependency relationship between multiple snapshots, and multiple snapshots all depend on the source LUN.

[0005] In view of the threat of hard disaster and soft disaster occurring simultaneously, a common data protection method is to enable snapshots for a source LUN and a copy LUN respectively, to create snapshots on the source LUN and the copy LUN respectively, and to record data of the source LUN and the copy LUN at multiple historical time points. However, when the source LUN has a hard disaster and a soft disaster, the soft disaster may have been transmitted to the copy LUN, and if some extreme abnormalities occur on the copy LUN, such as snapshot failure, hard disaster of the copy LUN, etc., the data cannot be recovered.

[0006] In addition, this data protection method is not applicable in a data protection scenario, for example, a data protection scenario requires 30 copy data volumes to be created for a production data volume, and the 30 copy data volumes respectively copy data of the production data volume at 30 historical time planes. In this scenario, the above data protection method is not applicable, and the requirement cannot be met by the storage device. SUMMARY

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

[0008] Embodiments of the present application provide a storage device data protection method, which is applied to a storage device including a source logical unit number (LUN) to be copied. The method comprises:

[0009] When it is determined to start copying data in the source LUN once, a copy LUN with a primary state in a current copy LUN list corresponding to the source LUN is obtained as a target LUN for this time data copying. If the availability state of any copy LUN in the current copy LUN list is the primary state, it indicates that the copy LUN currently allows data copying, and if the availability state of any copy LUN is the standby state, it indicates that the copy LUN currently does not allow data copying.

[0010] A copy serial number of the target LUN is obtained from the current copy LUN list. If the copy serial number of any copy LUN in the current copy LUN list is a 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 nearest copying executed by the copy LUN from a current time point among all copying executed by all copy LUNs.

[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 full-amount 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;

[0012] 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 each 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; the associated LUN of the target LUN refers to each copy LUN in the current copy LUN list except the target LUN, and the copy serial number of the copy LUN is not the first value;

[0013] The available state of the target LUN in the current copy LUN list is modified to the standby state, the copy serial number of the target LUN is modified to M+K, M is the maximum copy serial number in the current copy LUN list, and K is greater than or equal to 1; and the available state of the next copy LUN of the target LUN in the current copy LUN list is modified to the active state.

[0014] Embodiments of the present application also provide a storage device data protection apparatus, which is applied to a storage device, and the storage device includes a source logical unit number (LUN) to be replicated; the apparatus includes:

[0015] A first obtaining module is configured to, when it is determined to start a data replication to the source LUN, obtain a copy LUN with an active state from a current copy LUN list corresponding to the source LUN as a target LUN of the data replication; the active state of any copy LUN in the current copy LUN list indicates that the copy LUN currently allows data replication; and the standby state of any copy LUN indicates that the copy LUN currently does not allow data replication.

[0016] A second obtaining module is configured to obtain the copy serial number of the target LUN from the current copy LUN list; the first value of the copy serial number of any copy LUN in the current copy LUN list indicates that the copy LUN has not been replicated; and the copy serial number of any copy LUN not being the first value indicates that the copy LUN has performed a replication closest to a current time point in an order of all the copy LUNs having performed the replication.

[0017] The replication module is configured to, if the copy serial number of the target LUN is the first value, send the difference bitmap of the source LUN to the target LUN, so that the target LUN saves the received difference bitmap and replicates the full 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 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 each 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; the associated LUN of the target LUN refers to each copy LUN in the current copy LUN list except the target LUN, and the copy serial number of the copy LUN is not the first value.

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

[0020] The embodiment of the present application also provides an electronic device, comprising a processor and a memory for storing computer program instructions, the computer program instructions enable the processor to execute the steps of the above method when the computer program instructions are executed by the processor.

[0021] The embodiment of the present application also provides a machine readable storage medium, the storage medium stores computer program instructions, and the computer program instructions can implement the steps of the above method when the computer program instructions are executed.

[0022] From the above technical solutions can be seen, in the embodiment of the application, when it is determined to start a copy of data in the source LUN once, the copy LUN with the active state from the current copy LUN list corresponding to the source LUN is obtained as the target LUN of this time data copy, and the copy serial number of the target LUN is obtained from the current copy LUN list. Then, 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 the full amount of data of the source LUN is copied to the target LUN; 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 modified to the standby state, the copy serial number of the target LUN is modified 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 modified to the active state.

[0023] In the embodiment of the application, the source LUN can be configured with multiple copy LUNs, which can be located in one storage device or multiple storage devices, and the multiple copy LUNs are completely independent in physics. In the replication process, the multiple copy LUNs are used in turn to save the data of the source LUN at multiple historical time planes, which can avoid the situation that the data cannot be recovered due to hard disaster of the copy LUN, and also can avoid the situation that multiple snapshots are unavailable due to snapshot invalidation on the copy LUN, and further cause the source LUN to be unable to be restored to a historical moment without logical damage. In this way, when there are multiple copy LUNs in the current copy LUN list, the multiple copy LUNs can copy the data of the source LUN at different historical time planes by the above-mentioned manner, that is, the method provided by the application supports one-to-many replication, and can provide an effective data protection scheme for various scenarios.

[0024] Further, 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, the data is replicated between the source LUN and the target LUN in an incremental manner, which can maximize the replication efficiency.

[0025] Furthermore, since the above replication is performed by the storage device without the need for server backup software, this eliminates the process of the backup software reading and writing data from the storage device, thus improving backup efficiency. Attached Figure Description

[0026] Figure 1 A flowchart illustrating the data protection method for storage devices provided in this application embodiment;

[0027] Figure 2 This is a schematic diagram of the process for removing a copy LUN provided in an embodiment of this application;

[0028] Figure 3 A flowchart illustrating the process of creating a new copy LUN provided in this application embodiment;

[0029] Figure 4 This is a schematic diagram of the device provided in the embodiments of this application;

[0030] Figure 5 This is a schematic diagram of the hardware structure of the electronic device provided in the embodiments of this application. Detailed Implementation

[0031] To enable those skilled in the art to better understand the technical solutions provided in the embodiments of this application, and to make the above-mentioned objectives, features and advantages of the embodiments of this application more apparent and understandable, the technical solutions in the embodiments of this application will be further described in detail below with reference to the accompanying drawings.

[0032] See Figure 1 , Figure 1 This is a flowchart illustrating a data protection method for a storage device provided in an embodiment of this application. The method is applied to a storage device, which includes a source LUN to be copied. A replica LUN is a LUN used to store data copied from the source LUN. It should be noted that the source LUN and the replica LUN can be located in the same storage device or in different storage devices; this embodiment does not specifically limit this.

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

[0034] S101, when determining to initiate a data replication to the source LUN, obtain the available replica LUN in the primary state from the current replica LUN list corresponding to the source LUN as the target LUN to which the data is replicated.

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

[0036] S102, obtaining the copy serial number of the target LUN from the current copy LUN list.

[0037] In the embodiment, the current copy LUN list records the information of each copy LUN, as an example, 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 state, and the copy serial number, as shown in Table 1.

[0038] In the embodiment, the initial set value of the copy serial number of any copy LUN is a first value, for example, 0, when the copy serial number of the copy is the initial set value, it indicates that the copy LUN has not been replicated. When the copy serial number of the copy LUN is not the initial set value, it indicates that the copy LUN has been replicated. At this time, the copy serial number is used to indicate the order of the replicated tasks that have been executed, that is, the copy serial number is used to indicate the order of the nearest replication executed by the copy LUN among all the replicated tasks that have been executed.

[0039] Table 1

[0040] Device IP of copy LUN Copy LUN name Available state Copy serial number 127.0.0.1 LUN A1 Primary state 0 127.0.0.1 LUN A2 Standby state 0 127.0.0.1 LUN A3 Standby state 0

[0041] For example, the initial set value of the copy serial number of each copy LUN is 0, and then the number is numbered from 1 every time the replication is triggered, and the order of the replicated tasks that have been executed is represented by a decimal number. For example, the copy LUN A1, the copy LUN A2, the copy LUN A3,..., the copy LUN A30 are selected in turn as the target copy LUN for replication in the order from front to back, then the copy serial numbers of the copy LUN A1, the copy LUN A2, the copy LUN A3,..., the copy LUN A30 are changed from 0 to 1, 2, 3,..., 30 in turn, 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 replicates the full amount of data of the source LUN to the target LUN.

[0043] In the 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 the source LUN performs the first replication, the source LUN has not recorded the difference bitmap, and the source LUN notifies the target LUN to modify the state of the difference bitmap saved on the target LUN to invalid. From the second replication, the difference bitmap of the source LUN records the data change of the source LUN in the time period from the time point Tn of triggering the current replication to the time point Tn-1 of triggering the last replication.

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

[0045] For example, the replication is triggered at 22:00:00 every day, and the difference bitmap of the source LUN at 22:00:00 today records the data change of the source LUN in the 24 hours from 22:00:00 yesterday to 22:00:00 today.

[0046] In the embodiment, since the copy serial number of the target LUN is the first value, the target LUN has not performed replication, and therefore, after the source LUN sends the difference bitmap to the target LUN, the target LUN receives the difference bitmap for the first time, and at this time, the target LUN only needs to save the difference bitmap.

[0047] It should be noted that the difference bitmap of the copy LUN is synchronized from the source LUN, and is not used to record the data change of the copy 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 bitmap saved by the associated LUN of the target LUN are merged, and the increment data in the source LUN is synchronized to the target LUN based on the merged difference bitmap.

[0049] In the embodiment, since the copy serial number of the target LUN is not the first value, the target LUN has performed replication before, and has received the difference bitmap (i.e., the difference bitmap saved by the target LUN before), and after receiving the difference bitmap from the source LUN this time, the saved difference bitmap is replaced by the newly received 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 every replica LUN in the current replica LUN list whose replica sequence number, excluding the target LUN, is not the first value. In other words, the associated LUN refers to all replica LUNs in the current replica LUN list that have already been replicated and are not the target LUN. When the source LUN performs a new replication, it is necessary to obtain the difference bitmap on the replica LUNs (excluding the target LUN) that have already been replicated, so that incremental replication can be performed in the following steps.

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

[0052] S105, change the available status of the target LUN in the current replica LUN list to standby status, change the replica serial number of the target LUN to M+K, where M is the maximum replica serial number in the current replica LUN list, and K is greater than or equal to 1; and change the available status of the next replica LUN of the target LUN in the current replica LUN list to 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 availability status of the first replica LUN in the current replica LUN list is changed to the primary state. If the target LUN is not the last replica LUN in the current replica LUN list, the availability status of the next replica LUN in the current replica LUN list is changed to the primary state. In other words, if no new replica LUNs are added or deleted from the current replica LUN list, the availability status of each replica LUN is sequentially set to the primary state according to the recording order of the replica LUNs in the current replica LUN list.

[0054] This concludes the process. Figure 1 The process is shown below.

[0055] pass Figure 1In the flow shown, in the embodiments of the present application, when it is determined to start the replication of data in the source LUN once, the copy LUN in the main state is obtained from the current copy LUN list corresponding to the source LUN as the target LUN to which the data is replicated this time, and the copy serial number of the target LUN is obtained from the current copy LUN list. Then, 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 replicates the full data of the source LUN to the target LUN; 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 modified to the standby state, the copy serial number of the target LUN is modified 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 modified to the main state.

[0056] In the embodiments of the present application, the source LUN can be configured with multiple copy LUNs, which can be located in one storage device or multiple storage devices, and the multiple copy LUNs are completely independent in physics. In the replication process, the multiple copy LUNs are used in turn to save the data of the source LUN at multiple historical time planes, which can avoid the situation that the data cannot be recovered due to hard disaster of the copy LUN, and also can avoid the situation that multiple snapshots are unavailable due to snapshot invalidation on the copy LUN, and further cause the source LUN to be unable to be restored to a historical time point before logical damage occurs. In this way, when there are multiple copy LUNs in the current copy LUN list, the multiple copy LUNs can replicate the data of the source LUN at different historical time planes by the above-mentioned manner, that is, the method provided by the present application supports one-to-many replication, and can provide an effective data protection scheme for various scenarios.

[0057] Further, 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, the data is replicated between the source LUN and the target LUN in an incremental manner, which can maximize the replication efficiency.

[0058] Further, since the above-mentioned copying is completed by the storage device without the help of the backup software of the server, the process of reading and writing data from and to the storage device by the backup software is omitted, and the backup efficiency can be improved.

[0059] As an embodiment, considering that the source LUN can fail when recording the data change by using the difference bitmap, the difference bitmap does not record the data change, 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 full data of the source LUN is copied to the target LUN, and the state of the difference bitmap saved on the target LUN is modified to invalid.

[0060] If the state of the difference bitmap of the source LUN is valid, the copy serial number of the target LUN is obtained from the current copy LUN list in step S201, that is, the copy serial number of the target LUN is obtained from the current copy LUN list under the premise that the state 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 copy LUN will also be invalid, therefore, after obtaining the difference bitmap saved by each associated LUN of the target LUN, if it is learned that the state of the difference bitmap saved by 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 the full data of the source LUN is copied to the target LUN.

[0062] If the state of the difference bitmap saved by any associated LUN is invalid, it indicates that the difference corresponding to the associated LUN is lost, and this time of copying cannot perform incremental copying, but can only perform full data copying. Before performing the full data copying, the source LUN sends the difference bitmap to the target LUN, so that the target LUN saves the latest difference bitmap of the source LUN.

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

[0064] As an embodiment, the copy LUN list can be changed, for example, a certain copy LUN is added or removed.

[0065] The removing of the copy LUN from the copy LUN list is described in detail as follows:

[0066] Referring to Figure 2 , Figure 2 A flowchart for removing the copy LUN is provided in the embodiment of the present application.

[0067] As Figure 2 shown, the flowchart can include the following steps:

[0068] S201, when the removing instruction is received and there are at least two copy LUNs in the current copy LUN list, obtaining the copy serial number and the available state of the first copy LUN from the current copy LUN list.

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

[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 minimum value among the copy serial numbers other than the first value recorded in the current copy LUN list, the first copy LUN is deleted from the current copy LUN list.

[0071] In the 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, and the first copy LUN is directly deleted from the current copy LUN list, which does not affect other copy LUNs. Therefore, the first copy LUN is directly deleted.

[0072] If the copy serial number of the first copy LUN is the minimum value among the copy serial numbers other than the first value recorded in the current copy LUN list, it indicates that the first copy LUN is the copy LUN whose time point of the latest copy is farthest from the current time point among all copy LUNs in the current copy LUN list. The first copy LUN is directly deleted, and data replication can still be realized when the remaining copy LUNs are selected as target LUNs for data replication. Therefore, the first copy LUN is directly deleted.

[0073] S203, if the copy serial number of the first copy LUN is not the minimum value among the copy serial numbers other than the first value recorded in the current copy LUN list, the following operations are performed: finding 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 smaller than the copy serial number of the first copy LUN; sending 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; and deleting the first copy LUN from the current copy LUN list.

[0074] In the embodiment, if the copy serial number of the first copy LUN is not the minimum value among the copy serial numbers recorded in the current copy LUN list and not the first value, it indicates that the first copy LUN is not the copy LUN whose time point of performing the latest copy is farthest from the current time point among all the copy LUNs in the current copy LUN list, and the first copy LUN is directly deleted, and data loss will occur when the remaining copy LUNs are selected as the target LUN for data replication. Therefore, the operation of sending the difference bitmap saved by the first copy LUN to the second copy LUN in step S203 needs to be performed, so that the second copy LUN merges the received difference bitmap with the saved difference bitmap to update the saved difference bitmap, and then the first copy LUN is deleted from the current copy LUN list.

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

[0076] If the state of the difference bitmap saved by the first copy LUN is valid, the operation of sending the difference bitmap saved by the first copy LUN to the second copy LUN is performed, that is, the operation of sending the difference bitmap saved by the first copy LUN to the second copy LUN is performed on the premise that the state of the difference bitmap saved by the first copy LUN is valid.

[0077] If the state of the difference bitmap saved by the first copy LUN is invalid, the second copy LUN is notified to modify the state of the difference bitmap saved on the second copy LUN to invalid. At this time, the operation of sending the difference bitmap saved by the first copy LUN to the second copy LUN is not performed.

[0078] In step S204, if the available state of the first copy LUN is the master state, when the first copy LUN is not the last copy LUN in the current copy LUN list, the available state of the next copy LUN of the first copy LUN in the current copy LUN list is modified to the master state; when the first copy 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 modified to the master state.

[0079] After the first copy is deleted, 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 modified to the master 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 modified to the master state.

[0080] The removing of the copy LUN from the copy LUN list is described in detail above.

[0081] The adding of the copy LUN to the copy LUN list is described in detail below.

[0082] As an embodiment, when the adding instruction is received, the adding instruction is used to indicate that a third copy LUN is added to the current copy LUN list.

[0083] In an implementation, 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 availability 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.

[0084] In another implementation, when the third copy LUN is added to the current copy LUN list, if there is one copy LUN in the current copy LUN list, the third copy LUN is added to the end of the current copy LUN list, the availability 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.

[0085] In yet another implementation, if there are at least two copy LUNs in the current copy LUN list, the third copy LUN is different from any copy LUN in the current copy LUN list. In order to make the added third copy LUN be fully utilized, that is, to be selected as the target LUN for replication as soon as possible, the following steps are performed. Figure 3 As shown in the following steps:

[0086] As shown in the following steps: Figure 3 The flow can include the following steps:

[0087] S301, if there are at least two copy LUNs in the current copy LUN list, it is judged whether there is a copy LUN with the standby state and the first value of the copy serial number in the current copy LUN list, if there is, the first copy LUN with the first value of the copy serial number is taken as the fourth copy LUN, if not, the following step S302 is performed.

[0088] S302, from each copy LUN with the standby state in the current copy LUN list, a copy LUN corresponding to the smallest copy serial number in the current copy LUN list is searched, and the searched copy LUN is taken as the fourth copy LUN.

[0089] S303, between the fourth copy LUN and the last copy LUN of the fourth copy LUN in the current copy LUN list, a third copy LUN is added, the available state of the third copy LUN is set as a standby state, and the copy serial number of the third copy LUN is set as a first value.

[0090] The adding of the copy LUN in the copy LUN list is described in detail above.

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

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

[0093] The first part, when the source LUN A triggers a new copy, the method includes the following steps:

[0094] 1. When it is determined to start a copy of data in the source LUN A, a copy LUN with an available state of a master state is obtained from a current copy LUN list corresponding to the source LUN A to serve as a target LUN for this time data copy, which is assumed to be LUNAy.

[0095] 2. The source LUN A obtains the copy serial number of LUNAy from the current copy LUN list, and judges the state of the difference bitmap of itself and the copy serial number of LUNAy. 3、

[0097] (1) If the state of the difference bitmap of the source LUN A is invalid, then:

[0098] the full amount of data of the source LUN A is copied to LUNAy,

[0099] LUNAy is informed to modify the state of the difference bitmap saved on the LUNAy to invalid.

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

[0101] the source LUN A sends the difference bitmap to LUNAy;

[0102] LUNAy saves the difference bitmap;

[0103] the full amount of data of the source LUN A is copied to LUNAy.

[0104] (3) If the state of the difference bitmap of the source LUN A is valid, and the copy serial number of LUNAy is not 0, then all copy LUN lists with copy serial numbers not being 0 are searched from the current copy LUN list,

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

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

[0107] LUNAy saves the difference bitmap;

[0108] The source LUN A replicates the data incrementally to LUNAy based on the difference bitmap.

[0109] 2) If the list of lookup contains multiple LUNs:

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

[0111] LUNAy saves the difference bitmap;

[0112] The source LUN A obtains the difference bitmap of each LUN in the list of lookup except LUNAy (i.e. each associated LUN) one by one;

[0113] If the state of the difference bitmap sent by any associated LUN is invalid, the source LUN A replicates the data of the source LUN A to LUNAy in full;

[0114] If the state of the difference bitmap sent by each associated LUN is valid, the source LUN A combines the difference bitmap of the source LUN A and the difference bitmap of each associated LUN to obtain a combined difference bitmap, and replicates the data of the source LUN A to LUNAy based on the combined difference bitmap.

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

[0116] 5、If the copy LUN list contains multiple records, and LUNAy is not the last record, the available state in the record corresponding to LUNAy is modified to the standby state, and the available state of the next record of LUNAy is modified to the primary state.

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

[0118] In the second part, when the copy LUNAx is deleted,

[0119] The removal instruction is to delete the copy LUNAx from the current copy LUN list, and the deletion of the copy LUNAx specifically includes the following steps:

[0120] 1、If there is only the copy LUNAx in the current copy LUN list, the copy LUNAx is removed.

[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 smallest among all non-0 replica serial numbers, then:

[0122] 1) If the availability status of LUNAx in the current replica LUN list is the primary status, and if LUNAx is the last record in the current replica LUN list, then the availability status of the first record in the current replica LUN list is changed to the primary status, and then LUNAx is removed from the current replica LUN list. If LUNAx is not the last record in the current replica LUN list, then the availability status of the next record of LUNAx is changed to the primary status, 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 the standby status, then LUNAx is directly removed 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 smallest among all non-0 replica serial numbers, then:

[0125] 1) Find the replica serial number N in the current replica LUN list that is greater than replica serial number M and is not 0, and assume that the replica corresponding to replica serial number N is LUNn;

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

[0127] 3) If the state of the difference bitmap saved by LUNAx is invalid, then LUN A notifies LUNn to change the state of the difference bitmap on LUNn to invalid;

[0128] If the state of the difference bitmap saved by LUNAx is valid, LUN A sends the obtained difference bitmap of LUNAx to LUNn, LUNn merges the difference bitmap of LUNAx with the difference bitmap of LUNn itself, and notifies LUN A of the completion of the merging.

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

[0130] If the available state of LUNAx in the current copy LUN list is the standby state, directly remove LUNAx from the current copy LUN list.

[0131] The third part, when adding the copy LUNAx,

[0132] The adding instruction is to add the copy LUNAx in the current copy LUN list, and the adding of the copy LUNAx specifically includes the following steps:

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

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

[0135] For example, if there is one copy LUN in the current copy LUN list, and the available state of the copy LUN is the primary state, that is, LUNA1 in the following table, add the copy LUNAx after LUNA1, the available state of LUNAx is the standby state, and the copy serial number is 0.

[0136] Device IP of copy LUN Copy LUN name Available state Copy serial number 127.0.0.1 LUN A1 Primary state 0

[0137] The state of the current copy LUN list after the new LUNAx is created is shown in the following table:

[0138] Device IP of copy LUN Copy LUN name Available state Copy serial number 127.0.0.1 LUN Ax Standby state 0 127.0.0.1 LUN A1 Primary state 0

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

[0140] 1) Find a positioning LUN from the current copy LUN list of the source LUNA to position the added copy LUNAx.

[0141] 1-1) Find the first copy LUN whose available state is the standby state and whose copy serial number is 0, and if found, determine the found copy LUN as the above positioning LUN. If not found, perform the following step 1-2). For example, LUNA3 in the following table is the positioning LUN.

[0142] Device IP of copy LUN Copy LUN name Available state Copy serial number 127.0.0.1 LUN A1 Standby state 1 127.0.0.1 LUN A2 Primary state 0 127.0.0.1 LUN A3 Standby state 0

[0143] 1-2) Find the replica LUN with the smallest non-zero replica serial number, and determine the found replica LUN as the above-mentioned positioning LUN.

[0144] For example, LUNA1 in the table below is a location LUN.

[0145] Device IP of copy LUN Copy LUN name Available state Copy serial number 127.0.0.1 LUN A1 Standby state 1 127.0.0.1 LUN A2 Standby state 2 127.0.0.1 LUN A3 Primary state 0

[0146] 2. Locate the LUN in the current replica LUN list and create a new LUNAx between the previous replica LUN of the located LUN.

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

[0148] The three scenarios described above, after creating a new LUNAx, are shown in the following three tables:

[0149]

[0150]

[0151] Device IP of copy LUN Copy LUN name Available state Copy serial number 127.0.0.1 LUN Ax Standby state 0 127.0.0.1 LUN A1 Standby state 1 127.0.0.1 LUN A2 Standby state 2 127.0.0.1 LUN A3 Primary state 0

[0152] This concludes the description of the method provided in this embodiment. The apparatus provided in this application embodiment will now be described:

[0153] See Figure 4 , Figure 4 This is a schematic diagram of the device provided in an embodiment of this application. Figure 4 As shown, the device is applied to a storage device, which includes a source logical unit number (LUN) to be copied; the device 400 includes: a first acquisition module 401, a second acquisition module 402, a copy module 403, and a status modification module 404.

[0154] The first acquisition module 401 is used to obtain, when determining to initiate a data replication to the source LUN, a replica LUN whose available status is primary to be obtained from the current replica LUN list corresponding to the source LUN as the target LUN to be replicated this time; if the available status of any replica LUN in the current replica LUN list is primary, it indicates that the replica LUN is currently allowed to perform data replication; if the available status of any replica LUN is standby, it indicates that the replica LUN is currently not allowed to perform data replication.

[0155] The second obtaining module 402 is configured to obtain a copy serial number of the target LUN from a current copy LUN list; the copy serial number of any copy LUN in the current copy LUN list is a first value, which indicates that the copy LUN has not been replicated; and the copy serial number of any copy LUN is not the first value, which indicates that the copy LUN has performed a most recent replication in an order of all replications performed by all copy LUNs.

[0156] The replication module 403 is configured to, if the copy serial number of the target LUN is the first value, send a difference bitmap of the source LUN to the target LUN, so that the target LUN saves the received difference bitmap and performs full-volume replication of data of the source LUN to the target LUN; the difference bitmap of the source LUN is used to record a latest data increment of the source LUN.

[0157] 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 each associated LUN of the target LUN are merged, and the increment data in the source LUN is synchronized to the target LUN based on the merged difference bitmap; the associated LUN of the target LUN refers to each copy LUN in the current copy LUN list except the target LUN, and the copy serial number of the copy LUN is not the first value.

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

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

[0160] When the available state of the next copy LUN of the target LUN in the current copy LUN list is modified 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.

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

[0162] If the state of the difference bitmap of the source LUN is invalid, the data of the source LUN is full-quantity copied to the target LUN, and the state of the difference bitmap saved on the target LUN is modified to invalid.

[0163] As an embodiment, the merging of the difference bitmap of the source LUN and the difference bitmap saved on each associated LUN of the target LUN is performed on the premise that the state of the difference bitmap saved on each associated LUN of the target LUN is valid, and the copying module is further configured to:

[0164] If it is learned that the state of the difference bitmap saved on 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 full-quantity data of the source LUN is copied to the target LUN.

[0165] As an embodiment, the apparatus further comprises:

[0166] The removing module is configured to, when a removing instruction is received and there are at least two copy LUNs in the current copy LUN list, obtain the copy serial number and the available state of a first copy LUN from the current copy LUN list, the removing instruction being 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 minimum value among the copy serial numbers recorded in the current copy LUN list and not the first value, the first copy LUN is deleted from the current copy LUN list;

[0168] After the first copy LUN is deleted, if the available state of the first copy LUN is the master state, and the first copy LUN is not the last copy LUN in the current copy LUN list, the available state of the next copy LUN of the first copy LUN in the current copy LUN list is modified to the master state; if the first copy 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 modified to the master state.

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

[0170] If the copy serial number of the first copy LUN is not the minimum value among the copy serial numbers recorded in the current copy LUN list and not the first value, then:

[0171] finding 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 smaller than the copy serial number of the first copy LUN;

[0172] sending 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;

[0173] deleting the first copy LUN from the current copy LUN list.

[0174] As an embodiment, the sending of the difference bitmap saved by the first copy LUN to the second copy LUN is performed on the premise that the state of the difference bitmap saved by the first copy LUN is valid, and the removing module is further used for:

[0175] If the state of the difference bitmap saved by the first copy LUN is invalid, notifying the second copy LUN so that the state of the difference bitmap saved on the second copy LUN is modified to invalid.

[0176] As an embodiment, the apparatus further comprises:

[0177] The adding module is used for adding a third copy LUN in the current copy LUN list when receiving an adding instruction, and the adding instruction is used for indicating the adding of the third copy LUN in the current copy LUN list.

[0178] When the third copy LUN is added in the current copy LUN list, if there is no copy LUN in the current copy LUN list, the third copy LUN is added in 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.

[0179] If there is a copy LUN in the current copy LUN list, the third copy LUN is added at 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 adding module is further used for:

[0181] When the third copy LUN is added in the current copy LUN list, if there are at least two copy LUNs in the current copy LUN list, it is judged whether there is a copy LUN whose available state is the standby state and whose copy serial number is the first value in the current copy LUN list, if there is, the first copy LUN whose copy serial number is the first value is taken as a fourth copy LUN, and if not:

[0182] From the available replica LUNs in the current replica LUN list that are in standby status, find 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] In the current replica LUN list, between the fourth replica LUN and the previous replica LUN of the fourth replica LUN, add a third replica LUN. Set the availability status of the third replica LUN to standby and set the replica serial number of the third replica LUN to the first value.

[0184] This concludes the process. Figure 4 Structural description of the device shown.

[0185] Please see Figure 5 , Figure 5 This is a structural diagram of an electronic device provided in an embodiment of this 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, this application embodiment also provides a machine-readable storage medium storing a plurality of computer instructions, which, when executed by a processor, can implement the method disclosed in the above examples of this application.

[0187] For example, the aforementioned 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 instance, machine-readable storage media can be: RAM (Random Access Memory), volatile memory, non-volatile memory, flash memory, storage drives (such as hard disk drives), solid-state drives, any type of storage disk (such as optical discs, DVDs, etc.), or similar storage media, or combinations thereof.

[0188] The above description is merely an embodiment of this application and is not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.

Claims

1. A storage device data protection method, characterized by, The method is applied to a storage device including a source logical unit number (LUN) to be copied; and the method includes: When it is determined to start a data replication on the source LUN, a replica LUN with a primary state in a current replica LUN list corresponding to the source LUN is obtained as a target LUN to which data is replicated this time; the primary state of any replica LUN in the current replica LUN list indicates that the replica LUN currently allows data replication, and the standby state of any replica LUN indicates that the replica LUN currently does not allow data replication; A replica serial number of the target LUN is obtained from the current replica LUN list; the replica serial number of any replica LUN in the current replica LUN list is a first value, which indicates that the replica LUN has not been replicated, and the replica serial number of any replica LUN is not the first value, which indicates that the replica LUN has performed a most recent replication among all the replicas LUNs that have all been replicated; If the replica serial number of the target LUN is the first value, a difference bitmap of the source LUN is sent to the target LUN, so that the target LUN saves the received difference bitmap and replicates full data of the source LUN to the target LUN; the difference bitmap of the source LUN is used to record a 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 bitmap saved by each 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; the associated LUN of the target LUN refers to each replica LUN in the current replica LUN list except the target LUN, and the replica serial number of the replica LUN is not the first value; The primary state of the target LUN in the current replica LUN list is modified to the standby state, the replica serial number of the target LUN is modified to M+K, M is a maximum replica serial number in the current replica LUN list, and K is greater than or equal to 1; and the primary state of a next replica LUN of the target LUN in the current replica LUN list is modified to the primary state.

2. The method of claim 1, wherein, The method further includes: When the primary state of the next replica LUN of the target LUN in the current replica LUN list is modified to the primary state, if the target LUN is the last LUN in the current replica LUN list, the primary state of a first replica LUN in the current replica LUN list is modified to the primary state.

3. The method of claim 1, wherein, The replica serial number of the target LUN is obtained from the current replica LUN list on the premise that a state of the difference bitmap of the source LUN is valid, and the method further includes: If the state of the difference bitmap of the source LUN is invalid, the data of the source LUN is full-quantity copied to the target LUN, and the state of the difference bitmap saved on the target LUN is modified to invalid.

4. The method of claim 3, wherein, The merging of the difference bitmap of the source LUN and the difference bitmap saved on each associated LUN of the target LUN is performed on the premise that the state of the difference bitmap saved on each associated LUN of the target LUN is valid, and the method further comprises: If it is learned that the state of the difference bitmap saved on 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 full-quantity data of the source LUN is copied to the target LUN.

5. The method of claim 1, wherein, The method further comprises: When receiving a removal instruction, if there are at least two copy LUNs in the current copy LUN list, obtaining the copy serial number and the available state of a first copy LUN from the current copy LUN list; the removal instruction is used to indicate that the first copy LUN is removed from the current copy LUN list, and the first copy LUN is any copy LUN in the current copy 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 the minimum value among the copy serial numbers recorded in the current copy LUN list and not the first value, the first copy LUN is deleted from the current copy LUN list; After deleting the first copy LUN, if the available state of the first copy LUN is the master state, and the first copy LUN is not the last copy LUN in the current copy LUN list, the available state of the next copy LUN of the first copy LUN in the current copy LUN list is modified to the master state; and if the first copy 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 modified to the master state.

6. The method of claim 5, wherein, The method further comprises: If the copy serial number of the first copy LUN is not the minimum value among the copy serial numbers recorded in the current copy LUN list and not the first value, then: A second copy LUN is found from the current copy LUN list; the second copy LUN is a copy LUN whose copy serial number is not the first value and is smaller than the copy serial number of the first copy LUN; The difference bitmap saved by the first copy LUN is sent 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; The first copy LUN is deleted from the current copy LUN list.

7. The method of claim 6, wherein, The sending of the difference bitmap saved by the first copy LUN to the second copy LUN is performed on the premise that the state of the difference bitmap saved by the first copy LUN is valid, and the method further comprises: If the state of the difference bitmap stored in the first copy LUN is invalid, the second copy LUN is informed to modify the state of the difference bitmap stored in the second copy LUN to invalid.

8. The method of claim 1, wherein, The method further comprises: When receiving an adding instruction, the adding instruction is used to indicate adding a third copy LUN in a current copy LUN list; When adding the third copy LUN in the current copy LUN list, if there is no copy LUN in the current copy LUN list, the third copy LUN is added in the current copy LUN list, the available state of the third copy LUN is set to a primary state, and the copy serial number of the third copy LUN is set to a first value; If there is a copy LUN in the current copy LUN list, the third copy LUN is added at the end of the current copy LUN list, the available state of the third copy LUN is set to a standby state, and the copy serial number of the third copy LUN is set to the first value.

9. The method of claim 8, wherein, The method further comprises: When adding the third copy LUN in the current copy LUN list, if there are at least two copy LUNs in the current copy LUN list, it is determined whether there is a copy LUN with the available state of the standby state and the copy serial number of the first value in the current copy LUN list, if there is, the first copy LUN with the copy serial number of the first value is taken as a fourth copy LUN, if not, it is determined whether there is a copy LUN with the available state of the standby state and the copy serial number of the first value in the current copy LUN list, if there is, the first copy LUN with the copy serial number of the first value is taken as a fourth copy LUN, if not, it is determined whether there is a copy LUN with the available state of the standby state and the copy serial number of the first value in the current copy LUN list, if there is, the first copy LUN with the copy serial number of the first value is taken as a fourth copy LUN, if not, it is determined whether there is a copy LUN with the available state of the standby state and the copy serial number of the first value in the current copy LUN list, if there is, the first copy LUN with the copy serial number of the first value is taken as a fourth copy LUN, if not, it is determined whether there is a copy LUN with the available state of the standby state and the copy serial number of the first value in the current copy LUN list, if there is, the first copy LUN with the copy serial number of the first value is taken as a fourth copy LUN, if not, it is determined whether there is a copy LUN with the available state of the standby state and the copy serial number of the first value in the current copy LUN list, if there is, the first copy LUN with the copy serial number of the first value is taken as a fourth copy LUN, if not, it is determined whether there is a copy LUN with the available state of the standby state and the copy serial number of the first value in the current copy LUN list, if there is, the first copy LUN with the copy serial number of the first value is taken as a fourth copy LUN, if not, it is determined whether there is a copy LUN with the available state of the standby state and the copy serial number of the first value in the current copy LUN list, if there is, the first copy LUN with the copy serial number of the first value is taken as a fourth copy LUN, if not, it is determined whether there is a copy LUN with the available state of the standby state and the copy serial number of the first value in the current copy LUN list, if there is, the first copy LUN with the copy serial number of the first value is taken as a fourth copy LUN, if not, it is determined whether there is a copy LUN with the available state of the standby state and the copy serial number of the first value in the current copy LUN list, if there is, the first copy LUN with the copy serial number of the first value is taken as a fourth copy LUN, if not, it is determined whether there is a copy LUN with the available state of the standby state and the copy serial number of the first value in the current copy LUN list, if there is, the first copy LUN with the copy serial number of the first value is taken as a fourth copy LUN, if not, it is determined whether there is a copy LUN with the available state of the standby state and the copy serial number of the first value in the current copy LUN list, if there is, the first copy LUN with the copy serial number of the first value is taken as a fourth copy LUN, if not, it is determined whether there is a copy LUN with the available state of the standby state and the copy serial number of the first value in the current copy LUN list, if there is, the first copy LUN with the copy serial number of the first value is taken as a fourth copy LUN, if not, it is determined whether there is a copy LUN with the available state of the standby state and the copy serial number of the first value in the current copy LUN list, if there is, the first copy LUN with the copy serial number of the first value is taken as a fourth copy LUN, if not, it is determined whether there is a copy LUN with the available state of the standby state and the copy serial number of the first value in the current copy LUN list, if there is, the first copy LUN with the copy serial number of the first value is taken as a fourth copy LUN, if not, it is determined whether there is a copy LUN with the available state of the standby state and the copy serial number of the first value in the current copy LUN list, if there is, the first copy LUN with the copy serial number of the first value is taken as a fourth copy LUN, if not, it is determined whether there is a copy LUN with the available state of the standby state and the copy serial number of the first value in the current copy LUN list, if there is, the first copy LUN with the copy serial number of the first value is taken as a fourth copy LUN, if not, it is determined whether there is a copy LUN with the available state of the standby state and the copy serial number of the first value in the current copy LUN list, if there is, the first copy LUN with the copy serial number of the first value is taken as a fourth copy LUN, if not, it is determined whether there is a copy LUN with the available state of the standby state and the copy serial number of the first value in the current copy LUN list, if there is, the first copy LUN with the copy serial number of the first value is taken as a fourth copy LUN, if not, it is determined whether there is a copy LUN with the available state of the standby state and the copy serial number of the first value in the current copy LUN list, if there is, the first copy LUN with the copy serial number of the first value is taken as a fourth copy LUN, if not, it is determined whether there is a copy LUN with the available state of the standby state and the copy serial number of the first value in the current copy LUN list, if there is, the first copy LUN with the copy serial number of the first value is taken as a fourth copy LUN, if not, it is determined whether there is a copy LUN with the available state of the standby state and the copy serial number of the first value in the current copy LUN list, if there is, the first copy LUN with the copy serial number of the first value is taken as a fourth copy LUN, if not, it is determined whether there is a copy LUN with the available state of the standby state and the copy serial number of the first value in the current copy LUN list, if there is, the first copy LUN with the copy serial number of the first value is taken as a fourth copy LUN, if not, it is determined whether there is a copy LUN with the available state of the standby state and the copy serial number of the first value in the current copy LUN list, if there is, the first copy LUN with the copy serial number of the first value is taken as a fourth copy LUN, if not, it is determined whether there is a copy LUN with the available state of the standby state and the copy serial number of the first value in the current copy LUN list, if there is, the first copy LUN with the copy serial number of the first value is taken as a fourth copy LUN, if not, it is determined whether there is a copy LUN with the available state of the standby state and the copy serial number of the first value in the current copy LUN list, if there is, the first copy LUN with the copy serial number of the first value is taken as a fourth copy LUN, if not, it is determined whether there is a copy LUN with the available state of the standby state and the copy serial number of the first value in the current copy LUN list, if there is, the first copy LUN with the copy serial number of the first value is taken as a fourth copy LUN, if not, it is determined whether there is a copy LUN with the available state of the standby state and the copy serial number of the first value in the current copy LUN list, ​ ​ 10. A storage device data protection apparatus, comprising: ​ ​ obtain a copy serial number of the target LUN from a current copy LUN list; the copy serial number of any copy LUN in the current copy LUN list being a first value indicates that the copy LUN has not been replicated, and the copy serial number of any copy LUN not being the first value indicates that the copy LUN has performed a most recent replication in a sequence of all replications performed by all copy LUNs; the replication module is configured to, if the copy serial number of the target LUN is the first value, send a difference bitmap of the source LUN to the target LUN, so that the target LUN saves the received difference bitmap and performs full-volume replication of data of the source LUN to the target LUN; the difference bitmap of the source LUN being used to record a latest data increment of the source LUN; if the copy serial number of the target LUN is not the first value, send the difference bitmap of the source LUN 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, merge the difference bitmap of the source LUN and difference bitmaps saved by associated LUNs of the target LUN, and synchronize the incremental data in the source LUN to the target LUN based on the merged difference bitmaps; the associated LUNs of the target LUN being each copy LUN in the current copy LUN list except the target LUN and having a copy serial number not being the first value; the state modification module is configured to modify an available state of the target LUN in the current copy LUN list to a standby state, modify the copy serial number of the target LUN to M+K, M being a maximum copy serial number in the current copy LUN list, and K being greater than or equal to 1, and modify an available state of a next copy LUN of the target LUN in the current copy LUN list to a primary state.

11. The apparatus of claim 10, wherein, The replication module is further configured to: when the available state of the next copy LUN of the target LUN in the current copy LUN list is modified to the primary state, if the target LUN is the last LUN in the current copy LUN list, modify an available state of a first copy LUN in the current copy LUN list to the primary state.

12. The apparatus of claim 10, wherein, The copy serial number of the target LUN obtained from the current copy LUN list is performed on the premise that a state of the difference bitmap of the source LUN is valid, and the replication module is further configured to: if the state of the difference bitmap of the source LUN is invalid, perform full-volume replication of data of the source LUN to the target LUN, and notify the target LUN so that the state of the saved difference bitmap of the target LUN is modified to invalid.

13. The apparatus of claim 12, wherein, The merging of the difference bitmap of the source LUN and the difference bitmaps saved by the associated LUNs of the target LUN is performed on the premise that the state of the difference bitmap saved by each associated LUN of the target LUN is valid, and the replication module is further configured to: If it is learned that the state of the difference bitmap saved by 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 the full volume of data of the source LUN is copied to the target LUN.

14. The apparatus of claim 10, wherein, The device further comprises: The removing module is configured to, when receiving a removing instruction, obtaining the copy serial number and the available state of a first copy LUN from the current copy LUN list if there are at least two copy LUNs in the current copy LUN list, wherein the removing instruction is used to indicate that the first copy LUN is removed from the current copy LUN list, and the first copy LUN is 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 minimum value among the copy serial numbers recorded in the current copy LUN list and not the first value, the first copy LUN is deleted from the current copy LUN list; After the first copy LUN is deleted, if the available state of the first copy LUN is the master state, the available state of a next copy LUN of the first copy LUN in the current copy LUN list is modified to the master state if the first copy LUN is not the last copy LUN in the current copy LUN list, or the available state of the first copy LUN in the current copy LUN list is modified to the master state if the first copy LUN is the last copy LUN in the current copy LUN list.

15. The apparatus of claim 14, wherein, The removing module is further configured to: If the copy serial number of the first copy LUN is not the minimum value among the copy serial numbers recorded in the current copy LUN list and not the first value, the removing module is further configured to: find a second copy LUN from the current copy LUN list, wherein the second copy LUN is a copy LUN whose copy serial number is not the first value and is smaller than the copy serial number of the first copy LUN; 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; delete the first copy LUN from the current copy LUN list.

16. The apparatus of claim 15, wherein, The sending of the difference bitmap saved by the first copy LUN to the second copy LUN is performed on the premise that the state of the difference bitmap saved by the first copy LUN is valid, and the removing module is specifically further configured to: If the state of the difference bitmap saved by the first copy LUN is invalid, the removing module is further configured to notify the second copy LUN so that the state of the difference bitmap saved on the second copy LUN is modified to invalid.

17. The apparatus of claim 10, wherein, The device further comprises an adding module configured to, when receiving an adding instruction, add a third copy LUN in the current copy LUN list, wherein the adding instruction is used to indicate that the third copy LUN is added in the current copy LUN list. When the third copy LUN is added in the current copy LUN list, if there is no copy LUN in the current copy LUN list, the third copy LUN is added in the current copy LUN list, the available state of the third copy LUN is set as the primary state, and the copy serial number of the third copy LUN is set as the first value; If there is a copy LUN in the current copy LUN list, the third copy LUN is added at the end of the current copy LUN list, the available state of the third copy LUN is set as the standby state, and the copy serial number of the third copy LUN is set as the first value.

18. The apparatus of claim 17, wherein, The adding module is further used for: When the third copy LUN is added in the current copy LUN list, if there are at least two copy LUNs in the current copy LUN list, it is judged whether there is a copy LUN with the standby state and the first value in the current copy LUN list, if there is, the first copy LUN with the first value is taken as the fourth copy LUN, and if not, then: From each copy LUN with the standby state in the current copy LUN list, a copy LUN corresponding to the smallest copy serial number in the current copy LUN list is found, and the found copy LUN is taken as the fourth copy 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 as the standby state, and the copy serial number of the third copy LUN is set as the first value.

19. An electronic device, comprising: The electronic device comprises: a processor; and a computer readable storage medium having stored therein computer program instructions, which, when executed by the processor, cause the processor to perform the steps of the method of any one of claims 1 to 9.

20. A computer-readable storage medium, characterized in that, The computer readable storage medium has stored thereon computer program instructions, which, when executed by a processor, cause the processor to perform the steps of the method of any one of claims 1 to 9.

Citation Information

Patent Citations

  • Method and device for asynchronously copying data

    CN112632188A

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

    CN116601610A