Snapshot-based stateless virtual machine backup method and storage medium

By distinguishing the backup method of the system disk and data disk, basic image cloning and full/incremental backup are used to solve the impact of system disk restart or shutdown automatic restoration on the data disk in stateless virtual machine backup, achieving efficient and secure virtual machine data backup.

CN120429165APending Publication Date: 2025-08-05FUJIAN CENTM INFORMATION
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510326410.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-19
Publication Date
2025-08-05

AI Technical Summary

Technical Problem

In stateless virtual machine backup, restarting or shutting down of the system disk will affect the snapshot data integrity of the data disk, resulting in inaccurate backup and wasted storage space.

Method used

By distinguishing the backup method of the system disk and the data disk, the system disk is backed up based on the basic image cloning, and the data disk uses full or incremental backup, which restricts only data disk snapshots to ensure the accuracy of the data disk image chain.

Benefits of technology

It realizes efficient backup of stateless virtual machines, reduces storage space usage, ensures that independent backup of data disks is not affected by system disk restore, meets customers' different data backup needs, and ensures data security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120429165A_ABST
    Figure CN120429165A_ABST
Patent Text Reader

Abstract

The invention discloses a stateless virtual machine backup method based on snapshots and a storage medium. The stateless virtual machine backup method comprises the following steps: acquiring a current mirror chain of each disk of a stateless virtual machine; judging whether a basic mirror image of the stateless virtual machine system disk is stored or not, and if not, storing the basic mirror image; judging whether the data disk is backed up or not, if yes, obtaining the position of the nearest backup data in the mirror chain, and performing incremental backup based on the backup data; if not, carrying out full-quantity backup on the data disk; updating the mirror chain; only the snapshot containing the data disk is allowed to be created in the limited startup state, and management data of the stateless virtual machine startup snapshot always points to the top end of a corresponding data disk mirror chain; while the restarted or shut-down system disk is ensured to be automatically restored, the full-amount and incremental backup of other disks of the stateless virtual machine is realized, and the influence of restoration is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of virtual machine backup, and in particular to a snapshot-based stateless virtual machine backup method and storage medium. Background Art

[0002] The essence of virtual machine backup is the backup of virtual disk data and configurations, such as CPU, memory, display devices, etc. Data backup cannot always be a full backup, which requires a high capacity of storage space and will also make the backup time too long, so incremental backup must be considered. For common kvm virtual machines, there are two common ways to obtain incremental data. One is to use a command similar to qemu-monitor-command to obtain the changed data and incrementally back up the virtual machine. The other is to use the power-on snapshot method to create an incremental snapshot relative to the previously backed up part, and download and merge the snapshot data to incrementally back up the virtual machine. Snapshot-based backup cannot achieve the backup of each IO, but it is relatively simple and is more suitable for scenarios where the real-time requirements for backup and recovery are not so high.

[0003] A stateless virtual machine is a virtual machine that can automatically restore to its initial state after shutting down or restarting. It is a common way to use a virtual machine. In actual projects, the more common requirement for daily use by users is partial restoration, where personal data and user configurations are not restored, while other parts are restored. For this reason, it is generally necessary to separate the data restoration of the virtual machine from the non-restoration part. The most common method that conforms to usage habits is to restore the system disk and not restore other disks. The composition of a stateless virtual machine is generally as follows: Figure 1 As shown in the figure, the system disk is generated from a base parent image to generate a difference disk. Different virtual machines have different difference disks. Virtual machines may also have varying numbers of data disks.

[0004] Generally, open source projects such as oVirt or other cloud computing vendors' products are based on snapshots to implement the stateless virtual machine function, such as Figure 2 As shown in the following figure. The implementation method is to create a snapshot before booting, which can include all disks of the virtual machine or only the system disk. When shutting down, the snapshot will be automatically restored or manually restored, and the old snapshot before booting will be deleted to reduce the storage space occupied. The disk mirror chain and deletion are as follows Figure 3 shown.

[0005] Simply use snapshot restoration. Because there are parts of stateless virtual machines that cannot be restored, customers will also need to back up this part of the data to ensure the security of the virtual machine data and prevent records from being tampered with, so as to facilitate accountability and review of accidents.

[0006] However, unlike snapshot maintenance for ordinary virtual machines, since stateless virtual machines automatically restore the startup snapshot upon shutdown or restart, by default the restore will restore the state of the virtual machine's disk management data at the time the snapshot was created. Since incremental backups require the creation of temporary snapshots, if the management data of the startup snapshot is not modified accordingly, subsequent snapshot data will become abnormal. Therefore, it is necessary to modify the management data that records changes in the startup snapshot to ensure data integrity and prevent automatic restores from causing abnormalities in the virtual machine's system or management data, or restoring data disk data to the time of startup. Summary of the Invention

[0007] The technical problem to be solved by the present invention is to provide a stateless virtual machine backup method and storage medium based on snapshots, which ensures that the system disk is automatically restored when restarted or shut down, while realizing full and incremental backup of other disks of the stateless virtual machine without being affected by the restoration.

[0008] In order to solve the above technical problems, the technical solution adopted by the present invention is: A snapshot-based stateless virtual machine backup method includes the following steps: S1. Get the current mirror chain of each disk of the stateless virtual machine; S2. Determine whether the base image of the stateless virtual machine system disk has been stored, and if not, store the base image; S3. Determine whether the data disk has been backed up. If so, obtain the position of the most recent backup data in the mirror chain and perform incremental backup based on the backup data; if not, perform a full backup of the data disk; and update the mirror chain.

[0009] In order to solve the above technical problems, the technical solution adopted by the present invention is: A storage medium having a computer program stored thereon, wherein when the computer program is executed, the following steps are implemented: S1. Get the current mirror chain of each disk of the stateless virtual machine; S2. Determine whether the base image of the stateless virtual machine system disk has been stored, and if not, store the base image; S3. Determine whether the data disk has been backed up. If so, obtain the position of the most recent backup data in the mirror chain and perform incremental backup based on the backup data; if not, perform a full backup of the data disk; and update the mirror chain.

[0010] The beneficial effects of the present invention are as follows: the present invention provides a stateless virtual machine backup method and storage medium based on snapshots, in which the system disk is a differential disk cloned from a base image, and only the base image needs to be backed up, thus avoiding repeated full backups of the system disk and saving storage space; for the data disk, a full backup is used for the first backup, and subsequent incremental backups are performed through temporary snapshots, thus reducing the amount of backup data and time; the system disk and the data disk are treated differently, and the system disk can be automatically restored when the system is shut down and restored by backing up the base image; the data disk can be backed up in full and incrementally, thus meeting the customer's backup requirements for different parts of the stateless virtual machine data and ensuring the security of the virtual machine data. The restore operation of the system disk will not affect the mirror chain of the data disk, and the mirror chain of the data disk can continuously and accurately reflect the changes in the data disk itself. Therefore, the data disk can independently perform full or incremental backups based on its own mirror chain information without being interfered with by the restore operation of the system disk. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] Figure 1 This is an example diagram of the composition of a virtual machine disk involved in the background technology of the present invention; Figure 2 This is an example diagram of a stateless virtual machine implementation involved in the background technology of the present invention; Figure 3 This is an example diagram of the disk mirror chain and snapshot deletion process involved in the background technology of the present invention; Figure 4 This is a brief flowchart of a snapshot-based stateless virtual machine backup method according to an embodiment of the present invention; Figure 5 This is an example diagram of a system disk backup process of a stateless virtual machine backup method based on snapshots according to an embodiment of the present invention; Figure 6 This is an example diagram of a data disk backup process of a snapshot-based stateless virtual machine backup method according to an embodiment of the present invention. DETAILED DESCRIPTION

[0012] To illustrate the technical content, achieved objectives and effects of the present invention in detail, the following description is given in conjunction with the embodiments and accompanying drawings.

[0013] Please refer to Figure 4-6 A snapshot-based stateless virtual machine backup method includes the following steps: S1. Get the current mirror chain of each disk of the stateless virtual machine; S2. Determine whether the base image of the stateless virtual machine system disk has been stored, and if not, store the base image; S3. Determine whether the data disk has been backed up. If so, obtain the position of the most recent backup data in the mirror chain and perform incremental backup based on the backup data; if not, perform a full backup of the data disk; and update the mirror chain.

[0014] From the above description, it can be seen that the beneficial effects of the present invention are: a snapshot-based stateless virtual machine backup method of the present invention, the system disk is based on the differential disk cloned from the base image, and only the base image needs to be backed up, avoiding repeated full backups of the system disk and saving storage space; for the data disk, the first backup is a full backup, and subsequent incremental backups are performed through temporary snapshots, reducing the amount of data and time of backup; the system disk and the data disk are treated differently, and the system disk can be automatically restored when the system is shut down and restored by backing up the base image; the data disk can be backed up in full and incrementally, meeting the customer's backup needs for different parts of the stateless virtual machine data and ensuring the security of the virtual machine data. The restore operation of the system disk will not affect the mirror chain of the data disk, and the mirror chain of the data disk can continuously and accurately reflect the changes of the data disk itself. Therefore, the data disk can independently perform full or incremental backups based on its own mirror chain information without being interfered with by the restore operation of the system disk.

[0015] Furthermore, performing incremental backup based on the backup data is specifically as follows: Based on the position of the most recent backup data in the mirror chain, the starting point of the current backup operation relative to the previous backup state is determined, and the incremental data is further determined; A temporary snapshot is created to capture the incremental data to obtain an incremental backup snapshot, the incremental backup snapshot is downloaded and saved, and the incremental backup data is exported.

[0016] As can be seen from the above description, by determining the backup starting point and incremental data, you can precisely locate the changed data that needs to be backed up, avoiding backing up large amounts of unchanged data, improving backup efficiency, and reducing storage space usage. Creating temporary snapshots to capture incremental data and saving them as incremental backup snapshots ensures the integrity and traceability of incremental data, facilitating subsequent data recovery operations. Exporting incremental backup data allows you to store the backup data in a specified location for long-term storage and management.

[0017] Furthermore, the method further comprises the steps of: Restriction: Only snapshots containing data disks are allowed to be created in the boot state, and the management data of the stateless virtual machine startup snapshot always points to the top of the corresponding data disk image chain.

[0018] As can be seen from the above description, due to the shutdown and restore feature of the system disk, there is actually no need for real-time backup of the system disk. However, for stateless virtual machine backup, there is actually a need for real-time backup of the data disk data. Therefore, the creation of snapshots in the powered-on state is restricted to only those containing data disks, and the management data of the stateless virtual machine startup snapshot always points to the top of the corresponding data disk image chain. Restricting the creation of snapshots in the powered-on state to only those containing data disks prevents unnecessary snapshot operations on the system disk during the boot process, avoids problems such as abnormal virtual machine management data caused by automatic restoration of the system disk at shutdown, and ensures the stable operation of the virtual machine. The management data of the stateless virtual machine startup snapshot always points to the top of the corresponding data disk image chain, so that when the virtual machine is shut down and restored or restarted, the data on the data disk is normal and consistent with the state before the shutdown or restart, and is not affected by the automatic restoration of the startup snapshot.

[0019] Furthermore, performing incremental backup based on the backup data further includes: Delete the incremental backup snapshot obtained in the previous execution.

[0020] As can be seen from the above description, deleting the previous incremental backup snapshot frees up storage space, avoids storing large amounts of outdated backup data, and reduces storage costs. At the same time, it maintains the simplicity of the backup system and reduces the complexity of data management.

[0021] Furthermore, the incremental backup data obtained by exporting is specifically as follows: The incremental backup data is exported in different formats according to different storage platforms.

[0022] As can be seen from the above description, different storage platforms have different requirements for data formats. Adapting the export format according to the storage platform can ensure that the backup data can be correctly stored and used on various storage platforms, thereby improving the compatibility and versatility of the backup method.

[0023] Furthermore, step S1 also obtains the configuration information of the stateless virtual machine, which includes operating system information, CPU information, memory configuration, and virtual disk information. The virtual disk information includes the storage method and format of the virtual disk, disk type, and the current mirror chain information of the disk.

[0024] A storage medium having a computer program stored thereon, wherein when the computer program is executed, the following steps are implemented: S1. Get the current mirror chain of each disk of the stateless virtual machine; S2. Determine whether the base image of the stateless virtual machine system disk has been stored, and if not, store the base image; S3. Determine whether the data disk has been backed up. If so, obtain the position of the most recent backup data in the mirror chain and perform incremental backup based on the backup data; if not, perform a full backup of the data disk; and update the mirror chain.

[0025] From the above description, it can be seen that the beneficial effects of the present invention are: a storage medium of the present invention, the system disk is based on a differential disk cloned from a base image, and only the base image needs to be backed up, avoiding repeated full backups of the system disk and saving storage space; for the data disk, a full backup is used for the first backup, and subsequent incremental backups are performed through temporary snapshots, reducing the amount of data and time for backup; the system disk and the data disk are treated differently, and the system disk can be automatically restored when the system is shut down and restored by backing up the base image; the data disk can be backed up in full and incrementally, meeting the customer's backup needs for different parts of the data of the stateless virtual machine and ensuring the security of the virtual machine data. The restore operation of the system disk will not affect the mirror chain of the data disk, and the mirror chain of the data disk can continuously and accurately reflect the changes of the data disk itself. Therefore, the data disk can independently perform full or incremental backups based on its own mirror chain information without being interfered with by the restore operation of the system disk.

[0026] Furthermore, performing incremental backup based on the backup data is specifically as follows: Based on the position of the most recent backup data in the mirror chain, the starting point of the current backup operation relative to the previous backup state is determined, and the incremental data is further determined; A temporary snapshot is created to capture the incremental data to obtain an incremental backup snapshot, the incremental backup snapshot is downloaded and saved, and the incremental backup data is exported.

[0027] As can be seen from the above description, by determining the backup starting point and incremental data, you can precisely locate the changed data that needs to be backed up, avoiding backing up large amounts of unchanged data, improving backup efficiency, and reducing storage space usage. Creating temporary snapshots to capture incremental data and saving them as incremental backup snapshots ensures the integrity and traceability of incremental data, facilitating subsequent data recovery operations. Exporting incremental backup data allows you to store the backup data in a specified location for long-term storage and management.

[0028] Furthermore, the method further comprises the steps of: Restriction: Only snapshots containing data disks are allowed to be created in the boot state, and the management data of the stateless virtual machine startup snapshot always points to the top of the corresponding data disk image chain.

[0029] As can be seen from the above description, due to the shutdown and restore feature of the system disk, there is actually no need for real-time backup of the system disk. However, for stateless virtual machine backup, there is actually a need for real-time backup of the data disk data. Therefore, the creation of snapshots in the powered-on state is restricted to only those containing data disks, and the management data of the stateless virtual machine startup snapshot always points to the top of the corresponding data disk image chain. Restricting the creation of snapshots in the powered-on state to only those containing data disks prevents unnecessary snapshot operations on the system disk during the boot process, avoids problems such as abnormal virtual machine management data caused by automatic restoration of the system disk at shutdown, and ensures the stable operation of the virtual machine. The management data of the stateless virtual machine startup snapshot always points to the top of the corresponding data disk image chain, so that when the virtual machine is shut down and restored or restarted, the data on the data disk is normal and consistent with the state before the shutdown or restart, and is not affected by the automatic restoration of the startup snapshot.

[0030] Furthermore, performing incremental backup based on the backup data further includes: Delete the incremental backup snapshot obtained in the previous execution.

[0031] As can be seen from the above description, deleting the previous incremental backup snapshot frees up storage space, avoids storing large amounts of outdated backup data, and reduces storage costs. At the same time, it maintains the simplicity of the backup system and reduces the complexity of data management.

[0032] Furthermore, the incremental backup data obtained by exporting is specifically as follows: The incremental backup data is exported in different formats according to different storage platforms.

[0033] As can be seen from the above description, different storage platforms have different requirements for data formats. Adapting the export format according to the storage platform can ensure that the backup data can be correctly stored and used on various storage platforms, thereby improving the compatibility and versatility of the backup method.

[0034] Furthermore, step S1 also obtains the configuration information of the stateless virtual machine, which includes operating system information, CPU information, memory configuration, and virtual disk information. The virtual disk information includes the storage method and format of the virtual disk, disk type, and the current mirror chain information of the disk.

[0035] The present invention provides a snapshot-based stateless virtual machine backup method and storage medium, which are suitable for data backup of stateless virtual machines.

[0036] Please refer to Figure 4-6 , embodiment 1 of the present invention is: A snapshot-based stateless virtual machine backup method includes the following steps: S1. Get the current mirror chain of each disk of the stateless virtual machine.

[0037] In this embodiment, the API interface provided by the cloud platform can be used to send a request to the virtualization management system to obtain the virtual machine disk image chain. For example, using the ComputeAPI of the OpenStack cloud platform, by specifying the unique identifier of the virtual machine (such as UUID), the current image chain data of each disk of the stateless virtual machine can be obtained. These data are returned in a specific data structure, containing detailed information about the image chain of each disk, such as the ID, creation time, size, etc. of each snapshot. In addition, after receiving the returned data, it can be parsed. The parsed image chain information is stored in the local database to establish an association with the virtual machine. The database table structure can be designed to include fields such as virtual machine ID, disk ID, image chain ID, snapshot ID, snapshot time, etc., to facilitate subsequent queries and management.

[0038] S2. Determine whether the base image of the stateless virtual machine system disk has been stored. If not, store the base image.

[0039] In this embodiment, refer to Figure 5 When the stateless VM backup process is initiated, a precise request is first sent to the VM management system using a specific API interface provided by the cloud platform. This request retrieves key information about the system and data disks, including their unique IDs, capacity, and storage format. For example, in an OpenStack cloud platform environment, detailed system disk management data can be retrieved using the VM's specific UUID through the Compute API. This data is typically presented in a structured JSON format for easy parsing and utilization.

[0040] After obtaining the system disk management data, the system disk's base image ID is immediately used to determine whether the base image has been backed up in a dedicated local backup record database. The database records detailed information such as each base image's backup status, backup time, and backup storage path, acting as a "data warehouse" and providing an accurate historical reference for backup operations.

[0041] If a query confirms that the base image ID does not appear in the backup record, indicating that the base image has never been backed up, the corresponding base image is downloaded from the cloud platform's image repository. During the download process, the most suitable download protocol, such as HTTPS, is automatically selected, taking into account the complexity of the network environment. To ensure the integrity and accuracy of the downloaded base image data, advanced data verification mechanisms, such as MD5 or SHA-1 hash algorithms, are implemented for real-time verification. If any errors or incomplete data are detected, the image is immediately re-downloaded to ensure the reliability of the base image. After the download is complete, the base image is stored in the backup system's storage, which can be a distributed file system like Ceph or a network file system like NFS. Furthermore, the base image's storage record is promptly updated in the backup record database, detailing the image's storage path, actual size, and accurate checksum information to facilitate subsequent querying and management.

[0042] S3. Determine whether the data disk has been backed up. If so, obtain the location of the most recent backup data in the mirror chain and perform an incremental backup based on the backup data. If not, perform a full backup of the data disk and update the mirror chain. The specific steps for performing incremental backup based on the backup data are as follows: Based on the position of the most recent backup data in the mirror chain, the starting point of the current backup operation relative to the previous backup state is determined, and the incremental data is further determined; A temporary snapshot is created to capture the incremental data to obtain an incremental backup snapshot, the incremental backup snapshot is downloaded and saved, and the incremental backup data is exported.

[0043] In this embodiment, refer to Figure 6 ,When the data disk backup operation is started, a request is sent to the ,virtual machine management system using the API interface provided by the ,cloud platform to obtain detailed information such as the image chain, ,unique identification ID, size, and other details of the stateless ,virtual machine data disk.

[0044] After obtaining the data disk information, you can use the data disk ID as an index to query the local backup record database to determine whether the data disk has been backed up. The database records detailed information such as the backup time and backup type (full or incremental) for each data disk, acting as a "historical archive" of data disk backups.

[0045] If the query results indicate that the data disk ID does not appear in the backup record, meaning the data disk has never been backed up, the full backup process begins. First, a temporary backup snapshot is created. This step is implemented by calling the virtualization management system's snapshot creation interface. This temporary backup snapshot utilizes copy-on-write (COW) technology to record the current state of the data disk without impacting the normal operation of the virtual machine. Next, using a data transfer tool such as Rsync (for Linux) or Robocopy (for Windows), the corresponding data disk is completely downloaded to a backup storage location, such as a distributed file system or network-attached storage (NAS) device. In this embodiment, the data disk is transferred and retrieved using the HTTPS protocol via the platform's download interface. During the download process, the number of transfer threads is dynamically adjusted based on the data disk size and network bandwidth to improve download efficiency. After the download is complete, the backup record for the data disk is updated in the backup record database, recording detailed information such as the backup time, backup size, and backup type (full).

[0046] If the query finds that the data disk ID already exists in the backup record, meaning the data disk has been backed up, the system then further determines the location of the latest backup in the image chain. Within the data disk's image chain information, the system analyzes snapshot information, such as the relationship between the ID and the chain, to determine the data that requires incremental backup. The system then determines whether the backed-up snapshot is the latest snapshot of the virtual machine. If so, it creates a temporary snapshot for the virtual machine. This temporary snapshot represents the data from the last backup to the current moment. Simply downloading the temporary snapshot data will yield incremental data from the last backup to the current moment. If the backed-up snapshot is not the latest snapshot of the virtual machine, a temporary snapshot is also created, and the data from all snapshots from the last backup to the current moment are downloaded. This data is then merged in the background to yield incremental data from the last backup to the current moment.

[0047] On the backup server, it is stored and format converted according to the requirements of the storage platform.

[0048] Delete the incremental backup snapshot obtained in the previous execution.

[0049] In this embodiment, after completing the current incremental backup and ensuring data integrity, the previous incremental backup snapshot is deleted from the backup storage location. The previous incremental backup snapshot's storage path and associated identifier are searched in the backup management database, and the deletion is performed using a file delete command or the storage system's management interface. After the deletion is complete, the backup record in the backup management database is updated, marking the previous incremental backup snapshot as deleted, freeing up the corresponding storage space.

[0050] The exported incremental backup data is as follows: The incremental backup data is exported in different formats according to different storage platforms.

[0051] In this embodiment, for common NFS (Network File System) and iSCSI (Internet Small Computer System Interface) storage platforms, incremental backup data is exported to the qcow2 format. The qemu-img tool (a tool for managing QEMU virtual machine disk images) is used to convert incremental backup snapshots into qcow2 format files. During the conversion process, appropriate compression parameters are set, such as a compression level of 6 (of 9 levels, with 6 being a commonly used level that balances compression ratio and speed) to reduce storage space. After the conversion is complete, the qcow2-formatted incremental backup data is stored on the NFS or iSCSI storage device. For Ceph storage platforms, the rbdexport-diff command provided by Ceph is used to export incremental backup data. This command compares the differences between the current incremental backup snapshot and the previous backup snapshot and directly exports the incremental data in the rbd format. During the export process, the export concurrency and data block size are adjusted based on the Ceph cluster configuration and performance parameters to improve export efficiency. After the export is complete, the rbd-formatted incremental backup data is stored in the Ceph storage cluster.

[0052] Restriction: Only snapshots containing data disks are allowed to be created in the boot state, and the data of the stateless virtual machine startup snapshot always points to the top of the corresponding data disk image chain.

[0053] In this embodiment, the virtualization management system restricts the creation of snapshots to only those containing data disks while the system is powered on, by modifying the configuration file or setting an access control policy. When a snapshot creation request is received, the system checks the list of disks included in the request. If the request includes the system disk, the request is rejected and an error message is returned, informing the user that snapshots containing the system disk are not permitted while the system is powered on.

[0054] During the startup of a stateless VM, the backup system automatically detects and updates the data pointer of the startup snapshot. If the data disk image chain changes (for example, during an incremental backup), the backup system retrieves the latest image chain information and finds the ID of the top snapshot in the chain. It then modifies the startup snapshot's metadata to point the startup snapshot's data pointer to that ID. This ensures that the startup snapshot's data is always up to date when restoring or restarting the VM, preventing data loss or inconsistency.

[0055] The second embodiment of the present invention is: A snapshot-based stateless virtual machine backup method differs from embodiment 1 in that step S1 also obtains configuration information of the stateless virtual machine, wherein the configuration information includes operating system information, CPU information, memory configuration, and virtual disk information. The virtual disk information includes the storage method and format of the virtual disk, the disk type, and the current mirror chain information of the disk.

[0056] In this embodiment, the corresponding disk is determined to be a system disk or a data disk based on the virtual disk information. The current mirror chain information of the disk is reconfirmed to ensure consistency with the previously obtained mirror chain, and the locally recorded mirror chain data is updated to ensure the accuracy and timeliness of the information.

[0057] The third embodiment of the present invention is: A storage medium stores a computer program thereon, which, when executed, implements the steps of a snapshot-based stateless virtual machine backup method in the first or second embodiment.

[0058] In summary, the present invention provides a snapshot-based stateless virtual machine backup method and storage medium, enabling backup of stateless virtual machines. Data is categorized, and only the base image needs to be backed up for system disks restored upon shutdown. This allows for automatic system disk restoration upon shutdown, deletes startup snapshots, and performs incremental backups of data disks, ensuring normal management of data. This method is compatible with various storage systems supporting virtualization platforms, resulting in high backup efficiency and, under the same conditions, reduced space usage.

[0059] Based on snapshot technology, data is categorized. Stateless virtual machine startup snapshots only include the system disk, ensuring that startup snapshot management data points to the top of the data disk image chain. This ensures that automatic restoration of the system disk upon shutdown and deletion of the startup snapshot do not affect subsequent snapshot data. Different backup methods are implemented for different data types and storage types.

[0060] The above descriptions are merely embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent transformations made using the contents of the present invention's description and drawings, or directly or indirectly applied in related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A stateless virtual machine backup method based on snapshot, characterized in that: The following steps are involved: S1. Get the current mirror chain of each disk of the stateless virtual machine; S2. Determine whether the base image of the stateless virtual machine system disk has been stored, and if not, store the base image; S3. Determine whether the data disk has been backed up. If so, obtain the location of the most recent backup data in the image chain and perform incremental backup based on the backup data. Otherwise, perform a full backup of the data disk; Update the mirror chain.

2. The snapshot-based stateless virtual machine backup method according to claim 1, characterized in that: The specific steps for performing incremental backup based on the backup data are as follows: Based on the position of the most recent backup data in the mirror chain, the starting point of the current backup operation relative to the previous backup state is determined, and the incremental data is further determined; A temporary snapshot is created to capture the incremental data to obtain an incremental backup snapshot, the incremental backup snapshot is downloaded and saved, and the incremental backup data is exported.

3. The snapshot-based stateless virtual machine backup method according to claim 1, characterized in that: Also includes the steps: Restrictions only allow the creation of snapshots containing data disks in the boot state, and the data of the stateless virtual machine startup management snapshot always points to the top of the corresponding data disk image chain.

4. The snapshot-based stateless virtual machine backup method according to claim 2, characterized in that: The exported incremental backup data is as follows: The incremental backup data is exported in different formats according to different storage platforms.

5. The snapshot-based stateless virtual machine backup method according to claim 1, characterized in that: Step S1 also obtains the configuration information of the stateless virtual machine, which includes operating system information, CPU information, memory configuration, and virtual disk information. The virtual disk information includes the storage method and format of the virtual disk, disk type, and the current mirror chain information of the disk.

6. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed, the following steps are implemented: S1. Get the current mirror chain of each disk of the stateless virtual machine; S2. Determine whether the base image of the stateless virtual machine system disk has been stored, and if not, store the base image; S3. Determine whether the data disk has been backed up. If so, obtain the location of the most recent backup data in the image chain and perform incremental backup based on the backup data. Otherwise, perform a full backup of the data disk; Update the mirror chain.

7. A storage medium according to claim 6, characterized in that: The specific steps for performing incremental backup based on the backup data are as follows: Based on the position of the most recent backup data in the mirror chain, the starting point of the current backup operation relative to the previous backup state is determined, and the incremental data is further determined; A temporary snapshot is created to capture the incremental data to obtain an incremental backup snapshot, the incremental backup snapshot is downloaded and saved, and the incremental backup data is exported.

8. A storage medium according to claim 6, characterized in that: Also includes the steps: Restriction: Only snapshots containing data disks are allowed to be created in the boot state, and the management data of the stateless virtual machine startup snapshot always points to the top of the corresponding data disk image chain.

9. A storage medium according to claim 7, characterized in that: The exported incremental backup data is as follows: The incremental backup data is exported in different formats according to different storage platforms.

10. The storage medium according to claim 1, wherein: Step S1 also obtains the configuration information of the stateless virtual machine, which includes operating system information, CPU information, memory configuration, and virtual disk information. The virtual disk information includes the storage method and format of the virtual disk, disk type, and the current mirror chain information of the disk.

Citation Information

Cited By

  • Virtual machine data backup method and device of cloud computing management platform, program product, equipment and medium

    CN121144110A