KVM is a hyper visor used by a lot of Linux distributions. I am currently using it and very happy with it. I have most of the abilities paid hypervisors like HyperV, Vmware provides.
KVM是许多Linux发行版使用的管理程序。 我目前正在使用它,对此非常满意。 我拥有付费的虚拟机管理程序的大多数功能,例如Hyperm,Vmware提供的功能。
Snapshots is picture of the VM in specified time. For example we will install new application but it can brake our system. We want to backup our system and if something bad happens we want to revert back. The simplest and fast solution is snapshot. I saves the status of disk and ram. And can be retrieved back.
快照是指定时间内虚拟机的图片。 例如,我们将安装新的应用程序,但它可能会制动我们的系统。 我们要备份我们的系统,如果发生不良情况,我们要还原。 最简单,快速的解决方案是快照。 我保存磁盘和内存的状态。 并可以找回。
进入Virsh控制台 (Entering Virsh Console)
The tool we will use to manage snapshots and libvirt is virsh. We can use virsh from bash or enter into virsh console. Both are same effect but I prefer to enter console.
我们将用于管理快照和libvirt的工具是virsh。 我们可以从bash使用virsh或进入virsh控制台。 两者效果相同,但我更喜欢进入控制台。
$ sudo virsh
![Entering Virsh Console](https://i-blog.csdnimg.cn/blog_migrate/5ff3770d67f2b5f1145cfd0a6f5a7677.png)
virsh needs root privileges so we provide sudo or run with root account.
virsh需要root特权,因此我们提供sudo或使用root帐户运行。
virsh# is our virsh console
virsh#是我们的virsh控制台
创建Vm快照(Create Snapshot of Vm)
Snapshots can be created by different ways but we will use libvirt to create snapshot. We will use the snapshot-create-as
command by providing the VM name which is poftut
in this case.
可以通过多种方式创建快照,但是我们将使用libvirt创建快照。 通过提供VM名称(在这种情况下为poftut
,我们将使用snapshot-create-as
命令。
virsh # snapshot-create-as poftut1
Domain snapshot 1477620808 created
We provide snapshot-create-as command to snapshot poftut1 is the domain name of the vm
我们提供snapshot-create-as命令来快照poftut1是虚拟机的域名
1477620808 is snapshot id of the vm.
1477620808是虚拟机的快照ID。
列出快照 (List Snapshots)
One VM may have more than one snapshots. We can list the snapshot of the specified VM like below.
一台VM可能具有多个快照。 我们可以像下面列出指定虚拟机的快照。
virsh # snapshot-list poftut1
snapshot-list is the command and
快照列表是命令,
poftut1 vm name is provided. We can use domain id for vm name
poftut1 提供了虚拟机名称。 我们可以使用域名ID作为虚拟机名称
Name Creation Time State
------------------------------------------------------------
1477620808 2016-10-28 05:13:28 +0300 shutoff
- As we see snapshot-list command gives details of the snapshot 如我们所见,快照列表命令提供了快照的详细信息
- 1477620808 is snapshot name1477620808是快照名称
- 2016-10-28 05:13:28 +0300 is snapshot date2016-10-28 05:13:28 +0300是快照日期
- shutoff is the status of vm while taking snapshot关机是快照时虚拟机的状态
获取快照的详细信息 (Get Details of Snapshot)
We can get more detail about snapshot with snapshot-info command.
我们可以使用snapshot-info命令获取有关快照的更多详细信息。
virsh # snapshot-info poftut1 1477620808
snapshot-info is the command get detailed info about snapshot.
snapshot-info是用于获取有关快照的详细信息的命令。
- poftut1 is the vm of the snapshot poftut1是快照的虚拟机
- 1477620808 is the snapshot name 快照名称为1477620808
Name: 1477620808
Domain: poftut1
Current: yes
State: shutoff
Location: internal
Parent: -
Children: 0
Descendants: 0
Metadata: yes
还原快照以前的版本 ( Revert Back The Snapshot Previous Version)
We have changed vm and we want to revert back. It is easy as creating snapshot
我们更改了虚拟机,并希望恢复原状。 创建快照很容易
virsh # snapshot-revert poftut1 1477620808
snapshot-revert is the command used
snapshot-revert是使用的命令
- poftut1 is the vm namepoftut1是虚拟机名称
- 1477620808 is the snapshot name快照名称为1477620808
删除快照 (Delete Snapshot)
We want to delete snapshot because we have completed our work.
我们要删除快照,因为我们已经完成了工作。
virsh # snapshot-delete poftut1 --snapshotname 1477620808
snapshot-delete is command we will use
snapshot-delete是我们将使用的命令
- poftut1 is the vm namepoftut1是虚拟机名称
We will provide snapshot name with –snapshotname argument and 1477620808
我们将使用–snapshotname参数和1477620808提供快照名称
Domain snapshot 1477620808 deleted
- We have deleted the snapshot 我们已删除快照
如何创建KVM / Libvirt / Qemu Vm的快照? 信息移植 (How To Create Snapshot of KVM / Libvirt / Qemu Vm? Infografic)
![How To Create Snapshot of KVM / Libvirt / Qemu Vm? Infografic](https://i-blog.csdnimg.cn/blog_migrate/d1b6c528c43f052e9840d0e71c52fea4.png)
翻译自: https://www.poftut.com/how-to-create-snapshot-of-kvm-libvirt-qemu-vm/