A data backup method, device and storage medium for a virtual machine

By using the target hollow files in virtual machine data backup for full and incremental backup, the problems of large backup data, high bandwidth usage and complex recovery process in the existing technology are solved, and a more efficient backup process is achieved.

CN118869479BActive Publication Date: 2025-04-25DISJIE (BEIJING) DATA MANAGEMENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410894148.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-04
Publication Date
2025-04-25
Estimated Expiration
2044-07-04

AI Technical Summary

Technical Problem

In the prior art, the full backup method has a large data transmission volume, a high bandwidth occupancy and a long time, and the incremental backup method has a complex process and takes a long time when restoring data.

Method used

By performing full and incremental backups of valid data or modified valid data in the source virtual machine based on the target hollow file, the amount of data to be transmitted during the backup process and the use of network bandwidth are simplified, and the backup process is simplified.

Benefits of technology

Reduces the time and resource consumption required for backup and improves the efficiency of the backup process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118869479B_ABST
    Figure CN118869479B_ABST
Patent Text Reader

Abstract

The present invention discloses a data backup method, device and storage medium for a virtual machine, the method comprising obtaining detailed configuration information of a source virtual machine; creating an initial hole file corresponding to the source virtual machine according to the detailed configuration information; obtaining valid data information of the source virtual machine, and determining a target storage location of valid data in the source virtual machine based on the valid data information; writing valid data in the source virtual machine into the initial hole file based on the target storage location to obtain a target hole file corresponding to the source virtual machine; determining a backup type of the incremental backup in response to the source virtual machine performing an incremental backup; and performing an incremental backup of the source virtual machine through the target hole file based on the backup type. The present invention reduces the amount of data that needs to be transmitted and the occupation of network bandwidth during the backup process, and the backup process is simpler, thereby reducing the time and resource consumption required for the backup, thereby making the backup process more efficient.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data backup, and in particular to a data backup method, device and storage medium for a virtual machine. Background Art

[0002] At present, more and more companies are applying virtualization technology to their core businesses. Virtualization technology is a technology that centralizes multiple application servers in the form of virtual machines (VMs) to run on a virtualized physical server. Among them, when applying virtualization technology, it is necessary to back up the virtual machine data to avoid data loss and damage, so as to ensure that the virtual machine can be restored in time when an accident occurs. Among them, virtual machines can be backed up through full backup and incremental backup. Specifically, full backup: a complete backup of all data of the entire virtual machine; incremental backup: only backs up the data blocks that have been added or modified since the last full backup or incremental backup of the virtual machine.

[0003] In the prior art, the full backup method needs to back up the data of the entire virtual machine each time, which results in large data transmission volume, high bandwidth usage and long backup time; the incremental backup method only retains incremental data information each time incremental backup is performed, and the complete disk data is retained in the first full backup. However, the above incremental backup method has limitations when restoring data, for example: the full backup data needs to be merged with each incremental backup version data in sequence until the most recent incremental backup version is merged. The above recovery process involves multiple steps and multiple versions of backup data, and the recovery process takes a long time. Summary of the invention

[0004] The present invention provides a data backup method and device for a virtual machine to solve one of the technical problems in the above-mentioned prior art.

[0005] To this end, the present invention proposes a data backup method for a virtual machine, which can perform full backup and incremental backup of valid data or modified valid data in a source virtual machine based on a target empty file, thereby reducing the amount of data that needs to be transmitted and the occupancy of network bandwidth during the backup process, and making the backup process simpler, thereby reducing the time and resource consumption required for backup, thereby making the backup process more efficient.

[0006] Another object of the present invention is to provide a data backup device for a virtual machine.

[0007] To achieve the above object, the present invention provides a data backup method for a virtual machine, the method comprising:

[0008] Get detailed configuration information of the source virtual machine;

[0009] Creating an initial hole file corresponding to the source virtual machine according to the detailed configuration information;

[0010] Acquire valid data information of the source virtual machine, and determine a target storage location of valid data in the source virtual machine based on the valid data information;

[0011] Based on the target storage location, write the valid data in the source virtual machine into the initial hole file to obtain a target hole file corresponding to the source virtual machine;

[0012] In response to the source virtual machine performing an incremental backup, determining a backup type of the incremental backup;

[0013] Based on the backup type, an incremental backup is performed on the source virtual machine through the target hole file.

[0014] The data backup method of the virtual machine according to the embodiment of the present invention may also have the following additional technical features:

[0015] In one embodiment of the present invention, the obtaining of valid data information of the source virtual machine and determining a target storage location of valid data in the source virtual machine based on the valid data information includes:

[0016] Acquire multiple groups of valid data pairs of the source virtual machine, wherein each group of valid data pairs includes a first starting number and a number of consecutive sectors, and the first starting number is a starting sector number of the valid data in the source virtual machine;

[0017] Calculate a second starting number for each group of valid data pairs based on the first starting number, wherein the second starting number is the starting number of the valid data in the target hole file;

[0018] Calculating the target data block quantity of each group of valid data pairs based on the number of continuous sectors;

[0019] Based on the second starting number and the target data block quantity, a storage location of valid data in the source virtual machine in the target hole file is determined.

[0020] In one embodiment of the present invention, in response to the source virtual machine performing an incremental backup, determining the backup type of the incremental backup includes:

[0021] In response to performing an incremental backup of the source virtual machine, creating a snapshot of the source virtual machine;

[0022] Based on the snapshot, determining whether a disk group in the source virtual machine has changed;

[0023] If the disk group in the source virtual machine has not changed, determining that the backup type of the incremental backup is the first type;

[0024] If the disk group in the source virtual machine changes, the backup type of the incremental backup is determined to be the second type.

[0025] In one embodiment of the present invention, determining whether the disk group in the source virtual machine has changed based on the snapshot includes:

[0026] Determine whether a state identifier of a disk group in the source virtual machine changes;

[0027] If the state identifier has not changed, determining that the disk group in the source virtual machine has not changed;

[0028] If the state identifier changes, it is determined that the disk group in the source virtual machine has changed.

[0029] In one embodiment of the present invention, the incrementally backing up the source virtual machine through the target hole file based on the backup type includes:

[0030] If the backup type is the first type, performing an incremental backup of the source virtual machine through the target hole file;

[0031] If the backup type is the second type, a full backup is performed on the source virtual machine again.

[0032] In one embodiment of the present invention, the incrementally backing up the source virtual machine through the target hole file includes:

[0033] Get the byte offset and byte count of the changed data in the source virtual machine;

[0034] Determine a third starting number of the source virtual machine change data based on the byte offset;

[0035] Based on the number of bytes, determine the number of data blocks of the changed data of the source virtual machine;

[0036] Based on the third starting number and the number of data blocks, a storage location of the changed data in the target hole file is determined, and an incremental backup is performed on the source virtual machine.

[0037] In one embodiment of the present invention, the method further comprises:

[0038] Obtaining a disk information summary file of the source virtual machine;

[0039] Based on the disk information summary file and the target hole file, the valid data in the source virtual machine is written into the target virtual machine to complete the virtual machine recovery.

[0040] To achieve the above object, the present invention further provides a data backup device for a virtual machine, the device comprising:

[0041] An acquisition module is used to obtain detailed configuration information of the source virtual machine;

[0042] A creation module, used to create an initial hole file corresponding to the source virtual machine according to the detailed configuration information;

[0043] A first determination module, configured to obtain valid data information of the source virtual machine, and determine a target storage location of valid data in the source virtual machine based on the valid data information;

[0044] A writing module, used to write the valid data in the source virtual machine into the initial hole file based on the target storage location, so as to obtain a target hole file corresponding to the source virtual machine;

[0045] A second determination module is used to determine a backup type of the incremental backup in response to the source virtual machine performing the incremental backup;

[0046] A backup module is used to perform an incremental backup of the source virtual machine through the target hole file based on the backup type.

[0047] Another object of the present invention is to provide an electronic device, comprising:

[0048] at least one processor; and

[0049] a memory communicatively connected to the at least one processor; wherein,

[0050] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform any one of the methods described in the above aspect.

[0051] Another object of the present invention is to provide a computer storage medium, wherein the computer storage medium stores computer executable instructions; after the computer executable instructions are executed by a processor, the computer executes any one of the methods described in the above aspect.

[0052] The data backup method and device of the virtual machine of the embodiment of the present invention obtains the detailed configuration information of the source virtual machine; creates an initial hole file corresponding to the source virtual machine according to the detailed configuration information; obtains the valid data information of the source virtual machine, and determines the target storage location of the valid data in the source virtual machine based on the valid data information; writes the valid data in the source virtual machine into the initial hole file based on the target storage location to obtain the target hole file corresponding to the source virtual machine; determines the backup type of the incremental backup in response to the source virtual machine; and performs an incremental backup of the source virtual machine through the target hole file based on the backup type. Therefore, the present invention performs full backup and incremental backup of the valid data or modified valid data in the source virtual machine based on the target hole file, which reduces the amount of data that needs to be transmitted and the occupation of the network bandwidth during the backup process, and the backup process is simpler, thereby reducing the time and resource consumption required for the backup, thereby making the backup process more efficient.

[0053] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] The above and / or additional aspects and advantages of the present invention will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:

[0055] Figure 1 is a flow chart of a data backup method for a virtual machine according to an embodiment of the present invention;

[0056] Figure 2 is a flow chart of a data backup method for a virtual machine according to an embodiment of the present invention;

[0057] Figure 3 4 is a structural diagram of a data backup device for a virtual machine according to an embodiment of the present invention. DETAILED DESCRIPTION

[0058] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments can be combined with each other. The present invention will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0059] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0060] The following describes a method and device for backing up data of a virtual machine according to an embodiment of the present invention with reference to the accompanying drawings.

[0061] Figure 1 The figure is a flow chart of a method for backing up data of a virtual machine according to an embodiment of the present invention.

[0062] like Figure 1 As shown, the method includes:

[0063] S1, obtain detailed configuration information of the source virtual machine.

[0064] In one embodiment of the present invention, the executor of the data backup method of the virtual machine is a data backup device of the virtual machine, which can be implemented by software and / or hardware. The data backup device of the virtual machine in this embodiment can be configured in a backup server.

[0065] In one embodiment of the present invention, the source virtual machine may be a virtual machine that needs to be backed up, the platform where the source virtual machine is located is a virtualization center, and the backup server performs virtual machine backup tasks and stores backup data.

[0066] Furthermore, in one embodiment of the present invention, before obtaining the detailed configuration information of the source virtual machine, the backup server connects to the virtualization center to check and enable the CBT (Changed Block Tracking) changed block tracking function of the source virtual machine to prepare for subsequent incremental backup.

[0067] Furthermore, in one embodiment of the present invention, a first snapshot may be created for the source virtual machine through the virtualization center interface, and detailed configuration information of the source virtual machine may be obtained through the first snapshot. In one embodiment of the present invention, the detailed configuration information may include at least one of the following: number of CPU cores; memory; number of disk sectors; disk size and provisioning method.

[0068] S2, creates an initial hole file corresponding to the source virtual machine according to the detailed configuration information.

[0069] In one embodiment of the present invention, after the detailed configuration information is obtained through the above steps, an initial hole file corresponding to the source virtual machine can be created according to the configuration information included in the detailed configuration information.

[0070] Specifically, in one embodiment of the present invention, the above method for creating an initial hole file corresponding to the source virtual machine based on detailed configuration information may include: calculating the disk size of the source virtual machine based on the number of disk sectors and the sector size, and calculating the number of target data blocks based on the disk size of the source virtual machine and the size of the target data blocks, and creating the initial hole file corresponding to the source virtual machine based on the number of target data blocks.

[0071] In one embodiment of the present invention, the sector size of the source virtual machine may be a fixed 512 bytes. Also, in one embodiment of the present invention, the disk size of the source virtual machine, that is, the storage space occupied by the source virtual machine, may be obtained by multiplying the number of disk sectors by the sector size.

[0072] And, in one embodiment of the present invention, the size of the target data block can be customized by the backup server, and for example, the size of the target data block is 1 M. In one embodiment of the present invention, the number of target data blocks can be obtained by dividing the disk size of the source virtual machine by the size of the target data block.

[0073] Furthermore, in one embodiment of the present invention, the initial hole file corresponding to the source virtual machine can be created by using the target data block number and target data block size obtained above. The initial hole file can be used as the backup data target file of the source virtual machine and does not occupy actual storage space in physical storage.

[0074] S3, obtaining valid data information of the source virtual machine, and determining a target storage location of the valid data in the source virtual machine based on the valid data information.

[0075] In one embodiment of the present invention, the method for obtaining valid data information of a source virtual machine and determining a target storage location of valid data in the source virtual machine based on the valid data information may include the following steps:

[0076] S31, obtaining multiple groups of valid data pairs of the source virtual machine.

[0077] In one embodiment of the present invention, each group of valid data pairs includes a first starting number and a number of consecutive sectors, and the first starting number is the starting sector number of the valid data in the source virtual machine, that is, each group of valid data pairs can indicate that there are valid data in a plurality of consecutive sectors starting from the first starting number. For example, the valid data pair (0, 2048) means that starting from the 0th sector, there are 2048 consecutive sectors with valid data. In one embodiment of the present invention, the minimum number of the consecutive sectors can be 2048.

[0078] S32, calculating a second starting number for each group of valid data pairs based on the first starting number.

[0079] In one embodiment of the present invention, the second starting number is the starting number of the valid data in the target hole file.

[0080] And, in one embodiment of the present invention, a method for calculating the second starting number of each group of valid data pairs according to the sector offset based on the first starting number may include: determining the position of the first starting number in the source virtual machine by multiplying the first starting number by the sector size, and obtaining the second starting number of each group of valid data pairs by dividing the position of the first starting number in the source virtual machine by the size of the target data block.

[0081] S33, calculating the number of target data blocks for each group of valid data pairs based on the number of continuous sectors.

[0082] In one embodiment of the present invention, a method for calculating the target number of data blocks for each group of valid data pairs based on the number of consecutive sectors may include: obtaining the storage space occupied by the valid data pairs by multiplying the number of consecutive sectors by the size of each sector, and dividing the obtained storage space by the target valid block size to calculate the target number of data blocks for each group of valid data pairs.

[0083] S34: Based on the second starting number and the number of target data blocks, determine the storage location of the valid data in the source virtual machine in the target hole file.

[0084] In one embodiment of the present invention, after obtaining the second starting number and the target data block quantity through the above steps, the storage space of the target data block quantity consecutively starting from the second starting number is the storage position of the valid data in the source virtual machine in the target hole file.

[0085] S4, based on the target storage location, write the valid data in the source virtual machine into the initial hole file to obtain the target hole file corresponding to the source virtual machine.

[0086] In one embodiment of the present invention, the corresponding valid data in the acquired source virtual machine can be written into the initial hole file based on the target storage location of each group of valid data pairs to obtain the target hole file corresponding to the source virtual machine. In one embodiment of the present invention, the hole part without valid data in the above target hole file does not occupy storage space. Based on this, when the data in the source virtual machine is stored through the target hole file, storage space can be saved.

[0087] Furthermore, in one embodiment of the present invention, a corresponding disk information summary file can be obtained based on the target data block information in the target hole file. The disk information summary file records all data block numbers in the target hole file and marks valid data blocks.

[0088] S5: In response to the source virtual machine performing an incremental backup, determine a backup type of the incremental backup.

[0089] In one embodiment of the present invention, when an incremental backup instruction is received, it is necessary to determine the backup type of the incremental backup so as to perform an incremental backup on the source virtual machine.

[0090] Specifically, in one embodiment of the present invention, the method for determining the backup type of the incremental backup may include the following steps:

[0091] S51: In response to performing incremental backup of a source virtual machine, creating a snapshot of the source virtual machine.

[0092] In one embodiment of the present invention, in response to the source virtual machine performing an incremental backup, a second snapshot may be created for the source virtual machine to retain the current configuration information of the source virtual machine.

[0093] S52: Based on the snapshot, determine whether the disk group in the source virtual machine has changed.

[0094] In one embodiment of the present invention, the method for determining whether a disk group in a source virtual machine has changed based on a snapshot may include the following steps:

[0095] Step 1: Determine whether the state identifier of the disk group in the source virtual machine has changed;

[0096] Step 2: If the status identifier has not changed, it is determined that the disk group in the source virtual machine has not changed;

[0097] Step 3: If the status identifier changes, it is determined that the disk group in the source virtual machine has changed.

[0098] Among them, in one embodiment of the present invention, the status identifier of the disk group in the source virtual machine can be obtained, and it is determined whether the status identifier of the disk group has changed compared with the status identifier of the disk group after the source virtual machine was most recently backed up. If the status identifier has changed, it means that the disk group in the source virtual machine may have added, deleted, or replaced disks, and it is determined that the disk group in the source virtual machine has changed; if the status identifier has not changed, it means that the disk group in the source virtual machine has not been changed, and it is determined that the disk group in the source virtual machine has not changed.

[0099] S53: If the disk group in the source virtual machine has not changed, determine that the backup type of the incremental backup is the first type.

[0100] S54: If the disk group in the source virtual machine changes, determine that the backup type of the incremental backup is the second type.

[0101] S6, based on the backup type, performs an incremental backup of the source virtual machine through the target hole file.

[0102] In one embodiment of the present invention, after the backup type is determined through the above steps, an incremental backup of the source virtual machine can be performed based on the backup type through the target hole file.

[0103] Specifically, in one embodiment of the present invention, the method for performing incremental backup of a source virtual machine through a target hole file based on the backup type may include the following steps:

[0104] S61: If the backup type is the first type, perform an incremental backup of the source virtual machine through the target hole file.

[0105] In the embodiment of the present disclosure, the method for performing incremental backup of the source virtual machine through the target hole file may include the following steps:

[0106] Step a: Obtain the byte offset and byte count of the changed data in the source virtual machine.

[0107] In one embodiment of the present invention, the byte offset and byte number corresponding to the source virtual machine disk change data sent by the virtualization center can be obtained through the CBT change block tracking technology.

[0108] Step b: Determine the third starting number of the source virtual machine change data based on the byte offset.

[0109] In one embodiment of the present invention, the byte offset is a starting byte offset.

[0110] And, in one embodiment of the present invention, the third starting number of the changed data in the target hole file is obtained by dividing the starting byte offset by the target data block size.

[0111] Step c: Based on the number of bytes, determine the number of data blocks of the changed data of the source virtual machine.

[0112] In one embodiment of the present invention, the number of continuous data blocks of the source virtual machine's changed data may be determined based on the number of bytes divided by the target data block size.

[0113] Step d: Based on the third starting number and the number of data blocks, determine the storage location of the changed data in the target hole file, and perform an incremental backup of the source virtual machine.

[0114] In one embodiment of the present invention, the third starting number and the number of continuous data blocks are determined as the storage position of the changed data in the target hole file.

[0115] Also, in one embodiment of the present invention, a method for performing incremental backup of a source virtual machine based on the storage location of the changed data in a target hole file may include: if the storage location corresponding to the changed data already has fill data, directly modifying the old data; if the storage location corresponding to the changed data is empty, directly writing the new data.

[0116] Further, in an embodiment of the present invention, after all the changed data in the source virtual machine are written to the storage location corresponding to the target hole file through the above steps, the second snapshot can be deleted to release space and manage the snapshots.

[0117] S62: If the backup type is the second type, perform a full backup of the source virtual machine again.

[0118] In one embodiment of the present invention, if the backup type is the second type, it means that the disk structure in the source virtual machine has changed. At this time, the structure in the target void file needs to be modified synchronously. Based on this, a full backup of the source virtual machine is required to ensure the consistency of the most recent backup data and the source virtual machine disk data. The source virtual machine can be quickly restored to ensure the timeliness of the recovery takeover.

[0119] Furthermore, in one embodiment of the present invention, the method for performing a full backup of the source virtual machine may refer to the above steps S1 to S4, which will not be described in detail in this embodiment of the present invention.

[0120] Furthermore, in one embodiment of the present invention, when the source virtual machine fails, the data in the source virtual machine needs to be backed up to the target virtual machine to ensure that the target virtual machine can promptly replace the source virtual machine to provide services to customers.

[0121] Based on this, the above method may further include the following steps:

[0122] S7, obtaining a disk information summary file of the source virtual machine.

[0123] In one embodiment of the present invention, the most recent disk information summary file of the target hole file may be obtained.

[0124] S8, based on the disk information summary file and the target hole file, write the valid data in the source virtual machine into the target virtual machine to complete the virtual machine recovery.

[0125] In one embodiment of the present invention, all data block numbers of the target hole file and whether they are valid data blocks can be obtained based on the disk information summary file of the most recent backup data, and based on the correspondence between the disk information summary file and the target hole file data, the valid data in the source virtual machine is written into the target virtual machine to complete the virtual machine recovery.

[0126] Specifically, in one embodiment of the present invention, the data block number corresponding to the valid data block in the disk information summary file can be multiplied by the target data block size to obtain the storage position of the valid data block in the target hole file, and the data in the storage position in the target hole file can be stored in the corresponding disk data block number in the target virtual machine, and the above steps can be repeated until the virtual machine recovery is completed.

[0127] In one embodiment of the present invention, virtual machine recovery is completed through the above-mentioned disk information summary file and target hole file, omitting the process of merging full backup data and incremental backup data, thereby ensuring the timeliness of recovery and efficiently achieving rapid business takeover.

[0128] In the data backup method of the virtual machine proposed by the present invention, the detailed configuration information of the source virtual machine is obtained; based on the detailed configuration information, an initial hole file corresponding to the source virtual machine is created; the valid data information of the source virtual machine is obtained, and the target storage location of the valid data in the source virtual machine is determined based on the valid data information; based on the target storage location, the valid data in the source virtual machine is written into the initial hole file to obtain the target hole file corresponding to the source virtual machine; in response to the incremental backup of the source virtual machine, the backup type of the incremental backup is determined; based on the backup type, the source virtual machine is incrementally backed up through the target hole file. Therefore, the present invention performs full backup and incremental backup of the valid data or modified valid data in the source virtual machine based on the target hole file, which reduces the amount of data that needs to be transmitted and the occupation of the network bandwidth during the backup process, and the backup process is simpler, thereby reducing the time and resource consumption required for the backup, thereby making the backup process more efficient.

[0129] Based on the above description, Figure 2 A flowchart of a data backup method for a virtual machine proposed in an embodiment of the present invention is shown in FIG. Figure 2 As shown, according to the detailed configuration information of the source virtual machine, an initial hole file corresponding to the source virtual machine is created, and the initial hole file includes 16 target valid data blocks, namely B1-B16. After a full backup, the valid data in the source virtual machine is backed up in B1, B2, B3, B4, B7 and B8 to obtain a target hole file; in response to the source virtual machine performing the first incremental backup, and the type of the incremental backup is the first type, the position of the changed data in the target hole file is determined to be B3, B4, B9 and B10, and new data is added in B9 and B10, and the data is modified in B3 and B4 to obtain the target hole file for completing the incremental backup; in response to the source virtual machine performing the second incremental backup, and the type of the incremental backup is the first type, the position of the changed data in the target hole file is determined to be B1, B2, B13 and B14, and new data is added in B13 and B14, and the data is modified in B1 and B2 to obtain the target hole file for completing the incremental backup.

[0130] In order to implement the above embodiment, Figure 3 As shown, this embodiment also provides a data backup device 10 for a virtual machine, which includes an acquisition module 301, a creation module 302, a first determination module 303, a writing module 304, a second determination module 305, and a backup module 306;

[0131] The acquisition module 301 is used to acquire detailed configuration information of the source virtual machine;

[0132] A creation module 302, used to create an initial hole file corresponding to the source virtual machine according to the detailed configuration information;

[0133] A first determination module 303 is used to obtain valid data information of the source virtual machine and determine a target storage location of valid data in the source virtual machine based on the valid data information;

[0134] A writing module 304 is used to write valid data in the source virtual machine into the initial hole file based on the target storage location to obtain a target hole file corresponding to the source virtual machine;

[0135] A second determination module 305 is used to determine a backup type of the incremental backup in response to the source virtual machine performing the incremental backup;

[0136] The backup module 306 is used to perform incremental backup of the source virtual machine through the target hole file based on the backup type.

[0137] In one embodiment of the present invention, the first determining module 303 is specifically configured to:

[0138] Acquire multiple groups of valid data pairs of the source virtual machine, wherein each group of valid data pairs includes a first starting number and a number of consecutive sectors, and the first starting number is a starting sector number of the valid data in the source virtual machine;

[0139] Calculate the second starting number of each group of valid data pairs based on the first starting number, wherein the second starting number is the starting number of the valid data in the target hole file;

[0140] Calculate the number of target data blocks for each group of valid data pairs based on the number of consecutive sectors;

[0141] Based on the second starting number and the target data block quantity, a storage location of valid data in the source virtual machine in the target hole file is determined.

[0142] Further, in one embodiment of the present invention, the second determining module 305 is specifically configured to:

[0143] In response to performing an incremental backup of the source virtual machine, creating a snapshot of the source virtual machine;

[0144] Based on the snapshot, determine whether the disk group in the source virtual machine has changed;

[0145] If the disk group in the source virtual machine has not changed, determining the backup type of the incremental backup to be the first type;

[0146] If the disk group in the source virtual machine changes, the backup type of the incremental backup is determined to be the second type.

[0147] Furthermore, in one embodiment of the present invention, the second determining module 305 is further configured to:

[0148] Determine whether a state identifier of a disk group in the source virtual machine changes;

[0149] If the state identifier has not changed, it is determined that the disk group in the source virtual machine has not changed;

[0150] If the status identifier changes, it is determined that the disk group in the source virtual machine has changed.

[0151] Furthermore, in one embodiment of the present invention, the backup module 306 is specifically configured to:

[0152] If the backup type is the first type, an incremental backup of the source virtual machine is performed through the target hole file;

[0153] If the backup type is the second type, perform a full backup of the source virtual machine again.

[0154] Furthermore, in one embodiment of the present invention, the backup module 306 is further configured to:

[0155] Get the byte offset and byte count of the changed data in the source virtual machine;

[0156] Determine a third starting number of the source virtual machine change data based on the byte offset;

[0157] Based on the number of bytes, determine the number of data blocks of the source virtual machine's changed data;

[0158] Based on the third starting number and the number of data blocks, the storage location of the changed data in the target hole file is determined, and an incremental backup is performed on the source virtual machine.

[0159] Furthermore, in one embodiment of the present invention, the above device is also used for:

[0160] Obtain the disk information summary file of the source virtual machine;

[0161] Based on the disk information summary file and the target hole file, the valid data in the source virtual machine is written into the target virtual machine to complete the virtual machine recovery.

[0162] In the data backup device for a virtual machine proposed by the present invention, detailed configuration information of a source virtual machine is obtained; an initial hole file corresponding to the source virtual machine is created according to the detailed configuration information; valid data information of the source virtual machine is obtained, and a target storage location of valid data in the source virtual machine is determined based on the valid data information; based on the target storage location, valid data in the source virtual machine is written into the initial hole file to obtain a target hole file corresponding to the source virtual machine; in response to performing an incremental backup of the source virtual machine, a backup type of the incremental backup is determined; based on the backup type, an incremental backup of the source virtual machine is performed through the target hole file. Thus, the present invention performs full backup and incremental backup of valid data or modified valid data in the source virtual machine based on the target hole file, which reduces the amount of data that needs to be transmitted and the occupation of network bandwidth during the backup process, and the backup process is simpler, thereby reducing the time and resource consumption required for the backup, thereby making the backup process more efficient.

[0163] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.

[0164] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In the description of the present invention, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.

Claims

1. A data backup method for a virtual machine, characterized in that: The method is applied to a backup server, and the method comprises: Get detailed configuration information of the source virtual machine; Creating an initial hole file corresponding to the source virtual machine according to the detailed configuration information; Acquire valid data information of the source virtual machine, and determine a target storage location of valid data in the source virtual machine based on the valid data information; Based on the target storage location, write the valid data in the source virtual machine into the initial hole file to obtain a target hole file corresponding to the source virtual machine; In response to the source virtual machine performing an incremental backup, determining a backup type of the incremental backup; Based on the backup type, performing an incremental backup of the source virtual machine through the target hole file; The obtaining the valid data information of the source virtual machine and determining the target storage location of the valid data in the source virtual machine based on the valid data information includes: Acquire multiple groups of valid data pairs of the source virtual machine, wherein each group of valid data pairs includes a first starting number and a number of consecutive sectors, and the first starting number is a starting sector number of the valid data in the source virtual machine; Calculate a second starting number for each group of valid data pairs based on the first starting number, wherein the second starting number is the starting number of the valid data in the target hole file; Calculating the target data block quantity of each group of valid data pairs based on the number of continuous sectors; Based on the second starting number and the target data block quantity, a storage location of valid data in the source virtual machine in the target hole file is determined.

2. The method according to claim 1, characterized in that In response to the source virtual machine performing an incremental backup, determining a backup type of the incremental backup includes: In response to performing an incremental backup of the source virtual machine, creating a snapshot of the source virtual machine; Based on the snapshot, determining whether a disk group in the source virtual machine has changed; If the disk group in the source virtual machine has not changed, determining that the backup type of the incremental backup is the first type; If the disk group in the source virtual machine changes, the backup type of the incremental backup is determined to be the second type.

3. The method according to claim 2, characterized in that The determining, based on the snapshot, whether the disk group in the source virtual machine has changed includes: Determine whether a state identifier of a disk group in the source virtual machine changes; If the state identifier has not changed, determining that the disk group in the source virtual machine has not changed; If the state identifier changes, it is determined that the disk group in the source virtual machine has changed.

4. The method according to claim 1, characterized in that: The performing incremental backup of the source virtual machine based on the backup type through the target hole file includes: If the backup type is the first type, performing an incremental backup of the source virtual machine through the target hole file; If the backup type is the second type, a full backup is performed on the source virtual machine again.

5. The method according to claim 4, characterized in that The incrementally backing up the source virtual machine through the target hole file includes: Get the byte offset and byte count of the changed data in the source virtual machine; Determine a third starting number of the source virtual machine change data based on the byte offset; Based on the number of bytes, determine the number of data blocks of the changed data of the source virtual machine; Based on the third starting number and the number of data blocks, a storage location of the changed data in the target hole file is determined, and an incremental backup is performed on the source virtual machine.

6. The method according to claim 1, characterized in that The method further comprises: Obtaining a disk information summary file of the source virtual machine; Based on the disk information summary file and the target hole file, the valid data in the source virtual machine is written into the target virtual machine to complete the virtual machine recovery.

7. A data backup device for a virtual machine, characterized in that: The device is applied to a backup server, and comprises: An acquisition module is used to obtain detailed configuration information of the source virtual machine; A creation module, used to create an initial hole file corresponding to the source virtual machine according to the detailed configuration information; A first determination module, configured to obtain valid data information of the source virtual machine, and determine a target storage location of valid data in the source virtual machine based on the valid data information; A writing module, used to write the valid data in the source virtual machine into the initial hole file based on the target storage location, so as to obtain a target hole file corresponding to the source virtual machine; A second determination module is used to determine a backup type of the incremental backup in response to the source virtual machine performing the incremental backup; A backup module, configured to perform an incremental backup of the source virtual machine through the target hole file based on the backup type; The first determination module is further used to obtain multiple groups of valid data pairs of the source virtual machine, wherein each group of valid data pairs includes a first starting number and a number of consecutive sectors, and the first starting number is a starting sector number of the valid data in the source virtual machine; Calculate a second starting number for each group of valid data pairs based on the first starting number, wherein the second starting number is the starting number of the valid data in the target hole file; Calculating the target data block quantity of each group of valid data pairs based on the number of continuous sectors; Based on the second starting number and the target data block quantity, a storage location of valid data in the source virtual machine in the target hole file is determined.

8. An electronic device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 6.

9. A computer storage medium, wherein: The computer storage medium stores computer executable instructions; after the computer executable instructions are executed by the processor, the method according to any one of claims 1 to 6 can be implemented.

Citation Information

Patent Citations

  • Data backup and recovery method and device, and server

    CN104506619A

  • System and method for taking over production system at any time

    CN112363807A