Virtual machine snapshot storage, reading method, device, electronic device and storage medium
By creating backup directories on the backup disk and soft linking, splitting and encrypting virtual machine snapshots, the problem of virtual machine snapshots being easily modified or deleted is solved, improving the security and reliability of snapshots.
Patent Information
- Application Number
- CN202210591727.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-27
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2042-05-27
AI Technical Summary
Virtual machine snapshots are at risk of being modified or deleted, they are easily used by people, and it is difficult to restore to their previous state once damaged.
By creating a backup directory on the backup disk and soft linking it to the virtual machine snapshot storage running directory, obtaining a virtual machine snapshot and splitting it, generating an index file and encrypting, deleting the original snapshot, uninstalling the soft link, and replacing the backup directory Set to read-only state.
Improves the security of virtual machine snapshots, prevents arbitrary tampering or deletion, and ensures the integrity and reliability of snapshots.
Smart Images

Figure CN114925019B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of virtual machines, and in particular to a method, device, electronic device and storage medium for saving and reading virtual machine snapshots. Background Art
[0002] Virtual machine snapshots are used as storage nodes for the running status of virtual machines. When the system crashes or anomalies occur, virtual machine snapshots can be used to quickly and completely restore the virtual machine status. In order to completely and timely restore the system status, the secure storage of virtual machine snapshots becomes crucial.
[0003] In the prior art, such as Figure 1 As shown, after the virtual machine is running, a virtual machine snapshot of the running state is generated and stored through the virtual software interface. The virtual machine snapshot and the running virtual machine are saved in the same directory. Even if the user specifies the snapshot directory, it is basically in the same disk array. When in use, the virtual machine software interface is directly called to restore the virtual machine snapshot to use the system environment when the virtual machine snapshot was backed up.
[0004] The inventors have found that the above prior art has at least the following problems: virtual machine snapshots are at risk of being modified or deleted and are easily exploited by others; and once a virtual machine snapshot is damaged, it is difficult to restore it to its previous state. Summary of the invention
[0005] In view of this, the embodiments of the present disclosure provide a method, device, electronic device and storage medium for saving and reading virtual machine snapshots, which can improve the security of virtual machine snapshots.
[0006] In a first aspect, the present disclosure provides a method for saving a virtual machine snapshot, which adopts the following technical solution:
[0007] The virtual machine snapshot saving method comprises:
[0008] Create a backup directory based on the backup disk;
[0009] Soft linking the backup directory to the virtual machine snapshot storage running directory;
[0010] Obtaining a virtual machine snapshot of a virtual machine running to a specific state, wherein the virtual machine snapshot is stored in the backup directory via the virtual machine snapshot storage running directory;
[0011] Splitting the virtual machine snapshot to obtain at least two split files;
[0012] Obtaining an index file according to the at least two split files, the index file including the snapshot name of the virtual machine snapshot, and the order and file name of each of the split files;
[0013] Encrypting the index file;
[0014] Deleting the virtual machine snapshot;
[0015] Uninstalling the soft link in the virtual machine snapshot storage running directory pointing to the backup directory;
[0016] Set the backup directory to read-only status.
[0017] Optionally, after soft linking the backup directory to the virtual machine snapshot storage running directory, the virtual machine is run to run the virtual machine to the specific state.
[0018] Optionally, splitting the virtual machine snapshot to obtain at least two split files includes: splitting the virtual machine snapshot into at least two split files with different file sizes; and naming each of the split files in a random and non-repetitive sequence.
[0019] Optionally, the step of splitting the virtual machine snapshot to obtain at least two split files further comprises: obtaining a unique verification code for each of the split files;
[0020] The index file also includes a unique verification code for each of the split files.
[0021] Optionally, the unique verification code is a hash value.
[0022] Optionally, the virtual machine snapshot saving method further includes: obtaining a hash value of the virtual machine snapshot; and after obtaining the at least two split files, comparing the hash value of the virtual machine snapshot with the hash values of each of the split files;
[0023] The deleting the virtual machine snapshot includes: after the comparison is successful, deleting the virtual machine snapshot.
[0024] Optionally, the virtual machine snapshot saving method further includes: after the comparison fails, re-executing the step of splitting the virtual machine snapshot to obtain at least two split files.
[0025] In a second aspect, an embodiment of the present disclosure provides a virtual machine snapshot reading method, which is used to read a virtual machine snapshot saved by any of the virtual machine snapshot saving methods described above, and adopts the following technical solutions:
[0026] The virtual machine snapshot reading method comprises:
[0027] Using the memory as a temporary file system, adjusting the directory of the temporary file system and the virtual machine snapshot storage running directory to be the same directory;
[0028] Decrypting the index file;
[0029] Copying each of the split files to the temporary file system;
[0030] Restoring the virtual machine snapshot based on the decrypted index file and each of the split files;
[0031] Run the restored virtual machine snapshot.
[0032] Optionally, adjusting the directory of the temporary file system and the virtual machine snapshot storage running directory to be the same directory includes:
[0033] Mount the memory to the virtual machine snapshot storage running directory in a temporary file system manner; or,
[0034] The virtual machine snapshot storage running directory is adjusted to the directory of the temporary file system.
[0035] Optionally, copying each of the split files to the temporary file system includes: incrementally reading each of the split files from a backup disk to the temporary file system in sequence.
[0036] Optionally, when the index file further includes a unique verification code for each of the split files, and the unique verification code is a hash value, the virtual machine snapshot reading method further includes: comparing the hash value of each of the split files copied to the temporary file system with the hash value recorded in the decrypted index file;
[0037] The restoring the virtual machine snapshot based on the decrypted index file and each of the split files includes: after the comparison is successful, restoring the virtual machine snapshot based on the decrypted index file and each of the split files.
[0038] Optionally, the virtual machine snapshot reading method further includes: after the comparison fails, re-executing the step of using the memory as a temporary file system and adjusting the directory of the temporary file system and the virtual machine snapshot storage running directory to the same directory.
[0039] Optionally, the virtual machine snapshot reading method further includes: after running the restored virtual machine snapshot, if the virtual machine is contaminated, re-executing the step of restoring the virtual machine snapshot based on each of the split files.
[0040] Optionally, the virtual machine snapshot reading method further includes: when it is determined that there is no need to continue running the restored virtual machine snapshot, unmounting the temporary file system.
[0041] In a third aspect, the present disclosure provides a virtual machine snapshot storage device, which adopts the following technical solution:
[0042] The virtual machine snapshot storage device comprises:
[0043] A directory creation module, used to create a backup directory based on the backup disk;
[0044] A soft link module, used to soft link the backup directory to the virtual machine snapshot storage running directory;
[0045] A snapshot acquisition module, used to acquire a virtual machine snapshot of a virtual machine running to a specific state, wherein the virtual machine snapshot is stored in the backup directory via the virtual machine snapshot storage operation directory;
[0046] A split processing module, used for splitting the virtual machine snapshot to obtain at least two split files;
[0047] An index generation module, configured to obtain an index file according to the at least two split files, wherein the index file includes a snapshot name of the virtual machine snapshot, and an order and a file name of each of the split files;
[0048] An index encryption module, used for encrypting the index file;
[0049] A snapshot deletion module, used to delete the virtual machine snapshot;
[0050] An uninstall module, used for storing a soft link in the virtual machine snapshot running directory pointing to the backup directory;
[0051] The setting module is used to set the backup directory to a read-only state.
[0052] In a fourth aspect, an embodiment of the present disclosure provides a virtual machine snapshot reading device, which is used to read the virtual machine snapshot saved by the virtual machine snapshot saving device described above, and adopts the following technical solution:
[0053] The virtual machine snapshot reading device comprises:
[0054] A directory adjustment module, used to use the memory as a temporary file system and adjust the directory of the temporary file system and the virtual machine snapshot storage running directory to the same directory;
[0055] An index decryption module, used for decrypting the index file;
[0056] A file copy module, used for copying each of the split files to the temporary file system;
[0057] A snapshot restoration module, used to restore the virtual machine snapshot based on the decrypted index file and each of the split files;
[0058] The snapshot running module is used to run the restored virtual machine snapshot.
[0059] In a fifth aspect, an embodiment of the present disclosure provides an electronic device, which adopts the following technical solution:
[0060] The electronic device comprises:
[0061] at least one processor; and,
[0062] a memory communicatively connected to the at least one processor; wherein,
[0063] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute any of the above-mentioned virtual machine snapshot saving methods.
[0064] In a sixth aspect, an embodiment of the present disclosure provides an electronic device, which adopts the following technical solution:
[0065] The electronic device comprises:
[0066] at least one processor; and,
[0067] a memory communicatively connected to the at least one processor; wherein,
[0068] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute any of the above-mentioned virtual machine snapshot reading methods.
[0069] In a seventh aspect, an embodiment of the present disclosure provides a computer-readable storage medium, which adopts the following technical solution:
[0070] The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute any of the above-mentioned virtual machine snapshot saving methods.
[0071] In an eighth aspect, an embodiment of the present disclosure provides a computer-readable storage medium, which adopts the following technical solution:
[0072] The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute any of the above-mentioned virtual machine snapshot reading methods.
[0073] The disclosed embodiments provide a virtual machine snapshot saving and reading method, device, electronic device and storage medium. In the virtual machine snapshot saving method, a backup directory is first created based on a backup disk, the backup directory is soft-linked to the virtual machine snapshot storage running directory, and then the virtual machine snapshot is saved to the backup disk, and then an obfuscated snapshot file (at least two split files) is made according to the virtual machine snapshot, and the corresponding index file is encrypted and saved, the original virtual machine snapshot is deleted, and then the soft link is uninstalled and the backup directory is set to a read-only state. In the above process, multiple layers of insurance are set for the virtual machine snapshot by obfuscating the snapshot file, encrypting the index file, uninstalling the soft link and setting the backup directory to a read-only state, thereby improving the security of the virtual machine snapshot and preventing the virtual machine snapshot from being tampered with or deleted at will.
[0074] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the following preferred embodiments are specifically cited and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0075] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0076] Figure 1 A flowchart of a method for saving and reading a virtual machine snapshot in the prior art;
[0077] Figure 2 A flowchart of a method for saving a virtual machine snapshot provided by an embodiment of the present disclosure;
[0078] Figure 3 A schematic diagram of an index file provided in an embodiment of the present disclosure;
[0079] Figure 4 A flowchart of a virtual machine snapshot reading method provided by an embodiment of the present disclosure;
[0080] Figure 5 A schematic diagram of a virtual machine snapshot saving and reading process provided by an embodiment of the present disclosure;
[0081] Figure 6 A schematic diagram of a virtual machine snapshot storage device provided in an embodiment of the present disclosure;
[0082] Figure 7 A schematic diagram of a virtual machine snapshot reading device provided in an embodiment of the present disclosure;
[0083] Figure 8 A functional block diagram of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0084] The embodiments of the present disclosure are described in detail below with reference to the accompanying drawings.
[0085] It should be clear that the following embodiments of the present disclosure are described by specific specific examples, and those skilled in the art can easily understand other advantages and effects of the present disclosure from the contents disclosed in this specification. Obviously, the described embodiments are only a part of the embodiments of the present disclosure, rather than all of the embodiments. The present disclosure can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present disclosure. It should be noted that the following embodiments and features in the embodiments can be combined with each other in the absence of conflict. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present disclosure.
[0086] It should be noted that various aspects of the embodiments within the scope of the appended claims are described below. It should be apparent that the aspects described herein may be embodied in a wide variety of forms, and any specific structure and / or function described herein is merely illustrative. Based on the present disclosure, it should be understood by those skilled in the art that an aspect described herein may be implemented independently of any other aspect, and two or more of these aspects may be combined in various ways. For example, any number of aspects described herein may be used to implement the device and / or practice the method. In addition, other structures and / or functionalities other than one or more of the aspects described herein may be used to implement this device and / or practice this method.
[0087] It should also be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present disclosure. The drawings only show components related to the present disclosure rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.
[0088] Additionally, in the following description, specific details are provided to facilitate a thorough understanding of the examples. However, it will be understood by those skilled in the art that the aspects described may be practiced without these specific details.
[0089] The present disclosure provides a method for saving a virtual machine snapshot. Specifically, Figure 2 As shown, the virtual machine snapshot saving method includes:
[0090] Step S201: Create a backup directory based on the backup disk.
[0091] Step S202: soft link the backup directory to the virtual machine snapshot storage running directory.
[0092] Step S203: obtaining a virtual machine snapshot of a virtual machine running to a specific state, and storing the virtual machine snapshot in a backup directory via a virtual machine snapshot storage running directory.
[0093] In the embodiment of the present disclosure, a snapshot operation of running a virtualization management program can be performed to obtain a virtual machine snapshot of a virtual machine running to a specific state.
[0094] In the embodiments of the present disclosure, after soft linking the backup directory to the virtual machine snapshot storage running directory, the virtual machine can be run to run the virtual machine (specifically, the system environment of the virtual machine) to a specific state, and then a virtual machine snapshot of the virtual machine running to the specific state can be obtained. Alternatively, the virtual machine can be run first, and then the backup directory can be soft linked to the virtual machine snapshot storage running directory, and then the virtual machine (specifically, the system environment of the virtual machine) can be run to a specific state, and then a virtual machine snapshot of the virtual machine running to the specific state can be obtained. Those skilled in the art can make a choice according to actual needs, as long as it is ensured that when obtaining the virtual machine snapshot of the virtual machine running to the specific state, the backup directory has been soft linked to the virtual machine snapshot storage running directory. Optionally, in the embodiments of the present disclosure, after soft linking the backup directory to the virtual machine snapshot storage running directory, the virtual machine can be run to run the virtual machine to a specific state.
[0095] Optionally, the virtual machine snapshot saving method in the embodiment of the present disclosure further includes: obtaining a unique verification code of the virtual machine snapshot, such as a hash value, for subsequent further verification and the like.
[0096] Step S204: split the virtual machine snapshot to obtain at least two split files.
[0097] In the disclosed embodiment, the number of split files is at least two, and can also be more, which can be selected according to actual needs. The size of each split file can be the same or different, and the size of the split file can also be determined according to actual needs. For example, the size of the virtual machine snapshot is 1G, and the virtual machine snapshot is split into 2 512M split files, or the virtual machine snapshot is split into 2 128M, 1 256M and 1 512M. In the disclosed embodiment, the virtual machine snapshot is preferably split to obtain at least two split files, including: splitting the virtual machine snapshot into at least two split files with different file sizes, that is, the sizes of the split files are uneven; naming each split file through a random and non-repetitive sequence. In the above manner, the difficulty of obtaining a virtual machine snapshot based on each split file can be further increased, and the security of the virtual machine snapshot can be further improved.
[0098] Optionally, in the embodiment of the present disclosure, splitting the virtual machine snapshot to obtain at least two split files further includes: obtaining a unique verification code for each split file for subsequent further verification, etc. The unique verification code may be a hash value of the split file.
[0099] Optionally, when the hash value of the virtual machine snapshot and the hash value of each split file have been obtained, the virtual machine snapshot saving method in the embodiment of the present disclosure further includes: after obtaining at least two split files, comparing the hash value of the virtual machine snapshot with the hash value of each split file to ensure that the splitting process is accurate. If the comparison is successful, it means that the virtual machine snapshot corresponds to each split file, and the subsequent steps can be continued. If the comparison fails, it means that the virtual machine snapshot does not correspond to each split file, and the step of splitting the virtual machine snapshot can be re-executed to obtain at least two split files.
[0100] Step S205: Obtain an index file according to at least two split files.
[0101] An example of an index file is Figure 3 As shown, the index file includes the snapshot name of the virtual machine snapshot, and the order and file name of each split file. When the unique verification code of each split file is obtained in step S204, the index file also includes the unique verification code of each split file for subsequent further verification.
[0102] Step S206: Encrypt the index file.
[0103] Step S207: Delete the virtual machine snapshot.
[0104] Optionally, in the embodiment of the present disclosure, after obtaining at least two split files, after successfully comparing the hash value of the virtual machine snapshot with the hash values of each split file, the virtual machine snapshot is deleted.
[0105] Step S208: Uninstall the soft link in the virtual machine snapshot storage running directory that points to the backup directory.
[0106] Step S209: Set the backup directory to read-only status.
[0107] The disclosed embodiments provide a virtual machine snapshot saving and reading method, device, electronic device and storage medium. In the virtual machine snapshot saving method, a backup directory is first created based on a backup disk, the backup directory is soft-linked to the virtual machine snapshot storage running directory, and then the virtual machine snapshot is saved to the backup disk, and then an obfuscated snapshot file (at least two split files) is made according to the virtual machine snapshot, and the corresponding index file is encrypted and saved, the original virtual machine snapshot is deleted, and then the soft link is uninstalled and the backup directory is set to a read-only state. In the above process, multiple layers of insurance are set for the virtual machine snapshot by obfuscating the snapshot file, encrypting the index file, uninstalling the soft link and setting the backup directory to a read-only state, thereby improving the security of the virtual machine snapshot and preventing the virtual machine snapshot from being tampered with or deleted at will.
[0108] In addition, the embodiment of the present disclosure provides a virtual machine snapshot reading method, which is used to read the virtual machine snapshot saved by any of the virtual machine snapshot saving methods described above, specifically, Figure 4 As shown, the virtual machine snapshot reading method includes:
[0109] Step S401: Use the memory as a temporary file system, and adjust the directory of the temporary file system and the virtual machine snapshot storage and operation directory to be the same directory.
[0110] Optionally, adjusting the directory of the temporary file system and the virtual machine snapshot storage running directory to the same directory includes: mounting the memory to the virtual machine snapshot storage running directory in the form of a temporary file system, which can be specifically executed through a system command; or, adjusting the virtual machine snapshot storage running directory to the directory of the temporary file system, which is applicable to the situation where the directory of the temporary file system is different from the original directory of the virtual machine snapshot used by the virtual software.
[0111] It should be noted that there are no files in the directory of the newly created temporary file system.
[0112] Step S402: decrypt the index file.
[0113] Step S403: copy each split file to a temporary file system.
[0114] Optionally, copying each split file to a temporary file system includes: incrementally reading each split file from a backup disk to a temporary file system in order. The above order can be obtained from the decrypted index file. After repeated verification, the disk-to-memory read operation in the disclosed embodiment is very fast, far superior to the disk-to-disk read and write in the prior art.
[0115] Step S404: restore the virtual machine snapshot based on the decrypted index file and each split file.
[0116] In the embodiment of the present disclosure, virtualization management software can be used to process each split file in combination with the content included in the decrypted index file to obtain a restored virtual machine snapshot.
[0117] In the disclosed embodiment, the virtual machine snapshot can be restored directly based on the decrypted index file and each split file, or each split file can be further verified based on the decrypted index file, and the virtual machine snapshot can be restored after verification. Optionally, in the disclosed embodiment, the index file also includes a unique verification code for each split file, and when the unique verification code is a hash value, the virtual machine snapshot reading method also includes: before restoring the virtual machine snapshot, the hash value of each split file copied to the temporary file system is compared with the hash value recorded in the index file. If the comparison is successful, it means that each split file is correct, and the virtual machine snapshot can be restored based on the decrypted index file and each split file. If the comparison fails, it means that there is a problem in the copying process of each split file and it cannot be used directly, then it can be returned to re-execute the steps of using the memory as the temporary file system and adjusting the directory of the temporary file system and the virtual machine snapshot storage running directory to the same directory until each split file is correct.
[0118] Step S405: Run the restored virtual machine snapshot.
[0119] After running the restored (or recovered) virtual machine snapshot, you can run the suspicious file and monitor the software running action. After the suspicious file runs, a series of system garbage may be generated, such as ransomware will encrypt system files, and the system will fail and report an error when it runs again.
[0120] Optionally, the virtual machine snapshot reading method further includes: after running the restored virtual machine snapshot, if the virtual machine is contaminated, re-executing the step of restoring the virtual machine snapshot based on each split file, thereby avoiding the impact of the last system running software on the next system running.
[0121] At this time, the frequent virtual machine snapshot restoration and operation from step S404 to step S405 will no longer be disk IO operations in the prior art, but will evolve into copying and use between memories, greatly improving the restoration and operation speed of the virtual machine snapshots.
[0122] Optionally, the virtual machine snapshot reading method in the embodiment of the present disclosure further includes: when it is determined that there is no need to continue running the restored virtual machine snapshot, unmounting the temporary file system to ensure that the virtual machine snapshot is not misused.
[0123] The inventors have found that when the method in the prior art is used to save virtual machine snapshots, in some scenarios, frequent recovery, switching and operation of virtual machine snapshots are required, which in turn causes frequent reading and writing of the disk array. Frequent copying of the disk (recovering data) will greatly limit the efficiency of improving the recovery and operation rate of virtual machine snapshots. In the virtual machine snapshot reading method provided in the embodiment of the present disclosure, by using the memory as a temporary file system, adjusting the directory of the temporary file system and the virtual machine snapshot storage and operation directory to the same directory, and then using the temporary file system, frequent disk writing is avoided, thereby improving the efficiency of virtual machine snapshot recovery and operation.
[0124] Taking the advanced threat detection system as an example, the application process of the virtual machine snapshot saving method and the virtual machine snapshot reading method provided by the embodiment of the present disclosure is as follows: Figure 5 As shown, the process includes:
[0125] Virtual machine snapshot saving process:
[0126] Step (1) soft link the backup disk directory to the virtual machine snapshot storage running directory.
[0127] Step (2) runs the virtual machine and runs the system environment in the virtual machine to a specified state.
[0128] Step (3) saves a system operation snapshot of the virtual machine running in a specific system state by running a virtual machine snapshot operation of a virtualization management program.
[0129] Step (4) produces an obfuscated snapshot of the virtual machine snapshot produced in step (3) (ie, splits the virtual machine snapshot into at least two split files) and finally generates an encrypted index file.
[0130] Step (5) compares the hash value of the obfuscated snapshot file with the hash value of the virtual machine snapshot to ensure that the obfuscated snapshot data is accurate.
[0131] Step (6) deletes the original virtual machine snapshot and uninstalls the soft link directory.
[0132] Step (7) The directory permissions are adjusted to read-only to ensure that the data is not tampered with later.
[0133] Virtual machine snapshot reading process:
[0134] Step (1) uses a system command to mount the memory to a specified directory in the form of a temporary file system.
[0135] Step (2) decrypts the encrypted index file and incrementally reads the obfuscated snapshots from the backup disk to the temporary file system in the order of the first file, the second file, etc.
[0136] Step (3) compares the snapshot copied to the temporary file system with the hash value in the index file. If successful, continue to step (4). If failed, return the reason and remount the temporary file system and copy again until success.
[0137] The snapshot copied in step (4) can be directly used by the virtualization management software to restore the snapshot.
[0138] Step (5) After the virtual machine snapshot is restored, the suspicious file can be run and the software operation can be monitored.
[0139] Step (6) After the suspicious file is executed, a series of system garbage will be generated. Repeat step (4) again to restore the virtual machine snapshot.
[0140] Step (7) detects that the virtual machine snapshot reading process is completed and actively unmounts the temporary file system.
[0141] In addition, the embodiment of the present disclosure also provides a virtual machine snapshot storage device, such as Figure 6 As shown, the virtual machine snapshot storage device includes:
[0142] A directory creation module 601 is used to create a backup directory based on a backup disk;
[0143] A soft link module 602 is used to soft link the backup directory to the virtual machine snapshot storage running directory;
[0144] A snapshot acquisition module 603 is used to acquire a virtual machine snapshot of a virtual machine running to a specific state, and the virtual machine snapshot is stored in a backup directory via a virtual machine snapshot storage operation directory;
[0145] A split processing module 604 is used to split the virtual machine snapshot to obtain at least two split files;
[0146] An index generation module 605, configured to obtain an index file according to at least two split files, wherein the index file includes a snapshot name of the virtual machine snapshot, and an order and a file name of each split file;
[0147] An index encryption module 606, used to encrypt the index file;
[0148] The snapshot deletion module 607 is used to delete the virtual machine snapshot;
[0149] Uninstall module 608, used for storing a soft link in the virtual machine snapshot running directory pointing to the backup directory;
[0150] The setting module 609 is used to set the backup directory to a read-only state.
[0151] It should be noted that the detailed contents of the virtual machine snapshot saving method described above are all applicable to the corresponding modules in the virtual machine snapshot saving device in the embodiment of the present disclosure, and will not be described in detail here.
[0152] In addition, the embodiment of the present disclosure further provides a virtual machine snapshot reading device, which is used to read the virtual machine snapshot saved by the virtual machine snapshot saving device described above, corresponding to the above virtual machine snapshot saving device, specifically, as follows Figure 7 As shown, the virtual machine snapshot reading device includes:
[0153] The directory adjustment module 701 is used to use the memory as a temporary file system and adjust the directory of the temporary file system and the virtual machine snapshot storage running directory to the same directory;
[0154] Index decryption module 702, used to decrypt index files;
[0155] The file copy module 703 is used to copy each split file to a temporary file system;
[0156] The snapshot restoration module 704 is used to restore the virtual machine snapshot based on the decrypted index file and each split file;
[0157] The snapshot running module 705 is used to run the restored virtual machine snapshot.
[0158] It should be noted that the detailed contents of the virtual machine snapshot reading method described above are all applicable to the corresponding modules in the virtual machine snapshot reading device in the embodiment of the present disclosure, and will not be described in detail here.
[0159] In addition, an embodiment of the present disclosure further provides an electronic device, the electronic device comprising:
[0160] at least one processor; and,
[0161] a memory communicatively connected to at least one processor; wherein,
[0162] The memory stores instructions that can be executed by at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute any of the above virtual machine snapshot saving methods or any of the above virtual machine snapshot reading methods.
[0163] The electronic device according to an embodiment of the present disclosure includes a memory and a processor. The memory is used to store non-temporary computer-readable instructions. Specifically, the memory may include one or more computer program products, and the computer program product may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may, for example, include a random access memory (RAM) and / or a cache memory (cache), etc. The non-volatile memory may, for example, include a read-only memory (ROM), a hard disk, a flash memory, etc.
[0164] The processor may be a central processing unit (CPU) or other forms of processing units with data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device to perform desired functions. In one embodiment of the present disclosure, the processor is used to run the computer-readable instructions stored in the memory, so that the electronic device performs all or part of the steps of the virtual machine snapshot saving method or virtual machine snapshot reading method of the aforementioned embodiments of the present disclosure.
[0165] Those skilled in the art should be able to understand that in order to solve the technical problem of how to obtain a good user experience, the present embodiment may also include well-known structures such as a communication bus and an interface, and these well-known structures should also be included in the protection scope of the present disclosure.
[0166] like Figure 8 The present invention provides a schematic diagram of the structure of an electronic device according to an embodiment of the present invention, which is suitable for implementing the electronic device in the embodiment of the present invention. Figure 8 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0167] like Figure 8 As shown, the electronic device may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) or a program loaded from a storage device into a random access memory (RAM). In the RAM, various programs and data required for the operation of the electronic device are also stored. The processing device, ROM, and RAM are connected to each other via a bus. An input / output (I / O) interface is also connected to the bus.
[0168] Typically, the following devices can be connected to the I / O interface: input devices such as sensors or visual information acquisition devices; output devices such as display screens; storage devices such as magnetic tapes and hard disks; and communication devices. The communication device can allow the electronic device to communicate with other devices (such as edge computing devices) wirelessly or by wire to exchange data. Figure 8An electronic device having various devices is shown, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0169] In addition, an embodiment of the present disclosure provides a computer-readable storage medium, which stores computer instructions, and the computer instructions are used to enable a computer to execute any of the above virtual machine snapshot saving methods or virtual machine snapshot reading methods.
[0170] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device, or installed from a ROM. When the computer program is executed by a processing device, all or part of the steps of the virtual machine snapshot saving method or the virtual machine snapshot reading method of the embodiment of the present disclosure are executed.
[0171] For detailed description of this embodiment, reference may be made to the corresponding descriptions in the aforementioned embodiments, which will not be repeated here.
[0172] According to the computer-readable storage medium of the embodiment of the present disclosure, non-transitory computer-readable instructions are stored thereon. When the non-transitory computer-readable instructions are executed by a processor, all or part of the steps of the virtual machine snapshot saving method or virtual machine snapshot reading method of each embodiment of the present disclosure are executed.
[0173] The above-mentioned computer-readable storage media include, but are not limited to: optical storage media (e.g., CD-ROM and DVD), magneto-optical storage media (e.g., MO), magnetic storage media (e.g., magnetic tape or mobile hard disk), media with built-in rewritable non-volatile memory (e.g., memory card) and media with built-in ROM (e.g., ROM box).
[0174] For detailed description of this embodiment, reference may be made to the corresponding descriptions in the aforementioned embodiments, which will not be repeated here.
[0175] The basic principles of the present disclosure are described above in conjunction with specific embodiments. However, it should be noted that the advantages, strengths, effects, etc. mentioned in the present disclosure are only examples and not limitations, and it cannot be considered that these advantages, strengths, effects, etc. are required by each embodiment of the present disclosure. In addition, the specific details disclosed above are only for the purpose of illustration and ease of understanding, and are not limitations. The above details do not limit the present disclosure to the necessity of adopting the above specific details to be implemented.
[0176] In the present disclosure, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is any such actual relationship or order between these entities or operations. The block diagrams of the devices, devices, equipment, and systems involved in the present disclosure are only illustrative examples and are not intended to require or imply that they must be connected, arranged, and configured in the manner shown in the block diagram. As will be appreciated by those skilled in the art, these devices, devices, equipment, and systems can be connected, arranged, and configured in any manner. Words such as "including", "comprising", "having", etc. are open words, referring to "including but not limited to", and can be used interchangeably with them. The words "or" and "and" used here refer to the words "and / or" and can be used interchangeably with them, unless the context clearly indicates otherwise. The words "such as" used here refer to the phrase "such as but not limited to", and can be used interchangeably with them.
[0177] Additionally, as used herein, "or" used in a list of items beginning with "at least one" indicates a separate list, so that, for example, a list of "at least one of A, B, or C" means A or B or C, or AB or AC or BC, or ABC (i.e., A and B and C). Furthermore, the word "exemplary" does not mean that the example described is preferred or better than other examples.
[0178] It should also be noted that in the system and method of the present disclosure, each component or each step can be decomposed and / or recombined. Such decomposition and / or recombination should be regarded as equivalent solutions of the present disclosure.
[0179] Various changes, substitutions, and modifications of the techniques described herein may be made without departing from the teachings defined by the appended claims. Furthermore, the scope of the claims of the present disclosure is not limited to the specific aspects of the processes, machines, manufactures, compositions of events, means, methods, and actions described above. Currently existing or later to be developed processes, machines, manufactures, compositions of events, means, methods, or actions that perform substantially the same functions or achieve substantially the same results as the corresponding aspects described herein may be utilized. Thus, the appended claims include such processes, machines, manufactures, compositions of events, means, methods, or actions within their scope.
[0180] The above description of the disclosed aspects is provided to enable any person skilled in the art to make or use the present disclosure. Various modifications to these aspects will be readily apparent to those skilled in the art, and the general principles defined herein may be applied to other aspects without departing from the scope of the present disclosure. Therefore, the present disclosure is not intended to be limited to the aspects shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
[0181] The above description has been given for the purpose of illustration and description. In addition, this description is not intended to limit the embodiments of the present disclosure to the forms disclosed herein. Although multiple example aspects and embodiments have been discussed above, those skilled in the art will recognize certain variations, modifications, changes, additions and sub-combinations thereof.
Claims
1. A method for saving a virtual machine snapshot, characterized in that: include: Create a backup directory based on the backup disk; Soft linking the backup directory to the virtual machine snapshot storage running directory; Obtaining a virtual machine snapshot of a virtual machine running to a specific state, wherein the virtual machine snapshot is stored in the backup directory via the virtual machine snapshot storage running directory; Splitting the virtual machine snapshot to obtain at least two split files; Obtaining an index file according to the at least two split files, the index file including the snapshot name of the virtual machine snapshot, and the order and file name of each of the split files; Encrypting the index file; Deleting the virtual machine snapshot; Uninstalling the soft link in the virtual machine snapshot storage running directory pointing to the backup directory; Set the backup directory to read-only status.
2. The method for saving a virtual machine snapshot according to claim 1, characterized in that: After soft linking the backup directory to the virtual machine snapshot storage running directory, the virtual machine is run to run the virtual machine to the specific state.
3. The method for saving a virtual machine snapshot according to claim 1, characterized in that: The step of splitting the virtual machine snapshot to obtain at least two split files includes: splitting the virtual machine snapshot into at least two split files with different file sizes; and naming each of the split files in a random and non-repetitive sequence.
4. The method for saving a virtual machine snapshot according to claim 3, characterized in that: The splitting of the virtual machine snapshot to obtain at least two split files further comprises: obtaining a unique verification code for each of the split files; The index file also includes a unique verification code for each of the split files.
5. The method for saving a virtual machine snapshot according to claim 4, characterized in that: The unique verification code is a hash value.
6. The method for saving a virtual machine snapshot according to claim 5, characterized in that: Also includes: Obtaining a hash value of the virtual machine snapshot; And, after obtaining the at least two split files, comparing the hash value of the virtual machine snapshot with the hash value of each of the split files; The deleting the virtual machine snapshot includes: after the comparison is successful, deleting the virtual machine snapshot.
7. The method for saving a virtual machine snapshot according to claim 6, characterized in that: Also includes: After the comparison fails, the step of splitting the virtual machine snapshot to obtain at least two split files is re-executed.
8. A virtual machine snapshot reading method, used to read a virtual machine snapshot saved by the virtual machine snapshot saving method according to any one of claims 1 to 7, characterized in that: include: Using the memory as a temporary file system, adjusting the directory of the temporary file system and the virtual machine snapshot storage running directory to be the same directory; Decrypting the index file; Copying each of the split files to the temporary file system; Restoring the virtual machine snapshot based on the decrypted index file and each of the split files; Run the restored virtual machine snapshot.
9. The virtual machine snapshot reading method according to claim 8, characterized in that: The step of adjusting the directory of the temporary file system and the virtual machine snapshot storage operation directory to be the same directory comprises: Mount the memory to the virtual machine snapshot storage running directory in a temporary file system manner; or, The virtual machine snapshot storage running directory is adjusted to the directory of the temporary file system.
10. The virtual machine snapshot reading method according to claim 8, characterized in that: The copying of each of the split files to the temporary file system includes: incrementally reading each of the split files from the backup disk to the temporary file system in sequence.
11. The virtual machine snapshot reading method according to claim 8, characterized in that: When the index file further includes a unique verification code for each of the split files, and the unique verification code is a hash value, the virtual machine snapshot reading method further includes: comparing the hash value of each of the split files copied to the temporary file system with the hash value recorded in the decrypted index file; The restoring the virtual machine snapshot based on the decrypted index file and each of the split files includes: after the comparison is successful, restoring the virtual machine snapshot based on the decrypted index file and each of the split files.
12. The virtual machine snapshot reading method according to claim 11, characterized in that: Also includes: After the comparison fails, the step of using the memory as a temporary file system and adjusting the directory of the temporary file system and the virtual machine snapshot storage running directory to be the same directory is executed again.
13. The virtual machine snapshot reading method according to claim 8, characterized in that: Also includes: After the restored virtual machine snapshot is run, if the virtual machine is contaminated, the step of restoring the virtual machine snapshot based on each of the split files is re-executed.
14. The virtual machine snapshot reading method according to claim 8, characterized in that: Also includes: When it is determined that there is no need to continue running the restored virtual machine snapshot, the temporary file system is unmounted.
15. A virtual machine snapshot storage device, characterized in that: include: A directory creation module, used to create a backup directory based on the backup disk; A soft link module, used to soft link the backup directory to the virtual machine snapshot storage running directory; A snapshot acquisition module, used to acquire a virtual machine snapshot of a virtual machine running to a specific state, wherein the virtual machine snapshot is stored in the backup directory via the virtual machine snapshot storage operation directory; A split processing module, used for splitting the virtual machine snapshot to obtain at least two split files; An index generation module, configured to obtain an index file according to the at least two split files, wherein the index file includes a snapshot name of the virtual machine snapshot, and an order and a file name of each of the split files; An index encryption module, used for encrypting the index file; A snapshot deletion module, used to delete the virtual machine snapshot; An uninstall module, used for storing a soft link in the virtual machine snapshot running directory pointing to the backup directory; The setting module is used to set the backup directory to a read-only state.
16. A virtual machine snapshot reading device, used for reading the virtual machine snapshot stored by the virtual machine snapshot storing device according to claim 15, characterized in that: include: A directory adjustment module, used to use the memory as a temporary file system and adjust the directory of the temporary file system and the virtual machine snapshot storage running directory to the same directory; An index decryption module, used for decrypting the index file; A file copy module, used for copying each of the split files to the temporary file system; A snapshot restoration module, used to restore the virtual machine snapshot based on the decrypted index file and each of the split files; The snapshot running module is used to run the restored virtual machine snapshot.
17. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the virtual machine snapshot saving method according to any one of claims 1-7.
18. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the virtual machine snapshot reading method described in any one of claims 8-14.
19. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the virtual machine snapshot saving method according to any one of claims 1 to 7.
20. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the virtual machine snapshot reading method described in any one of claims 8-14.
Citation Information
Patent Citations
Systems and methods for data management virtualization
CN103415842A
Virtual machine backup and recovery method and device
CN105446826A