Data backup method and computer equipment

By building a bitmap to determine the location of the differential data in the storage device, the compatibility problem of the CBT backup framework and the SPDK protocol is solved, and data backup in high-performance storage devices is realized.

CN120469854APending Publication Date: 2025-08-12XFUSION DIGITAL TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510345052.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-21
Publication Date
2025-08-12

AI Technical Summary

Technical Problem

The existing CBT backup framework is incompatible with the high-performance SPDK protocol, resulting in the inability to recognize changes in data blocks in the storage device and the inability to perform effective data backup.

Method used

By obtaining the storage information of the difference data in the storage device, a bitmap is constructed, the target position in the bitmap is determined, and the difference data is indicated, thereby realizing data backup.

Benefits of technology

It realizes data backup through CBT in storage devices that support SPDK protocol, avoids changes in the reading and writing process of storage devices, and is suitable for any storage device.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120469854A_ABST
    Figure CN120469854A_ABST
Patent Text Reader

Abstract

The invention discloses a data backup method and computer equipment, relates to the technical field of data backup, and is used for backing up data in the equipment through a backup device based on block change tracking (CBT). The method comprises the steps of obtaining storage information of to-be-backed-up differential data in a first storage device, wherein the differential data comprises data updated in a target time period; according to storage information of the differential data in the first storage device, determining a bitmap, so that a target position in the bitmap indicates the differential data; and backing up the data indicated by the target position in the bitmap to the second storage device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of data backup, and in particular to a data backup method and computer equipment. Background Art

[0002] Some storage devices are divided into multiple data blocks, each of which corresponds to a Dirty identifier. When data is written to the storage device, the Dirty identifier corresponding to the data block where the data has changed will be set to 1. When backing up the data in the storage device through the CBT backup framework, the value of the Dirty identifier corresponding to each data block can be read to determine the data block where the data has changed, and then back up these data blocks where the data has changed.

[0003] The high-performance SPDK protocol is currently used in related technologies. The Dirty identifier value processing process is no longer performed when data is written, which reduces the processing steps of the data writing process and improves the speed of data writing.

[0004] However, since the dirty identifier values corresponding to each data block cannot be read, it is impossible to identify which data block has changed data. Therefore, the data on the storage device cannot be backed up using the CBT backup framework. This shows that the current CBT backup framework is incompatible with the SPDK protocol in terms of data backup process. Summary of the Invention

[0005] The present application provides a data backup method and a computer device for backing up data in a device through a backup device based on block change tracking (CBT).

[0006] To achieve the above technical objectives, this application adopts the following technical solutions:

[0007] In a first aspect, an embodiment of the present application provides a data backup method, the method comprising:

[0008] Acquire storage information of differential data to be backed up in the first storage device in the first storage device, where the differential data includes data updated within a target time period;

[0009] Determining a bitmap based on storage information of the differential data in the first storage device so that a target position in the bitmap indicates the differential data;

[0010] The data indicated by the target position in the bitmap is backed up to the second storage device.

[0011] The technical solution provided by the present application brings at least the following beneficial effects: it is only necessary to obtain the storage information of the differential data to be backed up in the first storage device in the first storage device, the differential data includes data updated within the target time period, and according to the mapping relationship between the storage information in the first storage device and the position in the bitmap, the storage information of the differential data in the first storage device is mapped to the target position in the bitmap, and then, according to the bitmap and the mapping relationship, it is possible to know which positions of the data in the storage device have changed, thereby realizing data backup through CBT. The data backup method provided by the present application does not change the IO process in the storage device, nor does it require the configuration of the Dirty identifier. For any storage device, the data backup method provided by the present application can be applied to map the storage information of the data that has changed in the storage device to the target position in the bitmap, and then the data backup process can be performed through a backup device based on CBT.

[0012] In one possible implementation, the data in the first storage device includes multiple first data blocks, and the first granularity represents the size of a first data block; a position in the bitmap is used to record whether a second data block has changed, and the second granularity represents the size of a second data block; based on the storage information of the differential data in the first storage device, the bitmap is determined, including: based on the first granularity and the second granularity, mapping the storage information of the differential data in the first storage device to the target position in the bitmap.

[0013] In one possible implementation, the storage information of the differential data includes at least one address segment; the differential data is contained in at least one first data block; different address segments are used to indicate different first data blocks, the starting position of the address segment is the starting byte of the first data block indicated by the address segment, and the ending position of the address segment is the ending byte of the first data block indicated by the address segment; if the first granularity is equal to the second granularity, or the first granularity is smaller than the second granularity and can be divided by the first granularity, the storage information of the differential data in the first storage device is mapped to the target position in the bitmap according to the first granularity and the second granularity, including: for each address segment, according to the second granularity and the starting position, determining the starting bit position of the second data block to which the starting byte belongs in the bitmap; and / or, according to the second granularity and the ending position, determining the ending bit position of the second data block to which the ending byte belongs in the bitmap; wherein the target position includes the starting bit position, the ending bit position, and the bit position between the starting bit position and the ending bit position; the second granularity represents the size of a second data block.

[0014] In one possible implementation, if the first granularity is larger than the second granularity, or the first granularity is smaller than the second granularity and cannot be divided evenly by the first granularity, the storage information of the differential data in the first storage device is mapped to the target position in the bitmap according to the first granularity and the second granularity, including: for each address segment, determining the corresponding starting bit position of the second data block to which the starting byte belongs in the bitmap according to the second granularity and the starting position; determining the corresponding ending bit position of the second data block to which the ending byte belongs in the bitmap according to the second granularity and the ending position; wherein the target position includes the starting bit position, the ending bit position, and the bit position between the starting bit position and the ending bit position; the second granularity represents the size of a second data block.

[0015] In one possible implementation, determining the starting bit position in the bitmap corresponding to the second data block to which the starting byte belongs based on the second granularity and the starting position includes: determining a first ratio between the starting position and the second granularity; determining a first numerical value based on the first ratio, the first numerical value being a maximum integer not exceeding the first ratio; and determining the first numerical value as the starting bit position in the bitmap corresponding to the second data block to which the starting byte belongs.

[0016] In one possible implementation, determining the end bit corresponding to the second data block to which the end byte belongs in the bitmap based on the second granularity and the end position includes: determining a second ratio between the end position and the second granularity; determining a second numerical value based on the second ratio, the second numerical value being a maximum integer not exceeding the second ratio; and determining the second numerical value as the end bit corresponding to the second data block to which the end byte belongs in the bitmap.

[0017] In one possible implementation, the first storage device is a Ceph distributed storage system; obtaining storage information of differential data to be backed up in the first storage device in the first storage device includes: obtaining a snapshot of the Ceph distributed storage system at a current moment and a snapshot at a last backup moment; using the RBD diff command in the Ceph distributed storage system, comparing the snapshot at the current moment and the snapshot at the last backup moment to obtain storage information of the differential data to be backed up in the Ceph distributed storage system in the Ceph distributed storage system.

[0018] In one possible implementation, the target position in the bitmap is set to a first value, and other positions in the bitmap except the target position are set to a second value. The first value is used to indicate that the data indicated by the target position has been updated, and the second value is used to indicate that the data indicated by the position has not been updated.

[0019] In a possible implementation, the target time period is the time period between the last backup time and the current backup time.

[0020] In a second aspect, the present application provides a data backup device, comprising:

[0021] An acquisition module, configured to acquire storage information of differential data to be backed up in the first storage device in the first storage device, the differential data including data updated within a target time period;

[0022] a processing module, configured to determine a bitmap based on storage information of the differential data in the first storage device, so that a target position in the bitmap indicates the differential data;

[0023] The processing module is further configured to back up the data indicated by the target position in the bitmap to a second storage device.

[0024] In one possible implementation, the data in the first storage device includes multiple first data blocks, and the first granularity represents the size of a first data block; a position in the bitmap is used to record whether a second data block has changed, and the second granularity represents the size of a second data block; the processing module is specifically used to map the storage information of the differential data in the first storage device to the target position in the bitmap based on the first granularity and the second granularity.

[0025] In one possible implementation, the storage information of the differential data includes at least one address segment; the differential data is contained in at least one first data block; different address segments are used to indicate different first data blocks, the starting position of the address segment is the starting byte of the first data block indicated by the address segment, and the ending position of the address segment is the ending byte of the first data block indicated by the address segment; if the first granularity is equal to the second granularity, or the first granularity is smaller than the second granularity and can be divided by the first granularity, the processing module is specifically used to: for each address segment, determine the corresponding starting bit position of the second data block to which the starting byte belongs in the bitmap according to the second granularity and the starting position; and / or, determine the corresponding ending bit position of the second data block to which the ending byte belongs in the bitmap according to the second granularity and the ending position; wherein the target position includes the starting bit position, the ending bit position, and the bit position between the starting bit position and the ending bit position; the second granularity represents the size of a second data block.

[0026] In one possible implementation, if the first granularity is greater than the second granularity, or the first granularity is smaller than the second granularity and cannot be divided by the first granularity, the processing module is specifically used to: for each address segment, determine the starting bit position corresponding to the second data block to which the starting byte belongs in the bitmap according to the second granularity and the starting position; determine the ending bit position corresponding to the second data block to which the ending byte belongs in the bitmap according to the second granularity and the ending position; wherein the target position includes the starting bit position, the ending bit position, and the bit position between the starting bit position and the ending bit position; the second granularity represents the size of a second data block.

[0027] In one possible implementation, the processing module is specifically used to: determine a first ratio between the starting position and the second granularity; determine a first numerical value based on the first ratio, where the first numerical value is a maximum integer that does not exceed the first ratio; and determine the first numerical value as the starting bit corresponding to the second data block to which the starting byte belongs in the bitmap.

[0028] In one possible implementation, the processing module is specifically used to: determine a second ratio between the end position and the second granularity; determine a second value based on the second ratio, where the second value is a maximum integer that does not exceed the second ratio; and determine the second value as the end bit corresponding to the second data block to which the end byte belongs in the bitmap.

[0029] In one possible implementation, the first storage device is a Ceph distributed storage system; the acquisition module is specifically used to obtain a snapshot of the Ceph distributed storage system at the current moment and a snapshot at the last backup moment; the processing module is also used to compare the snapshot at the current moment and the snapshot at the last backup moment through the RBD diff command in the Ceph distributed storage system to obtain storage information of the differential data to be backed up in the Ceph distributed storage system in the Ceph distributed storage system.

[0030] In one possible implementation, the target position in the bitmap is set to a first value, and other positions in the bitmap except the target position are set to a second value. The first value is used to indicate that the data indicated by the target position has been updated, and the second value is used to indicate that the data indicated by the position has not been updated.

[0031] In a possible implementation, the target time period is the time period between the last backup time and the current backup time.

[0032] In a third aspect, the present application provides a data backup system, comprising: a first storage device, a backup apparatus, and a second storage device;

[0033] A first storage device, configured to store data;

[0034] A backup device, configured to back up the data stored in the first storage device to the second storage device through CBT;

[0035] The second storage device is used to receive data sent by the backup apparatus to implement backup storage of the data stored in the first storage device.

[0036] In a fourth aspect, the present application provides a computer device comprising a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement any one of the data backup methods provided in the first aspect.

[0037] In a fifth aspect, the present application provides a computer-readable storage medium having computer instructions stored thereon, which, when executed by a processor, implement any one of the data backup methods provided in the first aspect above.

[0038] In a sixth aspect, the present application provides a computer program product, comprising computer instructions, which, when executed by a processor, implement any one of the data backup methods provided in the first aspect above.

[0039] For the specific descriptions of the second to sixth aspects and their various implementations in this application, reference can be made to the detailed descriptions in the first aspect and its various implementations; and for the beneficial effects of the second to sixth aspects and their various implementations, reference can be made to the analysis of the beneficial effects in the first aspect and its various implementations, which will not be repeated here.

[0040] These and other aspects of the present application will become more readily apparent from the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] Figure 1 A schematic diagram of a data storage scenario applicable to a data backup method provided in an embodiment of the present application;

[0042] Figure 2 A schematic diagram of the structure of a data backup system applicable to a data backup method provided in an embodiment of the present application;

[0043] Figure 3 A schematic diagram of the hardware structure of a backup device provided in an embodiment of the present application;

[0044] Figure 4 A flowchart of a data backup method provided in an embodiment of the present application;

[0045] Figure 5 A schematic diagram of an application scenario of a data backup method provided in an embodiment of the present application;

[0046] Figure 6 A bitmap determination logic diagram provided in an embodiment of the present application;

[0047] Figure 7 A schematic diagram of the structure of a data backup device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0048] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0049] It should be noted that, in the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design scheme described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or design schemes. To be precise, the use of words such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete way. The terms "first" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the present application, unless otherwise specified, "multiple" means two or more.

[0050] Ceph is a high-performance, highly reliable, and scalable distributed storage system that supports block storage, object storage, and file storage.

[0051] Ceph's block storage provides RBD (RADOS Block Device) volumes (accessed via the RBD protocol), supporting capacity expansion, thin provisioning, snapshots, and cloning. RBD volumes can be accessed through the Linux kernel's RBD driver and the Qemu / KVM virtual machine RBD storage driver, and the RBD driver has been merged into the Linux mainline code.

[0052] Storage Performance Development Kit (SPDK), SPDK is a high-performance solution that provides high-performance and scalable solutions for user-mode storage applications.

[0053] Changing block tracing (CBT) records block data changes in virtual machine snapshots. During backups, only changed blocks are backed up, improving backup times. During restores, only changed blocks are restored, improving recovery times.

[0054] The CBT backup framework can perform CBT backup on various storages mounted on virtual machines, including Ceph's RBD volumes, virtualized storage VIMS, volumes used for virtualization after access through protocols such as ISCSI and NFS, and local volumes.

[0055] The above are the technical terms involved in this application and will not be repeated below.

[0056] Some storage devices are divided into multiple data blocks, each of which corresponds to a Dirty identifier. When data is written to the storage device, the Dirty identifier corresponding to the data block where the data has changed will be set to 1. When backing up the data in the storage device through the CBT backup framework, the value of the Dirty identifier corresponding to each data block can be read to determine the data block where the data has changed, and then back up these data blocks where the data has changed.

[0057] For example, if the storage device is a Ceph storage cluster, the traditional Qemu IO write process needs to go through the guest's kernel IO stack: the user initiates an IO write operation in the user space (UserSpace) of the Guest OS → the VirtIO driver (Driver) puts the IO operation into the shared memory structure of the IO Ring (or VirtQueue) → triggers VM Exit → the Guest transfers control to the Host KVM (Kernel-based Virtual Machine) module → KVM passes the IO operation to Qemu VirtIO → Qemu VirtIO processes the IO operation into a format understandable to the Host and uses the IO Ring again → Qemu VirtIO passes the processed IO operation to libRBD → libRBD receives the IO operation and writes the IO operation to the underlying Ceph storage.

[0058] Based on this, in the process of backing up the Ceph storage cluster through the CBT framework: ① When new data is written, Qemu marks the data as Dirty (Qemu marks Dirty after the VirtQueue queue); ② When taking a snapshot, the Bitmap data currently set to Dirty is saved; ③ According to the snapshot ID, the Bitmap of the newly added differential data is obtained (according to Dirty). The differential data obtained during the first backup can be all the data; ④ The differential data is obtained according to the Bitmap for backup.

[0059] This backup method relies on Qemu to set the data to Dirty. Once the data cannot be set to Dirty, there is no way to back up the data in the storage device through the CBT backup framework.

[0060] Current technologies utilize the high-performance SPDK protocol, which eliminates the need to process dirty identifier values when writing data. This reduces the number of steps required to write data and increases the speed of data writing. Consequently, the dirty identifier values corresponding to each data block cannot be read, making it impossible to identify which data block has changed, and data on the storage device cannot be backed up using the CBT backup framework.

[0061] For example, Figure 1 As shown, using the high-performance SPDK protocol, Qemu's IO call stack is as follows: Guest OS User Space IO → VirtIO Driver → IO Ring (VirtIO Queue shared memory) → vhost (Virtual Host) polling mechanism → libRBD. Compared to the aforementioned IO call stack, the IO process bypasses the VirtIO Device module after VirtIO Queue and no longer performs dirty processing. This makes it impossible to identify which data is about to be written, and prevents data backup to storage devices through the CBT framework.

[0062] Therefore, a data backup method for backing up data in a storage device through CBT backup and supporting the SPDK protocol is needed.

[0063] In this regard, the present application provides a data backup method, which only needs to obtain the storage information of the differential data to be backed up in the first storage device in the first storage device. The differential data includes data updated within the target time period. A bitmap can be determined based on the storage information in the first storage device. The target position in the bitmap can indicate the differential data. The backup device can know which positions in the storage device have changed the data, thereby backing up the updated data in the first storage device indicated by the target position in the bitmap to the second storage device through CBT. The data backup method provided by the present application does not change the reading and writing process of the data in the storage device, nor does it require the configuration of the Dirty identifier. The data backup method provided by the present application can be applied to any storage device. By constructing a bitmap, the target position in the bitmap can index the differential data, and then the data backup process can be performed through CBT in the storage device that supports the SPDK protocol.

[0064] Figure 2 The data backup system to which the data backup method provided by this application is applicable is shown. Figure 2 As shown, the data backup system 1 includes: a first storage device 10 , a backup apparatus 20 and a second storage device 30 .

[0065] The backup device 20 establishes communication connections with the first storage device 10 and the second storage device 30, respectively. It should be understood that the connection method may also be a wired connection, such as an optical fiber connection, and is not limited to this. For example, the first storage device 10, the backup device 20, or the second storage device 30 may be interconnected via a network transmission device.

[0066] In some embodiments, the first storage device 10 and the second storage device 30 are both used to store data. Taking the data storage process of the first storage device 10 as an example, the data stored in the first storage device 10 may be Figure 1 The content involved.

[0067] In some embodiments, the backup device 20 is used to store the data stored in the first storage device 10 into the second storage device 30 through CBT, and the second storage device 30 is used to store backup data of the data in the first storage device 10 .

[0068] Specifically, the backup device 20 first obtains the storage information of the differential data to be backed up in the first storage device 10, and determines the bitmap based on the storage information of the differential data in the first storage device 10. The target position in the bitmap indicates the differential data. When backup is required, the backup device 20 can back up the data indicated by the target position in the bitmap to the second storage device 30.

[0069] A bitmap is a data structure comprising multiple bits. In this application, the number of bits in the bitmap should be greater than or equal to the number of second data blocks in the second storage device 30. Each bit in the bitmap corresponds to one second data block, and the order of the bits in the bitmap corresponds to the order of the second data blocks corresponding to the bits in the second storage device 30.

[0070] It should be understood that the second data block may not be the data block actually divided in the second storage device 30, and the size of the second data block can be understood as the reading granularity of the backup device 20, that is, when the backup device 20 stores the updated data in the first storage device 10 in the second storage device 30 through CBT, the data is read in units of the size of the second data block.

[0071] In some embodiments, the backup device 20 and the first storage device 10 may be as follows: Figure 2 As shown, there are two independent devices.

[0072] Optionally, the backup device 20 and the first storage device 10 may be integrated into the same device. For example, when the backup device 20 and the first storage device 10 are integrated into one device, the device may be a server or a server cluster, the backup device 20 may be the server's processor, and the first storage device 10 may be the server's disk.

[0073] In some embodiments, the backup device 20 and the second storage device 30 may be as follows: Figure 2 As shown, they are two independent devices, or the backup device 20 and the second storage device 30 can be integrated into the same device.

[0074] In some embodiments, the data backup system 1 may include one or more second storage devices 10 .

[0075] In some embodiments, the first storage device 10 can be any type of storage device, and the embodiments of the present application do not limit the specific form of the first storage device 10.

[0076] In some embodiments, the backup device 20 may also be a terminal device, such as a personal computer (PC), a notebook computer, a mobile device, a tablet computer, a laptop computer, etc. The embodiment of the present application does not limit the specific form of the backup device 20 .

[0077] The hardware structure of the backup device 20 includes Figure 3 The following is the components shown. Figure 3 Taking the backup device 20 as an example, the hardware structure is introduced.

[0078] like Figure 3 As shown, the backup device 20 may include a processor 201, a memory 202, a communication interface 203, and a bus 204. The processor 201, the memory 202, and the communication interface 203 may be connected via the bus 204.

[0079] Processor 201 is the control center of backup device 20 and can be a single processor or a collection of multiple processing elements. For example, processor 201 can be a general-purpose central processing unit (CPU) or other general-purpose processor. A general-purpose processor can be a microprocessor or any conventional processor.

[0080] As an embodiment, the processor 201 may include one or more CPUs, such as Figure 3 CPU 0 and CPU 1 are shown in Figure 1.

[0081] The memory 202 may be a read-only memory (ROM) or other type of static storage device that can store static information and instructions, a random access memory (RAM) or other type of dynamic storage device that can store information and instructions, an electrically erasable programmable read-only memory (EEPROM), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto.

[0082] In one possible implementation, the memory 202 may exist independently of the processor 201 and may be connected to the processor 201 via a bus 204 for storing instructions or program codes. When the processor 201 calls and executes the instructions or program codes stored in the memory 202, the data backup method provided in the embodiment of the present application can be implemented.

[0083] In another possible implementation, the memory 202 may also be integrated with the processor 201 .

[0084] When the backup device 20 backs up the data in the first storage device 10 to the second storage device 30 , specifically the processor 201 backs up the data in the first storage device 10 to the second storage device 30 , and the intermediate data generated during the data backup process can be stored in the memory 202 .

[0085] The communication interface 203 is used to connect the backup device 20 to other devices via a communication network, which can be Ethernet, a radio access network (RAN), a wireless local area network (WLAN), etc. The communication interface 203 can include a receiving unit for receiving data and a sending unit for sending data.

[0086] The bus 204 may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 3Only one thick line is used in the diagram, but this does not mean that there is only one bus or one type of bus.

[0087] It should be pointed out that Figure 3 The structure shown in the figure does not constitute a limitation on the backup device 20, except Figure 3 In addition to the components shown, the backup device 20 may include more or fewer components than shown, or combine certain components, or arrange the components differently.

[0088] The implementation of the embodiments of the present application will be described in detail below with reference to the accompanying drawings.

[0089] The data backup method provided in the embodiment of the present application can be executed by the backup device 20 in the data backup system 1.

[0090] like Figure 4 As shown, an embodiment of the present application provides a data backup method, which includes the following steps:

[0091] S101: Obtain storage information of differential data to be backed up in a first storage device in the first storage device.

[0092] The differential data includes the data updated within the target time period.

[0093] In some embodiments, the target time period is the time period between the last backup time and the current backup time. The backup time can be a non-fixed time selected by the user, or a periodic time pre-set by the user. For example, the user instructs the backup device to perform a data backup at 10:30, instructs the backup device to perform a data backup again at 14:20, and instructs the backup device to perform a data backup again at 18:50. If 14:20 is the current backup time, 10:30 is the last backup time; if 18:50 is the current backup time, 14:20 is the last backup time. For another example, the user pre-configures the backup device to back up every 8 hours. If the first data backup time is 12:10, the second data backup time is 20:10. If the current backup time is 20:10, the last data backup time is 12:10.

[0094] In some embodiments, step S101 can be specifically implemented as follows: obtaining a snapshot of the first storage device at the current moment, and a snapshot of the first storage device at the last backup moment, the snapshot being used to record the data stored by the device at a preset moment; comparing the snapshot at the current moment with the snapshot at the last backup moment to obtain storage information of the differential data to be backed up in the first storage device in the first storage device.

[0095] Data storage information represents the specific location of data within a storage device and can be specified and described in a variety of ways, such as file paths, connection strings, and memory addresses. A storage device snapshot is a data backup and recovery technology used to capture the data state of a storage device at a specific point in time, essentially creating a copy or mirror of the data so that it can be restored when needed. In practice, storage device snapshots can be obtained through methods such as copy-on-write (COW), mirror detachment, and logical volume management (LVM).

[0096] In a possible implementation, the offset and length of the object are usually used to represent the address segment of the differential data. Figure 5 As shown, if the starting byte of the first data block in the storage device is 0, then for any address segment of the differential data, the starting byte of the address segment is offset and the ending byte is (offset+length-1).

[0097] In some embodiments, the storage information of the differential data in the first storage device includes at least one address segment; for each address segment, the starting position and the ending position respectively indicate the starting byte (also called offset) and the ending byte (offset plus length) of a segment of differential data. For ease of distinction, the data blocks divided in the first storage device are referred to as first data blocks. The differential data is contained in at least one first data block; "contained in" can be understood as: the differential data is all or part of the data stored in the first data block. Different address segments are used to indicate different first data blocks, and the starting position of the address segment is the starting byte of the first data block indicated by the address segment.

[0098] For example, the first storage device is divided into 10 first data blocks, namely the 0th, 1st, 2nd, 3rd, 4th, 5th, 6th, 7th, 8th, and 9th first data blocks, where the data in the 0th, 1st, 4th, and 6th first data blocks have changed. If the size of each first data block is 1M (1048576 bytes), the differential data is divided into 4 segments, corresponding to the 0th, 1st, 4th, and 6th first data blocks. For example, the differential data in the 0th first data block is 32768 bytes, then the starting byte of the differential data in the first data block is 0, the starting byte of the 0th first data block, and the ending byte is (0+32768 bytes); for another example, the starting byte of the 1st first data block is 1048576 bytes, then the starting byte of the differential data in the 1st first data block is also 1048576 bytes.

[0099] Exemplarily, the first storage device is a Ceph distributed storage system. Comparing the snapshot at the current moment with the snapshot at the last backup moment, the storage information of the differential data to be backed up in the first storage device is obtained in the first storage device. This can be specifically implemented as follows: using the rbd diff command in the Ceph distributed storage system, comparing the snapshot at the current moment with the snapshot at the last backup moment, the storage information of the differential data to be backed up in the first storage device is obtained in the first storage device.

[0100] For example, the differential data obtained by using the rbd diff command in the Ceph distributed storage system can be as follows:

[0101]

[0102] The above results can be analyzed and the following Table 1 can be obtained:

[0103] Table 1 The address segments corresponding to the offset and length of each segment difference data

[0104] offset length Address segment offset~(offset+length-1) 0 32768 0~(32768–1) 1048576 131072 1048576~(1048576+131072-1) 2097152 1048576 2097152~(2097152+1048576-1) 3145728 1048576 3145728~(3145728+1048576-1) 4194304 1048576 4194304~(4194304+1048576-1) 5242880 1048576 5242880~(5242880+1048576-1) 8388608 131072 8388608~(8388608+131072-1)

[0105] As shown in Table 1 above, the data in the 0th, 1st, 2nd, 3rd, 4th, 5th, and 8th data blocks in the first storage device have been changed. The address segment of the differential data corresponding to the 0th first data block is 0 to (32768–1), the address segment of the differential data corresponding to the 1st first data block is 1048576 to (1048576+131072-1), the address segment of the differential data corresponding to the 2nd first data block is 2097152 to (2097152+1048576-1), and the address segment of the differential data corresponding to the 3rd first data block is 2097152 to (2097152+1048576-1). The address segment of the differential data is 3145728 to (3145728+1048576-1), the address segment of the differential data corresponding to the 4th first data block is 4194304 to (4194304+1048576-1), the address segment of the differential data corresponding to the 5th first data block is 5242880 to (5242880+1048576-1), and the address segment of the differential data corresponding to the 8th first data block is 8388608 to (8388608+131072-1).

[0106] By comparing two snapshots, the storage information of the changed differential data can be determined, and then in the subsequent process, data backup can be performed through CBT based on the storage information of the differential data.

[0107] S102: Determine a bitmap based on storage information of the differential data in the first storage device, so that a target position in the bitmap indicates the differential data.

[0108] The data in the first storage device includes multiple first data blocks, and the first granularity represents the size of a first data block; a position in the bitmap is used to record whether a second data block has changed, and the second granularity represents the size of a second data block. It should be understood that when the backup device backs up data through CBT, it reads data in units of the second granularity. A bitmap is a data structure including multiple bits. A bit in the bitmap corresponds to a second data block, and the position of the bit in the bitmap has a corresponding relationship with the first data block in the first storage device, so the value of the bit in the bitmap can indicate whether the data in the first data block corresponding to the position of the bit has been updated.

[0109] For example, the first storage device is a Ceph storage cluster, which is divided into 10 RBD volumes. One RBD volume is one first data block, and the size of each RBD volume is 1 megabyte, that is, the first granularity is 1M. There are three size relationships between the second granularity and the first granularity: ① The first granularity is equal to the second granularity; ② The first granularity is greater than the second granularity; ③ The first granularity is less than the third granularity. When the first granularity is equal to the second granularity, the backup device reads one first data block each time, and one position in the bitmap corresponds to one first data block. When the first granularity is equal to twice the second granularity, the backup device reads half of the first data block each time. The backup device needs to read twice to complete reading one first data block, so one first data block corresponds to two positions in the bitmap. When the first granularity is equal to half of the second granularity, the backup device can read two first data blocks at a time, and the two first data blocks correspond to one position in the bitmap.

[0110] In some embodiments, step S102 may be specifically implemented as: mapping storage information of the differential data in the first storage device to a target location in the bitmap according to the first granularity and the second granularity.

[0111] Based on the size relationship between the first and second granularities, a correspondence between first data blocks in the first storage device and positions in the bitmap can be determined. The backup device can then determine, based on this correspondence and the information stored in the first storage device regarding the differential data, which positions in the bitmap correspond to data changes. Based on the bitmap, the backup device can determine which first data blocks in the first storage device have data changes, and can then back up these first data blocks with data changes.

[0112] In some embodiments, after the backup device determines the target position, it sets the target position in the bitmap to the first value and sets the other positions in the bitmap except the target position to the second value. The first value is used to indicate that the data indicated by the target position has been updated, and the second value is used to indicate that the data indicated by the position has not been updated. For example, the first granularity is equal to the second granularity, the first value is 1, the second value is 0, and the bitmap is 100101 (reading order is from left to right), with a total of 6 bits, corresponding to the 6 first data blocks in the first storage device, respectively. 100101 (reading order is from left to right) means that the data in the 0th, 3rd, and 5th first data blocks have changed.

[0113] In some embodiments, the order in which bits are read in the bitmap can be configured by the user. For example, if the order in which bits are read in the bitmap is from left to right, the first bit on the left of the bitmap corresponds to the first data block 0 in the first storage device.

[0114] In some embodiments, mapping the storage information of the differential data in the first storage device to a target location in a bitmap based on the first granularity and the second granularity can be specifically implemented by: for each address segment, determining the starting bit position of the second data block to which the starting byte belongs in the bitmap based on the second granularity and the starting position. The target position includes the starting bit position, the ending bit position, and the bits between the starting bit position and the ending bit position; and the second granularity represents the size of a second data block.

[0115] As a possible implementation, determining the starting bit position in the bitmap corresponding to the second data block to which the starting byte belongs, based on the second granularity and the starting position, can be specifically implemented by: determining a first ratio between the starting position and the second granularity; determining a first value based on the first ratio, where the first value is a maximum integer that does not exceed the first ratio; and determining the first value as the starting bit position in the bitmap corresponding to the second data block to which the starting byte belongs. Determining the first ratio between the starting position and the second granularity is actually determining the quotient obtained by dividing the starting byte by the second granularity, that is, determining which second data block the starting position corresponds to.

[0116] In some embodiments, based on the first granularity and the second granularity, the storage information of the differential data in the first storage device is mapped to the target position in the bitmap, which can be specifically implemented as follows: for each address segment, based on the second granularity and the end position, the end bit corresponding to the second data block to which the end byte belongs in the bitmap is determined.

[0117] As a possible implementation, determining the end bit corresponding to the second data block to which the end byte belongs in the bitmap based on the second granularity and the end position can be specifically implemented by: determining a second ratio between the end position and the second granularity; determining a second value based on the second ratio, where the second value is a maximum integer that does not exceed the second ratio; and determining the second value as the end bit corresponding to the second data block to which the end byte belongs in the bitmap. Determining the second ratio between the end position and the second granularity is actually determining the quotient obtained by dividing the end byte by the second granularity, that is, determining which second data block the end position corresponds to.

[0118] In practical applications, there may be a case where the first granularity can be divided evenly by the second granularity, or there may be a case where the first granularity cannot be divided evenly by the second granularity.

[0119] For example, if the starting byte is 2097152 and the second granularity is 1048576 (Bytes), the quotient is 2. If the first granularity is 1048576 (Bytes), it means that the size of the first data block is equal to the size of the second data block, and one second data block corresponds to one position in the bitmap. Therefore, one first data block corresponds to one position in the bitmap. The first ratio of 2 obtained above represents the second bit, that is, the second bit corresponds to the third bit read sequentially in the bitmap (the starting byte of the storage information of the first storage device is 0, which corresponds to bit 0 in the bitmap, which is actually the first bit read sequentially in the bitmap).

[0120] Taking the address segment 3145728 to (3145728+1048576-1) as an example, if the first granularity is 1048576 (Byte) and the second granularity is also 1048576 (Byte), then according to the address segment 3145728 to (3145728+1048576-1), the first ratio can be obtained as 3. The second ratio is greater than 3 and less than 4. Then, the first value determined based on the first ratio is 3, and the second value determined based on the second ratio is 3. This means that the value of the third bit in the bitmap (actually the fourth bit read in sequence) should be set to the first value.

[0121] By determining the ratio between the starting byte or the ending byte and the second granularity, it is possible to determine how many second data blocks the first data block corresponds to, that is, to determine which bits in the bitmap correspond to which data in the first data block has changed. Ultimately, based on the bitmap, the first data blocks that need to be backed up can be determined, and then these first data blocks with data changes can be backed up.

[0122] Based on Table 1 above, if the size relationship between the first granularity and the second granularity is different, the resulting start bit and end bit will also be different. The following provides several specific examples of determining the start bit and / or end bit under different size relationships between the first granularity and the second granularity.

[0123] Specific example 1: the first particle size is equal to the second particle size.

[0124] Assuming that the first granularity is 1048576 (Byte) and the second granularity is also 1048576 (Byte), the following Table 2 can be obtained based on the above Table 1.

[0125] Table 2

[0126]

[0127]

[0128] Based on Table 2, it can be seen that if the values of bits 0, 1, 2, 3, 4, 5, and 8 in the bitmap are changed, the bitmap can be represented as 100111111 (bit 0 is on the rightmost side, and the reading order is from right to left).

[0129] It should be understood that when the 9th, 10th, 11th, and 12th bits are still in the bitmap, that is, when the data in other first data blocks have not changed, the bitmap can be expressed as 0000100111111.

[0130] In this case, the bitmap determination logic executed by the backup device can be referred to Figure 6 . Figure 6 In the example, all bits in the bitmap are initially 0, the first granularity is equal to the second granularity, all differential data segments are traversed, and the bit corresponding to the current differential data segment is calculated: offset ÷ second granularity (rounded down), and the value corresponding to the calculated bit is set to 1. It is determined whether all differential data segments have been traversed. If the traversal is not completed, the differential data segments are continued to be traversed. If the traversal is completed, the bitmap is obtained.

[0131] Specific example 2: the first particle size is larger than the second particle size.

[0132] Assuming that the first granularity is 1048576 (Byte) and the second granularity is also 524288 (Byte), a first data block can just include two second data blocks, then a first data block should correspond to two adjacent bits in the bitmap, and the start bit and end bit of each address segment can determine a bit interval, and the start value and end value of the interval can be equal. Based on the above Table 1, the following Table 3 can be obtained.

[0133] Table 3

[0134]

[0135] Based on Table 3, we can get the following bit intervals: [0, 0], [2, 2], [4, 5], [6, 7], [8, 9], [10, 11], [16, 16]. Based on these bit intervals, we can know that the 0th, 2nd, 4th, 5th, 6th, 7th, 8th, 9th, 10th, 11th, and 16th bits in the bitmap should be 1, and the other bits should be 0. Then the bitmap is 010000111111110101 (read from right to left).

[0136] If there are more bits in the bitmap, the values corresponding to the bits not reflected in the bit interval are all 0.

[0137] In this case, the bitmap determination logic executed by the backup device still refers to Figure 6 . Figure 6 In the example, all bits in the bitmap are initially 0, the first granularity is greater than the second granularity, all differential data segments are traversed, the starting bit corresponding to the current differential data segment is calculated: offset ÷ second granularity (rounded down), the ending bit corresponding to the current differential data segment is calculated: (offset + length - 1) ÷ second granularity (rounded down), the bit interval is determined based on the starting bit and the ending bit, and the bits in all bit intervals are traversed, and the value corresponding to the calculated bit is set to 1. Determine whether the bits in the bit interval have been traversed. If the bits in the bit interval have been traversed, the differential data segment is processed. If the bits in the bit interval have not been traversed, continue to traverse the bit interval. Determine whether all differential data segments have been traversed. If not, continue to traverse the differential data segments. If traversal is complete, a bitmap is obtained.

[0138] Specific example three: the first particle size is smaller than the second particle size.

[0139] Assuming that the first granularity is 1048576 (Byte) and the second granularity is also 2097152 (Byte), a first data block only includes half of the second data block, then the two first data blocks should correspond to one bit in the bitmap, and the start bit and end bit of each address segment can determine a bit interval. The start value and end value of the interval can be equal. Based on the above Table 1, the following Table 4 can be obtained.

[0140] Table 4

[0141]

[0142] Based on Table 4, we can get the following bit intervals: [0, 0], [1, 1], [2, 2], [4, 4]. Based on these bit intervals, we can know that the 0th, 1st, 2nd, and 4th bits in the bitmap should be 1, and the other bits should be 0, so the bitmap is 10111 (read from right to left).

[0143] In this case, multiple first data blocks correspond to one second data block. For any bit in the bitmap, if the data in any first data block among the multiple first data blocks corresponding to the bit is changed, the value corresponding to the bit will also change.

[0144] If there are more bits in the bitmap, the values corresponding to the bits not reflected in the bit interval are all 0.

[0145] In this case, the bitmap determination logic executed by the backup device is as follows: initially, all bits in the bitmap are 0, all differential data segments are traversed, the starting bit corresponding to the current differential data segment is calculated: offset ÷ second granularity (rounded down), the ending bit corresponding to the current differential data segment is calculated: (offset + length - 1) ÷ second granularity (rounded down), the bit interval is determined based on the starting bit and the ending bit, and the bits in all bit intervals are traversed, and the value corresponding to the calculated bit is set to 1. Determine whether the bits in the bit interval have been traversed. If the bits in the bit interval have been traversed, the differential data segment is processed. If the bits in the bit interval have not been traversed, continue to traverse the bit interval. Determine whether all differential data segments have been traversed. If not, continue to traverse the differential data segments. If traversal is complete, a bitmap is obtained.

[0146] In the case where the first granularity is smaller than the second granularity, if the first granularity can divide the second granularity, the above bitmap determination logic can be optimized, and only the starting bit corresponding to the difference data segment can be calculated, thus reducing the calculation process. The logic diagram of the optimized bitmap determination logic can be referred to Figure 6:Initially, all bits in the bitmap are 0, and the first granularity is smaller than the second granularity. First, determine whether the second granularity is divisible by the first granularity. If not, traverse all differential data segments, calculate the starting bit corresponding to the current differential data segment: offset ÷ second granularity (round down), calculate the ending bit corresponding to the current differential data segment: (offset + length - 1) ÷ second granularity (round down), determine the bit interval based on the starting bit and the ending bit, and traverse all the bits in the bit interval, and set the value corresponding to the calculated bit to 1. Determine whether the bits in the bit interval have been traversed. If the bits in the bit interval have been traversed, the differential data segment has been processed. If the bits in the bit interval have not been traversed, continue to traverse the bit interval. Determine whether all differential data segments have been traversed. If not, continue to traverse the differential data segments. If traversal is complete, a bitmap is obtained. If it is divisible, calculate the bit corresponding to the current differential data segment: offset ÷ second granularity (round down), set the value corresponding to the calculated bit to 1, and determine whether all differential data segments have been traversed. If the traversal is not completed, continue to traverse the differential data segments. If the traversal is completed, obtain the bitmap.

[0147] That is to say, if the first granularity is equal to the second granularity, or the first granularity is smaller than the second granularity and the second granularity is divisible by the first granularity, the backup device can determine the starting bit position corresponding to the second data block to which the starting byte belongs in the bitmap based only on the second granularity and the starting position, or determine the ending bit position corresponding to the second data block to which the ending byte belongs in the bitmap based only on the second granularity and the ending position, or perform these two steps simultaneously to determine the target position in the bitmap, and then determine the bitmap.

[0148] If the first granularity is larger than the second granularity, or the first granularity is smaller than the second granularity and the second granularity cannot be divided by the first granularity, the backup device needs to determine the starting bit corresponding to the second data block to which the starting byte belongs in the bitmap based on the second granularity and the starting position, and at the same time determine the ending bit corresponding to the second data block to which the ending byte belongs in the bitmap based on the second granularity and the ending position, so as to determine the target position in the bitmap and then determine the bitmap.

[0149] In summary, the processing flow in Example 1 and Example 3 when the second granularity is divisible by the first granularity is the same, and the processing flow in Example 2 and Example 3 when the second granularity is not divisible by the first granularity is the same. Figure 6 The bitmap determination logic shown may include the bitmap determination logic under various size relationships between the first granularity and the second granularity.

[0150] Figure 6The overall description of the bitmap determination logic is as follows: Initially, all bits in the bitmap are 0. First, determine whether the first granularity is equal to the second granularity. If they are equal, enter (1) traverse all differential data segments to calculate the starting bit corresponding to the current differential data segment: offset ÷ second granularity (round down), set the value corresponding to the calculated bit to 1, and determine whether all differential data segments have been traversed. If the traversal is not completed, continue to traverse the differential data segments. If the traversal is completed, the bitmap is obtained.

[0151] If the first granularity is not equal to the second granularity, continue to determine whether the first granularity is smaller than the second granularity. If so, determine whether the second granularity is divisible by the first granularity. If so, proceed to (1).

[0152] If the first granularity is not equal to the second granularity, the first granularity is smaller than the second granularity, and the second granularity cannot be divided by the first granularity, then enter (2) to traverse all differential data segments, calculate the starting bit corresponding to the current differential data segment: offset ÷ second granularity (round down), calculate the ending bit corresponding to the current differential data segment: (offset + length - 1) ÷ second granularity (round down), determine the bit interval based on the starting bit and the ending bit, and traverse all the bits in the bit interval, and set the value corresponding to the calculated bit to 1. Determine whether the bits in the bit interval have been traversed. If the bits in the bit interval have been traversed, the differential data segment is processed. If the bits in the bit interval have not been traversed, continue to traverse the bit interval. Determine whether all differential data segments have been traversed. If not, continue to traverse the differential data segments. If traversal is completed, a bitmap is obtained.

[0153] If the first particle size is not equal to the second particle size and the first particle size is larger than the second particle size, proceed to (2).

[0154] S103: Back up the data indicated by the target position in the bitmap to a second storage device.

[0155] For example, the first granularity is equal to the second granularity, and the bitmap is 100010 (read from left to right), indicating that the data in the 1st and 5th first data blocks in the first storage device have changed. During this backup, the backup device backs up the data in the 1st and 5th first data blocks to the second storage device.

[0156] For another example, the first granularity is equal to twice the second granularity, which means that 2 positions in the bitmap correspond to 1 first data block. If the bitmap is 100010 (read from left to right), it means that the data in the 1st and 3rd first data blocks have changed. During this backup, the backup device will back up the data in the 1st and 3rd first data blocks to the second storage device.

[0157] For another example, the first granularity is equal to half of the second granularity, which means that one position in the bitmap corresponds to two first data blocks. If the bitmap is 100010 (read from left to right), it means that the data in the 1st and 2nd first data blocks corresponding to the 0th bit in the bitmap have changed, and the data in the 9th and 10th first data blocks corresponding to the 4th bit in the bitmap have changed. During this backup, the backup device will back up the data in the 1st, 2nd, 9th and 10th first data blocks to the second storage device.

[0158] Figure 4 The technical solution shown brings at least the following beneficial effects: it is only necessary to obtain the storage information of the differential data to be backed up in the first storage device in the first storage device, the differential data including the data updated within the target time period, and map the storage information of the differential data in the first storage device to the target position in the bitmap according to the mapping relationship between the storage information in the storage device and the position in the bitmap. Then, based on the bitmap and the mapping relationship, it is possible to know which positions of the data in the storage device have changed, thereby realizing data backup through CBT. The data backup method provided in the present application does not change the IO process in the storage device, nor does it require the configuration of the Dirty identifier. For any storage device, the data backup method provided in the present application can be applied to map the storage information of the data that has changed in the storage device to the target position in the bitmap, and then the data backup process can be performed through a backup device based on CBT.

[0159] The above mainly introduces the solution provided by the embodiment of the present application from the perspective of the method. In order to realize the above functions, it includes hardware structures and / or software modules corresponding to the execution of each function. It should be easy to realize that the technical goals in this field are combined with the units and algorithm steps of each example described in the embodiments disclosed herein, and the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional technical goals can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0160] like Figure 7 As shown, the embodiment of the present application further provides a data backup device for executing the data backup method shown in the above method embodiment. The data backup device 400 includes: an acquisition module 401 and a processing module 402.

[0161] Among them, the acquisition module 401 is used to obtain the storage information of the differential data to be backed up in the first storage device in the first storage device, and the differential data includes data updated within the target time period; the processing module 402 is used to determine the bitmap based on the storage information of the differential data in the first storage device, so that the target position in the bitmap indicates the differential data; the processing module 402 is also used to back up the data indicated by the target position in the bitmap to the second storage device.

[0162] In one possible implementation, the data in the first storage device includes multiple first data blocks, and the first granularity represents the size of a first data block; a position in the bitmap is used to record whether a second data block has changed, and the second granularity represents the size of a second data block; the processing module 402 is specifically used to map the storage information of the differential data in the first storage device to the target position in the bitmap according to the first granularity and the second granularity.

[0163] In one possible implementation, the storage information of the differential data includes at least one address segment; the differential data is contained in at least one first data block; different address segments are used to indicate different first data blocks, the starting position of the address segment is the starting byte of the first data block indicated by the address segment, and the ending position of the address segment is the ending byte of the first data block indicated by the address segment; if the first granularity is equal to the second granularity, or the first granularity is smaller than the second granularity and can be divided by the first granularity, the processing module 402 is specifically used to: for each address segment, determine the starting bit position corresponding to the second data block to which the starting byte belongs in the bitmap according to the second granularity and the starting position; and / or, determine the ending bit position corresponding to the second data block to which the ending byte belongs in the bitmap according to the second granularity and the ending position; wherein the target position includes the starting bit position, the ending bit position, and the bit position between the starting bit position and the ending bit position; the second granularity represents the size of a second data block.

[0164] In one possible implementation, if the first granularity is greater than the second granularity, or the first granularity is smaller than the second granularity and cannot be divided by the first granularity, the processing module 402 is specifically used to: for each address segment, determine the starting bit position corresponding to the second data block to which the starting byte belongs in the bitmap according to the second granularity and the starting position; determine the ending bit position corresponding to the second data block to which the ending byte belongs in the bitmap according to the second granularity and the ending position; wherein the target position includes the starting bit position, the ending bit position, and the bit position between the starting bit position and the ending bit position; the second granularity represents the size of a second data block.

[0165] In one possible implementation, the processing module 402 is specifically used to: determine a first ratio between the starting position and the second granularity; determine a first numerical value based on the first ratio, where the first numerical value is a maximum integer that does not exceed the first ratio; and determine the first numerical value as the starting bit corresponding to the second data block to which the starting byte belongs in the bitmap.

[0166] In one possible implementation, the processing module 402 is specifically used to: determine a second ratio between the end position and the second granularity; determine a second value based on the second ratio, where the second value is a maximum integer that does not exceed the second ratio; and determine the second value as the end bit corresponding to the second data block to which the end byte belongs in the bitmap.

[0167] In one possible implementation, the first storage device is a Ceph distributed storage system; the acquisition module 401 is specifically used to obtain a snapshot of the Ceph distributed storage system at the current moment and a snapshot at the last backup moment; the processing module 402 is also used to compare the snapshot at the current moment and the snapshot at the last backup moment through the RBD diff command in the Ceph distributed storage system to obtain storage information of the differential data to be backed up in the Ceph distributed storage system in the Ceph distributed storage system.

[0168] In one possible implementation, the target position in the bitmap is set to a first value, and other positions in the bitmap except the target position are set to a second value. The first value is used to indicate that the data indicated by the target position has been updated, and the second value is used to indicate that the data indicated by the position has not been updated.

[0169] In a possible implementation, the target time period is the time period between the last backup time and the current backup time.

[0170] It should be noted that Figure 7 The module division described is illustrative and represents only one logical functional division. Actual implementations may employ different divisions. For example, two or more functions may be integrated into a single processing module. These integrated modules may be implemented as either hardware or software functional modules.

[0171] Another embodiment of the present application further provides a computer device, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the data backup method shown in the above embodiment.

[0172] In actual implementation, the acquisition module 401 and the processing module 402 can be implemented by the processor of the computer device calling the computer program code in the memory. The specific execution process can be referred to the description of the data backup method part above, which will not be repeated here.

[0173] Another embodiment of the present application further provides a computer-readable storage medium having computer instructions stored thereon. When the computer instructions are executed by a processor, the steps of the data backup method shown in the above embodiment are implemented.

[0174] In another embodiment of the present application, a computer program product is provided. The computer program product includes computer instructions. When the computer instructions are executed by a processor, the steps of the data backup method shown in the above embodiment are implemented.

[0175] In the above embodiments, all or part of the embodiments can be implemented by software, hardware, firmware, or any combination thereof. When implemented using a software program, all or part of the embodiments can be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer execution instructions are loaded and executed on a computer, all or part of the processes or functions according to the embodiments of the present application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more servers that can be integrated with the medium. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), etc.

[0176] The above is only a specific embodiment of the present application. Those skilled in the art may conceive of changes or substitutions based on the specific embodiment provided in this application, and all such changes or substitutions shall fall within the scope of protection of this application.

Claims

1. A data backup method, characterized in that: The method comprises: Acquire storage information of differential data to be backed up in a first storage device in the first storage device, wherein the differential data includes data updated within a target time period; determining a bitmap according to storage information of the differential data in the first storage device, so that a target position in the bitmap indicates the differential data; The data indicated by the target position in the bitmap is backed up to a second storage device.

2. The data backup method according to claim 1, wherein: The data in the first storage device includes a plurality of first data blocks, and the first granularity represents the size of one of the first data blocks; a position in the bitmap is used to record whether a second data block has changed, and the second granularity represents the size of one of the second data blocks; Determining a bitmap according to storage information of the differential data in the first storage device includes: According to the first granularity and the second granularity, storage information of the differential data in the first storage device is mapped to a target position in the bitmap.

3. The data backup method according to claim 1 or 2, characterized in that: The storage information of the differential data includes at least one address segment; the differential data is contained in at least one first data block; different address segments are used to indicate different first data blocks, the starting position of the address segment is the starting byte of the first data block indicated by the address segment, and the ending position of the address segment is the ending byte of the first data block indicated by the address segment; If the first granularity is equal to the second granularity, or the first granularity is smaller than the second granularity and is divisible by the first granularity, mapping the storage information of the differential data in the first storage device to the target location in the bitmap according to the first granularity and the second granularity includes: For each of the address segments, determining, according to the second granularity and the starting position, a starting bit position corresponding to the second data block to which the starting byte belongs in the bitmap; and / or, Determine, according to the second granularity and the end position, an end bit corresponding to the second data block to which the end byte belongs in the bitmap; The target position includes the start bit, the end bit, and the bits between the start bit and the end bit; and the second granularity represents the size of one second data block.

4. The data backup method according to claim 3, wherein: If the first granularity is larger than the second granularity, or the first granularity is smaller than the second granularity and cannot be divided evenly by the first granularity, mapping the storage information of the differential data in the first storage device to the target location in the bitmap according to the first granularity and the second granularity includes: For each of the address segments, determining, according to the second granularity and the starting position, a starting bit position corresponding to the second data block to which the starting byte belongs in the bitmap; Determine, according to the second granularity and the end position, an end bit corresponding to the second data block to which the end byte belongs in the bitmap; The target position includes the start bit, the end bit, and the bits between the start bit and the end bit; and the second granularity represents the size of one second data block.

5. The data backup method according to claim 3 or 4, characterized in that: The determining, according to the second granularity and the starting position, a starting bit corresponding to the second data block to which the starting byte belongs in the bitmap includes: determining a first ratio between the starting position and the second particle size; determining a first value based on the first ratio, where the first value is a maximum integer not exceeding the first ratio; The first value is determined as the starting bit corresponding to the second data block to which the starting byte belongs in the bitmap.

6. The data backup method according to claim 3 or 4, characterized in that: Determining, according to the second granularity and the end position, an end bit corresponding to the second data block to which the end byte belongs in the bitmap, includes: determining a second ratio between the end position and the second granularity; determining a second value based on the second ratio, where the second value is a maximum integer not exceeding the second ratio; The second value is determined as the end bit corresponding to the second data block to which the end byte belongs in the bitmap.

7. The data backup method according to claim 1, wherein: The first storage device is a Ceph distributed storage system; and obtaining storage information of the differential data to be backed up in the first storage device in the first storage device includes: Obtaining a snapshot of the Ceph distributed storage system at the current moment and a snapshot at the last backup moment; By using the RBD diff command in the Ceph distributed storage system, the snapshot at the current moment and the snapshot at the last backup moment are compared to obtain storage information of the differential data to be backed up in the Ceph distributed storage system in the Ceph distributed storage system.

8. The data backup method according to any one of claims 1 to 7, characterized in that: The target position in the bitmap is set to a first value, and other positions in the bitmap except the target position are set to a second value, the first value is used to represent that the data indicated by the target position has been updated, and the second value is used to represent that the data indicated by the position has not been updated.

9. The data backup method according to any one of claims 1 to 8, characterized in that: The target time period is the time period between the last backup time and the current backup time.

10. A computer device comprising a memory, a processor, and a computer program stored in the memory, wherein: The processor executes the computer program to implement the steps of the method according to any one of claims 1 to 9.