How To Create Snapshot of KVM / Libvirt / Qemu Vm?

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/how-to-create-snapshot-of-kvm-libvirt-qemu-vm/
PINTEREST
PINTEREST
INSTAGRAM

Kvm is a hypervisor 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.

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.

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.

  • virsh needs root privileges so we provide sudo or run with root account.
  • virsh# is our virsh console

Create Snapshot of Vm

Snapshots can be created by different ways but we will use libvirt to create snapshots.sna

  • We provide snapshot-create-as command to snapshot poftut1 is the domain name of the vm
  • 1477620808 is snapshot id of the vm.

List Snapshots

One vm may have more than one snapshots. We can list the snapshot of the specified vm like below.

LEARN MORE  How To Delete Route In Ubuntu Linux

  • snapshot-list  is the command and
  • poftut1 vm name is provided. We can use domain id for vm name

  • As we see snapshot-list command gives details of the snapshot
  • 1477620808 is snapshot name
  • 2016-10-28 05:13:28 +0300 is snapshot date
  • 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 is the command get detailed info about snapshot.
  • poftut1 is the vm of the snapshot
  • 1477620808 is the snapshot name

 Revert Back The Snapshot Previous Version

We have changed vm and we want to revert back. It is easy as creating snapshot

  • snapshot-revert is the command used
  • poftut1 is the vm name
  • 1477620808 is the snapshot name

Delete Snapshot

We want to delete snapshot because we have completed our work.

LEARN MORE  How To Run Commands At Shutdown In Linux?

  • snapshot-delete is command we will use
  • poftut1 is the vm name
  • We will provide snapshot name with –snapshotname argument and 1477620808

  • We have deleted the snapshot
RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/how-to-create-snapshot-of-kvm-libvirt-qemu-vm/
PINTEREST
PINTEREST
INSTAGRAM

You may also like...

Leave a Reply

Your email address will not be published.

Enjoy this blog? Please spread the word :)