Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

7. Kvm virtual machine snapshot backup

2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

The kvm virtual machine uses raw image format by default, which has the best performance and the fastest speed. Its disadvantage is that it does not support some new functions.

Such as support mirroring, zlib disk compression, AES encryption and so on.

To use the mirroring feature, the disk format must be qcow2. Let's start the process of kvm virtual machine snapshot backup.

1. View existing disk image format and conversion

(1) View disk format

# qemu-img info kvm08.img

Raw format needs to be converted to qcow2

(2) shut down the virtual machine and convert the disk

# virsh shutdown kvm08

(3) convert disk format

# qemu-img convert-f raw-O qcow2 kvm08.img kvm08.qcow2 time is a little long ~

-f format of source image

-O format of the target image

Check the converted format, which has been converted to qcow2. Here is a copy and convert the format to qcow2.

# qemu-img info kvm08.qcow2

two。 Modify virtual machine configuration fil

Modify the disk format to a disk in the new qcow2 format.

3. Snapshot management of virtual machines

(1) create a snapshot of the kvm08 virtual machine

You can also virsh snapshot-create kvm08 to create a snapshot alias.

(2) View the version of the virtual machine image snapshot

Virsh snapshot-list kvm08

(3) View the version of the current virtual machine image snapshot

You can see that this is the latest snapshot version.

Virsh snapshot-current kvm08

(4) View the current virtual machine image file

Another one has been created, and the version of the snapshot has been recorded in the mirror file.

Snapshot profile is under / var/lib/libvirt/qemu/snapshot/ virtual machine name /

4. Restore virtual machine snapshot

(1) to restore a virtual machine snapshot, you must shut down the virtual machine.

Confirm that the virtual machine is powered off

(2) confirm the snapshot time that needs to be restored, and restore it here as shown in the figure.

(3) perform the restore and confirm the restore version

# virsh snapshot-revert kvm08 1461665430

5. Delete virtual machine snapshot

(1) View virtual machine snapshots

# qemu-img info kvm08.qcow2

Delete the second snapshot here

(2) Delete a snapshot

At this point, the kvm virtual machine snapshot has been tested.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report