CN117032884A - Backup method and device for virtual machine - Google Patents

Backup method and device for virtual machine Download PDF

Info

Publication number
CN117032884A
CN117032884A CN202310972060.9A CN202310972060A CN117032884A CN 117032884 A CN117032884 A CN 117032884A CN 202310972060 A CN202310972060 A CN 202310972060A CN 117032884 A CN117032884 A CN 117032884A
Authority
CN
China
Prior art keywords
backup
virtual machine
disk
snapshot
data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310972060.9A
Other languages
Chinese (zh)
Inventor
请求不公布姓名
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Anchao Cloud Software Co Ltd
Original Assignee
Anchao Cloud Software Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Anchao Cloud Software Co Ltd filed Critical Anchao Cloud Software Co Ltd
Priority to CN202310972060.9A priority Critical patent/CN117032884A/en
Publication of CN117032884A publication Critical patent/CN117032884A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1448Management of the data involved in backup or backup restore
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/11File system administration, e.g. details of archiving or snapshots
    • G06F16/128Details of file system snapshots on the file-level, e.g. snapshot creation, administration, deletion
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45595Network integration; Enabling network access in virtual machine instances

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Quality & Reliability (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application relates to the technical field of electronic communication, in particular to a backup method and device of a virtual machine; the method comprises the following steps: firstly, acquiring an original virtual machine to be backed up and disk information of the original virtual machine, and creating a storage snapshot of the original virtual machine according to the original virtual machine and the disk information; adding the disk corresponding to the storage snapshot to a backup virtual machine, and acquiring the distribution condition of the effective data of the added disk in the backup virtual machine; then according to the distribution condition, obtaining effective backup data; and recording the effective backup data to a backup server, generating backup points and storing the backup points. The scheme solves the problems that the storage capacity cannot be fully utilized under the condition of NFS storage, the backup efficiency is greatly reduced, and the backup space is excessively occupied, and the purposes of improving the backup efficiency of NFS storage and saving the backup space are achieved.

Description

Backup method and device for virtual machine
Technical Field
The application relates to the technical field of electronic communication, in particular to a virtual machine backup method and device.
Background
The virtual PC is to virtualize a PC on an existing operating system, where the virtual PC has its own hard disk, its own memory, and so on, that is, it is a host independent of the existing operating system, such as a VMWare virtual machine.
The VMWare virtual machine can run two or more Windows systems, DOS systems and LINUX systems simultaneously on one machine. The existing method for backing up the VMWare virtual machine generally utilizes a VADP (VMwarevStorageAPIforDataProtection) backup scheme and uses methods such as a CBT/VDDK mode to acquire backup data. The VADP backup scheme refers to a new virtual machine backup and recovery mechanism introduced by VMware from vSphere4.0; the CBT/VDDK mode is to perform incremental or differential backup of virtual machines by using VDDK VMware library, and to perform backup only on disk space actually used.
However, in the above scheme, when full-scale backup is performed under the condition of NFS storage (the storage and mounting use modes of common vmware super-fusion are all NFS storage), the CBT/VDDK mode will fail, and the effect is equivalent to thick backup; for thick provisioning, a large amount of storage space needs to be provided in advance to meet future storage needs, but the space may not be used all the time, which may result in insufficient storage capacity, greatly reducing backup efficiency and excessively occupying backup space.
Disclosure of Invention
In view of this, the embodiment of the application provides a method and a device for backing up a virtual machine, so as to solve the problem that the storage capacity cannot be fully utilized under the condition of NFS storage, and the backup efficiency and the excessive occupied backup space are greatly reduced.
In a first aspect, an embodiment of the present application provides a method, including:
acquiring an original virtual machine to be backed up and disk information of the original virtual machine, and creating a storage snapshot of the original virtual machine according to the original virtual machine and the disk information;
adding a disk corresponding to the storage snapshot to a backup virtual machine, and acquiring the distribution condition of effective data of the added disk in the backup virtual machine;
acquiring effective backup data according to the distribution condition;
and recording the effective backup data to a backup server, generating backup points and storing the backup points.
According to the technical means, the embodiment of the application constructs the effective backup data by analyzing the effective data distribution of the added disk in the backup virtual machine, filters the hole data of the virtual disk stored by using the NFS, can achieve the backup effect similar to the VADP backup scheme, and achieves the purposes of improving the backup efficiency of the NFS storage and saving the backup space.
With reference to the first aspect, in one implementation, a backup server is created; the backup server is used for deploying backup programs.
With reference to the first aspect, in one implementation manner, a backup snapshot of the original virtual machine is created according to the original virtual machine and the disk information;
when the full-volume backup is performed, creating a full-volume storage snapshot of the original virtual machine according to the disk information of the current backup snapshot of the original virtual machine;
and during incremental backup, creating an incremental storage snapshot of the original virtual machine according to disk information between the previous backup snapshot and the current backup snapshot of the original virtual machine.
According to the technical means, when full-volume backup and incremental backup are performed, the scheme can be used for constructing effective backup data, the hole data of the NFS storage virtual disk is filtered, and the backup effect similar to the VADP backup scheme can be achieved, so that the storage capacity is fully utilized, the backup efficiency is improved, and the occupied backup space is reduced.
In combination with the first aspect, in an implementation manner, when the full-volume backup is performed, the disk corresponding to the current storage snapshot and the snapshot disk are sequentially added to the backup virtual machine according to the parent-child relationship.
With reference to the first aspect, in an implementation manner, when incremental backup is performed, snapshot disks between the previous backup snapshot and the current backup snapshot are sequentially added to the backup virtual machine according to a parent-child relationship.
According to the technical means, during full backup and incremental backup, the disks corresponding to the storage snapshots are respectively added to the backup virtual machine so as to construct effective backup data.
With reference to the first aspect, in one implementation manner, in the backup virtual machine, from a parent disk to a child snapshot disk, distribution block information of effective data is sequentially parsed;
and integrating and updating the distributed block information of each disk to obtain effective backup data.
According to the technical means, the embodiment of the application constructs the effective backup data by analyzing the effective data distribution of the added disk in the backup virtual machine, filters the hole data of the virtual disk stored by using the NFS, can achieve the backup effect similar to the VADP backup scheme, and achieves the purposes of improving the backup efficiency of the NFS storage and saving the backup space.
With reference to the first aspect, in one implementation manner, during full-scale backup, dividing the added parent disk and child snapshot disk in the backup virtual machine into data blocks according to the sequence from the parent disk to the child snapshot disk by a specified word length;
the integrating and updating the distributed block information of each disk comprises the following steps:
and when the full backup is performed, for the same data block, the data blocks which are valid data in the parent disk and the child snapshot disk are replaced and updated by the valid data of the child snapshot disk so as to construct first valid backup data.
According to the technical means, in the embodiment of the application, when the full-volume backup is performed, the effective data of the parent disk is replaced and updated by the effective data of the child snapshot disk, so that the effective backup data is constructed, the storage capacity is fully utilized, the backup efficiency is improved, and the occupied backup space is reduced.
With reference to the first aspect, in one implementation manner, in incremental backup, dividing the added sub-snapshot disk in the backup virtual machine into data blocks with a specified word length;
the integrating and updating the distributed block information of each disk comprises the following steps:
and in the incremental backup, the effective data of the sub-snapshot disk and the first effective backup data are replaced and updated to construct second effective backup data.
According to the technical means, when incremental backup is performed, the first effective backup data is replaced and updated by the effective data of the sub-snapshot disk, so that the effective backup data is constructed, the storage capacity is fully utilized, the backup efficiency is improved, and the occupied backup space is reduced.
In a second aspect, an embodiment of the present application provides a backup apparatus for a virtual machine, where the apparatus includes:
the storage snapshot creation module is used for obtaining an original virtual machine to be backed up and disk information of the original virtual machine, and creating a storage snapshot of the original virtual machine according to the original virtual machine and the disk information;
the effective data distribution condition acquisition module is used for adding the disk corresponding to the storage snapshot to a backup virtual machine and acquiring the distribution condition of the effective data of the added disk in the backup virtual machine;
the effective backup data acquisition module is used for acquiring effective backup data according to the distribution condition;
and the effective data backup module is used for recording the effective backup data to a backup server, generating backup points and storing the backup points.
In a fourth aspect, an embodiment of the present application provides a computer device, where the computer device includes a processor and a memory, where at least one instruction is stored in the memory, where the at least one instruction is loaded and executed by the processor to implement a method for backing up a virtual machine as described above.
In a fifth aspect, an embodiment of the present application provides a computer readable storage medium, where at least one instruction is stored, where the at least one instruction is loaded and executed by a processor to implement a method for backing up a virtual machine as described above.
The technical scheme provided by the application can comprise the following beneficial effects:
the method comprises the steps of firstly obtaining an original virtual machine to be backed up and disk information of the original virtual machine, and creating a storage snapshot of the original virtual machine according to the original virtual machine and the disk information; adding the disk corresponding to the storage snapshot to a backup virtual machine, and acquiring the distribution condition of the effective data of the added disk in the backup virtual machine; then according to the distribution condition, obtaining effective backup data; and recording the effective backup data to a backup server, generating backup points and storing the backup points. According to the scheme, the effective backup data is constructed by analyzing the effective data distribution of the added disks in the backup virtual machine, the hole data of the virtual disks stored by the NFS is filtered, the backup effect similar to the VADP backup scheme can be achieved, the backup efficiency of the NFS storage is improved, and the backup space is saved.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings that are needed in the description of the embodiments or the prior art will be briefly described, and it is obvious that the drawings in the description below are some embodiments of the present application, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
FIG. 1 is a method flow diagram illustrating a method of backing up a virtual machine, according to an example embodiment.
FIG. 2 is a method flow diagram illustrating a method of backing up virtual machines, according to an example embodiment.
FIG. 3 is a backup flow diagram of a virtual machine at full back-up according to an example embodiment.
FIG. 4 is a backup flow diagram of a virtual machine at the time of incremental backup, according to an example embodiment.
FIG. 5 is a snapshot chain diagram illustrating a full backup in accordance with an example embodiment.
FIG. 6 is a schematic diagram of a storage snapshot of a full backup, according to an example embodiment.
FIG. 7 is a diagram illustrating the generation of active backup data at full back-up according to an example embodiment.
FIG. 8 is a snapshot chain diagram illustrating an incremental backup in accordance with an example embodiment.
FIG. 9 is a schematic diagram illustrating the generation of backup data at the time of incremental backup in accordance with an example embodiment.
Fig. 10 is a block diagram illustrating a structure of a backup apparatus of a virtual machine according to an exemplary embodiment.
FIG. 11 illustrates a block diagram of a computer device in accordance with an exemplary embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made apparent and fully in view of the accompanying drawings, in which some, but not all embodiments of the application are shown. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
It should be understood that the "indication" mentioned in the embodiments of the present application may be a direct indication, an indirect indication, or an indication having an association relationship. For example, a indicates B, which may mean that a indicates B directly, e.g., B may be obtained by a; it may also indicate that a indicates B indirectly, e.g. a indicates C, B may be obtained by C; it may also be indicated that there is an association between a and B.
In the description of the embodiments of the present application, the term "corresponding" may indicate that there is a direct correspondence or an indirect correspondence between the two, or may indicate that there is an association between the two, or may indicate a relationship between the two and the indicated, configured, etc.
In the embodiment of the present application, the "predefining" may be implemented by pre-storing corresponding codes, tables or other manners that may be used to indicate relevant information in devices (including, for example, terminal devices and network devices), and the present application is not limited to the specific implementation manner thereof.
The general storage and mounting use modes of vmware super fusion are NFS storage, but in the case of NFS storage, the CBT/VDDK mode can be invalid during full backup, and the effect is equivalent to thick backup; the disk with the size of 10TB is prepared, the actual use space is 10GB, and the backup size is 10TB; therefore, the storage capacity cannot be fully utilized, the backup efficiency is greatly reduced, and the backup space is excessively occupied; therefore, the application provides a backup method of the virtual machine; the method only improves the backup mode of VMWare virtual machines (commonly known as vSAN) stored by using NFS, so as to achieve the purpose of reducing the backup data quantity of the virtual machines under the condition of NFS storage; that is, the virtual machine in the present application is a VMWare virtual machine stored using NFS, and, due to the improvement made to the backup manner, the embodiment needs to use the snapshot capability of the VMWare virtual machine and the snapshot capability of the super-fusion storage.
FIG. 1 is a method flow diagram illustrating a method of backing up a virtual machine, according to an example embodiment. As shown in fig. 1, the method may include the steps of:
step S101, acquiring an original virtual machine to be backed up and disk information of the original virtual machine, and creating a storage snapshot of the original virtual machine according to the original virtual machine and the disk information.
In a possible implementation manner, when the virtual machine is backed up, the original virtual machine to be backed up and disk information thereof need to be acquired on the vSAN super fusion virtualization platform; the original virtual machine to be backed up and the disk information thereof are used for creating a storage snapshot of the original virtual machine so as to realize the backup of the original virtual machine. After the original virtual machine to be backed up and the disk information of the original virtual machine are obtained, a storage snapshot of the original virtual machine can be created according to the original virtual machine to be backed up and the disk information of the original virtual machine.
The storage snapshot is a fully available copy of the specified data set, the copy including an image of the corresponding data at some point in time (the point in time when the copy began); the snapshot may be a copy of the data it represents, or may be a copy of the data. In practical application, online data backup and recovery can be performed according to the storage snapshot, for example, when the storage device fails in application or the file is damaged, rapid data recovery can be performed, and the data can be recovered to a state of a certain available time point.
The original virtual machine to be backed up and the disk information thereof include a CPU, a memory condition, the number of disks and a corresponding provisioning size of the virtual machine.
Step S102, adding the disk corresponding to the storage snapshot to the backup virtual machine, and acquiring the distribution condition of the effective data of the added disk in the backup virtual machine.
In one possible implementation manner, after the storage snapshot of the original virtual machine is created, adding a disk corresponding to the storage snapshot to the backup virtual machine, wherein when the disk corresponding to the storage snapshot is added, the disk may include an original disk and a snapshot disk, the original disk is a father disk of the snapshot disk relatively, and the original disk stores original data; the snapshot disk is a sub-disk of the original disk relatively, and because the snapshot is made to the virtual machine, the snapshot disk essentially records the disk data of the virtual machine at a certain time point, and therefore the snapshot disk stores the change data of the original disk at a certain time point.
Step S103, obtaining effective backup data according to the distribution condition.
In one possible implementation manner, the distribution condition of the valid data of the added disk in the backup virtual machine is obtained, the distribution condition is analyzed at this time, valid data and invalid data exist in the disk, and the valid data of each disk are combined, so that valid backup data can be obtained.
Step S104, the effective backup data is recorded to a backup server, and backup points are generated and stored.
In one possible implementation, after the valid backup data is obtained, a consistent snapshot may be made of all volume files by the backup server, and the consistent snapshot is saved as a backup point.
In summary, the method includes the steps of obtaining an original virtual machine to be backed up and disk information of the original virtual machine, and creating a storage snapshot of the original virtual machine according to the original virtual machine and the disk information; adding the disk corresponding to the storage snapshot to a backup virtual machine, and acquiring the distribution condition of the effective data of the added disk in the backup virtual machine; then according to the distribution condition, obtaining effective backup data; and recording the effective backup data to a backup server, generating backup points and storing the backup points. According to the scheme, the effective backup data is constructed by analyzing the effective data distribution of the added disks in the backup virtual machine, the hole data of the virtual disks stored by the NFS is filtered, the backup effect similar to the VADP backup scheme can be achieved, the backup efficiency of the NFS storage is improved, and the backup space is saved.
FIG. 2 is a method flow diagram illustrating a method of backing up virtual machines, according to an example embodiment. As shown in fig. 2, the method may include the steps of:
step 201, obtaining an original virtual machine to be backed up and disk information of the original virtual machine, and creating a storage snapshot of the original virtual machine according to the original virtual machine and the disk information.
In one possible implementation, before acquiring the original virtual machine to be backed up and disk information of the original virtual machine, creating a backup server; the backup server is used for deploying backup programs.
In one possible implementation, the backup includes a full backup and an incremental backup; the step S201 includes:
creating a backup snapshot of the original virtual machine according to the original virtual machine and the disk information;
when the full-volume backup is performed, creating a full-volume storage snapshot of the original virtual machine according to the disk information of the current backup snapshot of the original virtual machine;
and during incremental backup, creating an incremental storage snapshot of the original virtual machine according to disk information between the previous backup snapshot and the current backup snapshot of the original virtual machine.
Further, during full-scale backup, please refer to the backup flowchart of the virtual machine during full-scale backup shown in fig. 3, firstly, the original virtual machine to be backed up and the disk information of the original virtual machine are obtained, firstly, a backup snapshot backup-snapp 1.Vmdk of the original virtual machine is created, then a storage interface is called, and a storage snapshot is created for all volumes (including snapshot volumes) of the original virtual machine, so that a full-scale storage snapshot is obtained;
at this time, sequentially adding the disks corresponding to the current storage snapshot and the snapshot disks to the backup virtual machine according to the parent-child relationship; then, analyzing the effective data in the disk and the snapshot disk, acquiring the distribution condition of the effective data, constructing first effective backup data, and writing the first effective backup data into the backup storage; and deleting the corresponding storage snapshot when the current disk backup is completed.
In the incremental backup, please refer to the backup flow chart of the virtual machine in the incremental backup shown in fig. 4, firstly, the original virtual machine to be backed up and the disk information of the original virtual machine are obtained, under the condition that the backup snapshot backup-snapp 1.Vmdk is normal, the backup snapshot backup-snapp 2.Vmdk of the original virtual machine is created, and then a storage interface is called, and the disk information between the previous backup snapshot to the current backup snapshot of the original virtual machine is made into a storage snapshot, so as to obtain the incremental storage snapshot;
at this time, snapshot disks between the previous backup snapshot and the current backup snapshot are sequentially added to the backup virtual machine according to the parent-child relationship; then, analyzing the effective data in the disk and the snapshot disk, acquiring the distribution condition of the effective data, constructing second effective backup data, and writing the second effective backup data into the backup storage; and deleting the corresponding storage snapshot when the current disk backup is completed.
Step S202, adding the disk corresponding to the storage snapshot to the backup virtual machine, and obtaining the distribution condition of the effective data of the added disk in the backup virtual machine.
In one possible implementation, the step S202 includes:
when full backup is performed, sequentially adding the disk corresponding to the current stored snapshot and the snapshot disk to the backup virtual machine according to the parent-child relationship;
and when in incremental backup, the snapshot disks between the previous backup snapshot and the current backup snapshot are sequentially added to the backup virtual machine according to the parent-child relationship.
In step S203, in the backup virtual machine, the distributed block information of the valid data is sequentially parsed in the order from the parent disk to the child snapshot disk.
And S204, integrating and updating the distributed block information of each disk to obtain effective backup data.
In one possible implementation manner, during full-scale backup, dividing the added parent disk and child snapshot disk in the backup virtual machine into data blocks according to the sequence from the parent disk to the child snapshot disk at a specified word length;
and for the same data block, replacing and updating the effective data of the parent disk by the effective data of the child snapshot disk to construct first effective backup data.
When in incremental backup, dividing the added sub-snapshot disk in the backup virtual machine into various data blocks according to the appointed word length;
and carrying out replacement updating on the effective data of the sub-snapshot disk and the first effective backup data to construct second effective backup data.
Illustratively, the specified word length is a 4K word length.
Further, in the full-scale backup, please refer to the snapshot chain diagram of the full-scale backup shown in fig. 5; FIG. 5 includes two snapshot chains, a VMWare snapshot chain (i.e., a backup snapshot chain) and a storage snapshot chain, respectively, the VMWare snapshot chain and the storage snapshot chain being in one-to-one correspondence; the VMWare snapshot chain includes: base. Vmdk, 000001.Delta. Vmdk, backup-snapp 1.Vmdk; storing the snapshot includes: base. Vmdk, 000001.Delta. Vmdk, backup-snapp 1.Vmdk; wherein, the base.vmmdk in the VMWare snapshot chain and the storage snapshot chain are the original disk, 000001.delta.vmdk and backup-snap1.Vmdk are both snapshot disks, the base.vmdk is the parent disk of the snapshot disks (000001.delta.vmdk and backup-snap1. Vmdk), and in the snapshot disks, 000001.delta.vmdk is the parent snapshot disk of backup-snap1. Vmdk.
Firstly, when full-volume backup is performed, firstly, a VMWare snapshot chain is created for an original virtual machine to be backed up through a vsphere interface, then, a storage snapshot is made from a base.vmdk to a snapshot disk above through a storage snapshot, and the storage snapshot chain is obtained (the snapshot disk attribute corresponding to the storage snapshot is required to be added to a backup virtual machine in the follow-up process, and the operation of directly making the operation on the produced disk is illegal);
at this time, referring to the storage snapshot schematic diagram of the full-volume backup shown in fig. 6, for convenience of understanding, the embodiment makes one storage snapshot for all virtual disks, and in actual production, the full-volume backup only needs to make the storage snapshot for the parent disk of backup-snapp 1.Vmdk (i.e. 000001.Delta. Vmdk) until base. And the incremental backup is performed, and only the disk between the snapshot of the last backup and the snapshot of the current backup is needed to be used for storing the snapshot. As shown in fig. 6, the snapshot disks (non-production disks) base, 000001-delta, vmdk corresponding to the storage snapshot are mounted with the attach to vm (virtual machine), the base, vmdk is the parent disk of 000001-delta, vmdk, 000001-delta, vmdk is the child snapshot disk of base, vmdk, and two corresponding block devices vdb, vdc (for example, herein, are seen in vm guestons (operating system);
if the metadata of the block device vdc is parsed to obtain the distribution situation of the valid data blocks, the following steps are required:
a. dividing a base.vmdk father disk and a 000001.delta.vmdk child snapshot disk into a plurality of data blocks with the size of 4K according to the fixed length of 4K (namely the specified word length can be designed according to actual needs); it should be noted that only the base. Vmdk parent disk can be divided into blocks in a fixed length manner by directly filtering the hole file; the delta. Vmdk sub-snapshot disk is dynamically increased in the use process, so that the header area of the vmdk needs to be analyzed to obtain the distribution of effective data blocks; as described above, that is, at the time of full-volume backup, the parent disk (base. Vmdk) added to the backup virtual machine is divided by a specified word length in order from the parent disk (base. Vmdk) to the child snapshot disk (000001. Delta. Vmdk) based on the manner of filtering the hole file; the added sub-snapshot disks (000001. Delta. Vmdk) in the backup virtual machine are divided by a specified word length based on the manner of parsing the object header area (i.e., parsing the header area of vmdk).
b. If the divided 4K data block is not the hole data, the data block is a valid data block.
c. If the same data block is a valid data block in both the child snapshot disk (000001. Delta. Vmdk) and the parent disk (base. Vmdk), the valid data of the data block takes the latest snapshot disk data.
d. And constructing metadata of the data to be backed up according to the rules, thereby constructing the first effective backup data.
At this time, please refer to the generation schematic diagram of the backup data in full backup shown in fig. 7; as shown in fig. 7, the left-dark shaded box represents the distribution of a certain consecutive data block in base. The left two light shaded boxes represent the data distribution of consecutive blocks of data in 000001-delta. Vmdk (child snapshot disk) that are co-located with the above base.
The right color mixture represents the data distribution of the consecutive data blocks in the integrated base. Vmdk (/ dev/vdb), 000001-delta. Vmdk (/ dev/vdc), and the data to be retrieved for full back-up.
And (3) backing up, namely according to the database distribution shown in the right hand side, reading the effective data blocks from the corresponding logical positions of the corresponding disk files, and writing the effective data blocks into a backing up point backup1 (namely, constructing first effective backing up data).
As shown in the above schematic diagram, in the continuous 160KB area, the actual backup data amount is 40KB, and according to the normal VADP scheme, the backup data amount of the continuous area is 160KB, if the backup data amount is scaled up to a 10TB backup disk, the effect of the present scheme is obvious.
In an extreme case, for example, each disk is 100% full (it is impossible for the system to operate normally), each snapshot disk is constructed with a valid data block that is all full, and the last snapshot disk contains the latest data, that is, all backup data is copied from the last snapshot disk, and the backup size does not exceed the disk allocation size (that is, in the extreme case, the scheme of the present embodiment is not inferior to the backup data size of the VADP scheme).
The following expression JSON (JavaScript Object Notation) is illustrated as follows: (the start physical address and the offset logical address can be obtained by using the method of resolving the header area of vmdk for the sub-snapshot disk (000001-delta. Vmdk), and in the scheme, the sub-snapshot disk is mapped into a block device in the backup service virtual machine, so that the vmdk header needs to be resolved and read according to the offset):
{"start":0,"length":4096,"depth":1,"zero":false,"data":true,"offset":0},
{"start":4096,"length":4096,"depth":0,"zero":false,"data":true,"offset":106012160},
{"start":8192,"length":4096,"depth":1,"zero":false,"data":true,"offset":1049088}
......
as above, start represents the physical starting position in the compact disk file, length is the size of the current valid data block, depth0 represents the current latest child snapshot disk, depth1 represents the parent disk of the current latest child snapshot disk, depth2 and so on. zero true represents hole data, data true represents effective data, and offset represents a logical address corresponding to a physical address in a file system;
schematic representation of the first three data blocks, the first data block at base. Vmdk (/ dev/vdb), logical, physical offset 0 starting read 4096 bytes in length; the second data block starts reading 4096 bytes in length at 000001-delta.vmdk (/ dev/vdc), logical offset106012160 (physical offset 4096); the third data block starts reading 4096 bytes in length at base. Vmdk (/ dev/vdb), logical offset1049088 (physical offset 8192). And so on until the last data block; the construction of the effective backup data is completed when the full-volume backup is completed.
Accordingly, during incremental backup, please refer to the snapshot chain schematic diagram of the incremental backup shown in fig. 8; like the full-volume backup snapshot chain, FIG. 8 also includes two snapshot chains, a VMWare snapshot chain (i.e., backup snapshot chain) and a storage snapshot chain, which are in one-to-one correspondence with each other; the VMWare snapshot chain includes: base. Vmdk, 000001.Delta. Vmdk, backup-snap1.vmdk, backup-snap2.vmdk; storing the snapshot includes: base. Vmdk, 000001.Delta. Vmdk, backup-snap1.vmdk, backup-snap2.vmdk; wherein, the VMWare snapshot chain and the base.vmdk in the storage snapshot chain are the original disk, 000001.Delta.vmdk, backup-snap1.Vmdk and backup-snap2.Vmdk are all snapshot disks, the base.vmdk is the parent disk of the snapshot disks (000001. Delta.vmdk, backup-snap1.Vmdk and backup-snap2. Vmdk), and in the snapshot disks, 000001.Delta.vmdk is the parent snapshot disk of backup-snap1.Vmdk; it can be seen that the incremental backup is more backup-snapp 2.Vmdk than the full backup. Assuming that after full-scale backup, the user does not create a snapshot (the user creates and deletes the snapshot without influence, but cannot actively delete the snapshot created by backup, otherwise, the next incremental backup is converted into full-scale backup), and then the full-scale backup creates a new backup snapshot backup-snapp 2.Vmdk.
Because after creating the backup-snap1 snapshot, all IOs of the virtual machine will fall above the backup-snap1.Vmdk, the parent disk chain of the backup-snap1.Vmdk will change to read-only state.
At the moment, the backup-snapp 1.Vmdk of the stored snapshot disk (namely, the snapshot disk between the previous backup snapshot and the current backup snapshot) is attached to the backup virtual machine;
after attach, backup-snapp 1.Vmdk is visible as a piece of equipment in the backup service virtual machine, assumed to be/dev/vde; at this time, please refer to the schematic diagram of generating backup data during incremental backup shown in fig. 9; as shown in FIG. 9, FIG. 9 illustrates the same contiguous 160KB data block as the full backup, with the left lighter shaded square being the valid data block in the contiguous data block region acquired by backup-snap1.vmdk (i.e./dev/vde);
the right color mixing representation is used for writing the effective data blocks of the area into a backup1 backup point (namely, the effective data of the sub-snapshot disk and the first effective backup data are replaced and updated, wherein the sub-snapshot disk is backup-snapp 1.Vmdk, and the first effective backup data is the backup1 backup point) to generate a new incremental backup point backup2 (namely, the second effective backup data); backup2 is an incremental synthetic backup point, and contains the complete data of the virtual disk at the current backup time.
And deleting backup-snap1 after the incremental backup is completed, and deleting the snapshot of the current backup storage layer. (i.e., delete the last backed up vmware snapshot, multiple incremental backups, and so on).
When the backup is restored, the operation is consistent with the restoration operation using the VADP scheme, and the scheme is not repeated.
Step S205, the effective backup data is recorded to a backup server, and backup points are generated and stored.
In summary, the method includes the steps of obtaining an original virtual machine to be backed up and disk information of the original virtual machine, and creating a storage snapshot of the original virtual machine according to the original virtual machine and the disk information; adding the disk corresponding to the storage snapshot to a backup virtual machine, and acquiring the distribution condition of the effective data of the added disk in the backup virtual machine; then according to the distribution condition, obtaining effective backup data; and recording the effective backup data to a backup server, generating backup points and storing the backup points. According to the scheme, the effective backup data is constructed by analyzing the effective data distribution of the added disks in the backup virtual machine, the hole data of the virtual disks stored by the NFS is filtered, the backup effect similar to the VADP backup scheme can be achieved, the backup efficiency of the NFS storage is improved, and the backup space is saved.
Fig. 10 is a block diagram illustrating a structure of a backup apparatus of a virtual machine according to an exemplary embodiment. The device comprises:
the storage snapshot creation module 1001 is configured to obtain an original virtual machine to be backed up and disk information of the original virtual machine, and create a storage snapshot of the original virtual machine according to the original virtual machine and the disk information;
the effective data distribution situation obtaining module 1002 is configured to add a disk corresponding to the storage snapshot to a backup virtual machine, and obtain a distribution situation of effective data of the added disk in the backup virtual machine;
an effective backup data obtaining module 1003, configured to obtain effective backup data according to the distribution situation;
the active data backup module 1004 is configured to record the active backup data to a backup server, generate a backup point, and store the backup point.
In one possible embodiment, the device is further adapted to:
creating a backup server; the backup server is used for deploying backup programs.
In one possible implementation, the backup includes a full backup and an incremental backup; the storage snapshot creation module 1001 is further configured to:
creating a backup snapshot of the original virtual machine according to the original virtual machine and the disk information;
when the full-volume backup is performed, creating a full-volume storage snapshot of the original virtual machine according to the disk information of the current backup snapshot of the original virtual machine;
and during incremental backup, creating an incremental storage snapshot of the original virtual machine according to disk information between the previous backup snapshot and the current backup snapshot of the original virtual machine.
In one possible implementation, the valid data distribution situation obtaining module 1002 is further configured to:
and when the full-volume backup is performed, sequentially adding the disk corresponding to the current storage snapshot and the snapshot disk to the backup virtual machine according to the parent-child relationship.
In one possible implementation, the valid data distribution situation obtaining module 1002 is further configured to:
and when in incremental backup, the snapshot disks between the previous backup snapshot and the current backup snapshot are sequentially added to the backup virtual machine according to the parent-child relationship.
In one possible implementation, the active backup data acquisition module 1003 is further configured to:
in the backup virtual machine, sequentially analyzing the distributed block information for constructing effective data according to the sequence from a parent disk to a child snapshot disk;
and integrating and updating the distributed block information of each disk to obtain effective backup data.
In one possible implementation, the active backup data acquisition module 1003 is further configured to:
when the full backup is performed, dividing the added parent disk and child snapshot disk in the backup virtual machine into data blocks according to the sequence from the parent disk to the child snapshot disk by the appointed word length;
and when the full backup is performed, for the same data block, the data blocks which are valid data in the parent disk and the child snapshot disk are replaced and updated by the valid data of the child snapshot disk so as to construct first valid backup data.
In one possible implementation, the active backup data acquisition module 1003 is further configured to:
when in incremental backup, dividing the added sub-snapshot disk in the backup virtual machine into various data blocks according to the appointed word length;
and in the incremental backup, the effective data of the sub-snapshot disk and the first effective backup data are replaced and updated to construct second effective backup data.
In summary, the method includes the steps of obtaining an original virtual machine to be backed up and disk information of the original virtual machine, and creating a storage snapshot of the original virtual machine according to the original virtual machine and the disk information; adding the disk corresponding to the storage snapshot to a backup virtual machine, and acquiring the distribution condition of the effective data of the added disk in the backup virtual machine; then according to the distribution condition, obtaining effective backup data; and recording the effective backup data to a backup server, generating backup points and storing the backup points. According to the scheme, the effective backup data is constructed by analyzing the effective data distribution of the added disks in the backup virtual machine, the hole data of the virtual disks stored by the NFS is filtered, the backup effect similar to the VADP backup scheme can be achieved, the backup efficiency of the NFS storage is improved, and the backup space is saved.
Referring to fig. 11, a schematic diagram of a computer device according to an exemplary embodiment of the present application is provided, where the computer device includes a memory and a processor, and the memory is configured to store a computer program, and when the computer program is executed by the processor, implement a virtual machine backup method as described above.
The processor may be a central processing unit (Central Processing Unit, CPU). The processor may also be any other general purpose processor, digital signal processor (Digital Signal Processor, DSP), application specific integrated circuit (Application Specific Integrated Circuit, ASIC), field programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination thereof.
The memory, as a non-transitory computer readable storage medium, may be used to store non-transitory software programs, non-transitory computer-executable programs, and modules, such as program instructions/modules, corresponding to the methods in embodiments of the present application. The processor executes various functional applications of the processor and data processing, i.e., implements the methods of the method embodiments described above, by running non-transitory software programs, instructions, and modules stored in memory.
The memory may include a memory program area and a memory data area, wherein the memory program area may store an operating system, at least one application program required for a function; the storage data area may store data created by the processor, etc. In addition, the memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid state storage device. In some implementations, the memory optionally includes memory remotely located relative to the processor, the remote memory being connectable to the processor through a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
In an exemplary embodiment, a computer readable storage medium is also provided for storing at least one computer program that is loaded and executed by a processor to implement all or part of the steps of the above method. For example, the computer readable storage medium may be Read-Only Memory (ROM), random-access Memory (Random Access Memory, RAM), compact disc Read-Only Memory (CD-ROM), magnetic tape, floppy disk, optical data storage device, and the like.
Other embodiments of the application will be apparent to those skilled in the art from consideration of the specification and practice of the application disclosed herein. This application is intended to cover any variations, uses, or adaptations of the application following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the application pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the application being indicated by the following claims.
It is to be understood that the application is not limited to the precise arrangements and instrumentalities shown in the drawings, which have been described above, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the application is limited only by the appended claims.

Claims (10)

1. A method for backing up a virtual machine, the method comprising:
acquiring an original virtual machine to be backed up and disk information of the original virtual machine, and creating a storage snapshot of the original virtual machine according to the original virtual machine and the disk information;
adding a disk corresponding to the storage snapshot to a backup virtual machine, and acquiring the distribution condition of effective data of the added disk in the backup virtual machine;
acquiring effective backup data according to the distribution condition;
and recording the effective backup data to a backup server, generating backup points and storing the backup points.
2. The method of claim 1, wherein prior to the obtaining the original virtual machine to be backed up and the disk information of the original virtual machine, the method further comprises:
creating a backup server; the backup server is used for deploying backup programs.
3. The method of claim 1, wherein the backups include full backups and incremental backups; the creating a storage snapshot of the original virtual machine according to the original virtual machine and the disk information includes:
creating a backup snapshot of the original virtual machine according to the original virtual machine and the disk information;
when the full-volume backup is performed, creating a full-volume storage snapshot of the original virtual machine according to the disk information of the current backup snapshot of the original virtual machine;
and during incremental backup, creating an incremental storage snapshot of the original virtual machine according to disk information between the previous backup snapshot and the current backup snapshot of the original virtual machine.
4. The method of claim 3, wherein adding the disk corresponding to the storage snapshot to a backup virtual machine comprises:
and when the full backup is performed, sequentially adding the disks corresponding to the current storage snapshot and the snapshot disks to the backup virtual machine according to the parent-child relationship.
5. The method of claim 3, wherein adding the disk corresponding to the storage snapshot to a backup virtual machine comprises:
and when the backup is performed in an incremental mode, snapshot disks between the previous backup snapshot and the current backup snapshot are sequentially added to the backup virtual machine according to the parent-child relationship.
6. The method according to any one of claims 3 to 5, wherein the obtaining valid backup data according to the distribution condition includes:
in the backup virtual machine, sequentially analyzing the distributed block information for constructing effective data according to the sequence from a parent disk to a child snapshot disk;
and integrating and updating the distributed block information of each disk to obtain effective backup data.
7. The method of claim 6, wherein sequentially parsing the distributed block information constituting the valid data in the backup virtual machine in order from the parent disk to the child snapshot disk comprises:
when the full backup is performed, dividing the added parent disk and child snapshot disk in the backup virtual machine into data blocks according to the sequence from the parent disk to the child snapshot disk by the appointed word length;
the integrating and updating the distributed block information of each disk comprises the following steps:
and when the full backup is performed, for the same data block, the data blocks which are valid data in the parent disk and the child snapshot disk are replaced and updated by the valid data of the child snapshot disk so as to construct first valid backup data.
8. The method of claim 7, wherein sequentially parsing the distributed block information constituting the valid data in the backup virtual machine in order from the parent disk to the child snapshot disk comprises:
dividing the added sub-snapshot disk in the backup virtual machine into various data blocks according to the appointed word length during incremental backup;
the integrating and updating the distributed block information of each disk comprises the following steps:
and in the incremental backup, the effective data of the sub-snapshot disk and the first effective backup data are replaced and updated to construct second effective backup data.
9. A backup apparatus for a virtual machine, the apparatus comprising:
the storage snapshot creation module is used for obtaining an original virtual machine to be backed up and disk information of the original virtual machine, and creating a storage snapshot of the original virtual machine according to the original virtual machine and the disk information;
the effective data distribution condition acquisition module is used for adding the disk corresponding to the storage snapshot to a backup virtual machine and acquiring the distribution condition of the effective data of the added disk in the backup virtual machine;
the effective backup data acquisition module is used for acquiring effective backup data according to the distribution condition;
and the effective data backup module is used for recording the effective backup data to a backup server, generating backup points and storing the backup points.
10. A computer device comprising a processor and a memory, the memory having stored therein at least one instruction that is loaded and executed by the processor to implement a method of backing up a virtual machine as claimed in any one of claims 1 to 8.
CN202310972060.9A 2023-08-02 2023-08-02 Backup method and device for virtual machine Pending CN117032884A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310972060.9A CN117032884A (en) 2023-08-02 2023-08-02 Backup method and device for virtual machine

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310972060.9A CN117032884A (en) 2023-08-02 2023-08-02 Backup method and device for virtual machine

Publications (1)

Publication Number Publication Date
CN117032884A true CN117032884A (en) 2023-11-10

Family

ID=88625569

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310972060.9A Pending CN117032884A (en) 2023-08-02 2023-08-02 Backup method and device for virtual machine

Country Status (1)

Country Link
CN (1) CN117032884A (en)

Similar Documents

Publication Publication Date Title
US9946603B1 (en) Mountable container for incremental file backups
US9996429B1 (en) Mountable container backups for files
US9348827B1 (en) File-based snapshots for block-based backups
US7634627B1 (en) System and method for performing extent level backups that support single file restores
US10078555B1 (en) Synthetic full backups for incremental file backups
US20130006939A1 (en) Systems and methods for reliably managing files in a computer system
US11093387B1 (en) Garbage collection based on transmission object models
CN101364166B (en) Method and device for simulating Nand flash of 2048 byte page into hard disk
US6636941B1 (en) Enhanced stable disk storage
US10628298B1 (en) Resumable garbage collection
EP3474143B1 (en) Method and apparatus for incremental recovery of data
CN107463467B (en) Method and system capable of quickly restoring virtualization platform
CN113568582B (en) Data management method, device and storage equipment
US20190370127A1 (en) Image recovery from volume image files
US20130339309A1 (en) Dynamic discovery of storage resource topology
CN115098299A (en) Backup method, disaster recovery method, device and equipment for virtual machine
CN106709014B (en) File system conversion method and device
US10459807B2 (en) Determining modified portions of a RAID storage array
CN108572888B (en) Disk snapshot creating method and disk snapshot creating device
US20190391966A1 (en) Online file system check using file system clone
WO2022105442A1 (en) Erasure code-based data reconstruction method and appratus, device, and storage medium
CN113641446A (en) Memory snapshot creating method, device and equipment and readable storage medium
CN114026545A (en) Snapshot for arbitrary point in time replication
CN117032884A (en) Backup method and device for virtual machine
CN114327292B (en) File management method, system, electronic device and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination