How to use virsh to create snapshots for Debian 11

In this article, I'd like to discuss how to use virsh to create snapshots for a Debian 11 VM I created with KVM or WebConsole.

Syntax

Let's take a look at syntax for available commands which begins with snapshot with virsh

$ virsh help | grep snapshot-
    snapshot-create                Create a snapshot from XML
    snapshot-create-as             Create a snapshot from a set of args
    snapshot-current               Get or set the current snapshot
    snapshot-delete                Delete a domain snapshot
    snapshot-dumpxml               Dump XML for a domain snapshot
    snapshot-edit                  edit XML for a snapshot
    snapshot-info                  snapshot information
    snapshot-list                  List snapshots for a domain
    snapshot-parent                Get the name of the parent of a snapshot
    snapshot-revert                Revert a domain to a snapshot

snapshot-create

I recommend using snapshot-create-as which allows me to specify --domain (name of vm) , --name (name of snapshot), --description (some note for myself)

Here is Debian 11 vm I created earlier.

$ virsh list | egrep 'Name|d11vm'
 Id   Name         State
 21   d11vm        running

To create our first snapshot from d11vm:

$ virsh snapshot-create-as --domain d11vm --name d11snap01 --description "First Snapshot"
Domain snapshot d11snap01 created

I used d11snap01 for the name of snapshot and some note for myself.

snapshot-list

To see a list of snapshots from our d11vm:

$ virsh snapshot-list --domain d11vm
 Name        Creation Time               State
--------------------------------------------------
 d11snap01   2021-08-22 16:59:32 -0700   running

snapshot-info

snapshot-revert

snapshot-delete


CategoryVirtualization | CategorySystemAdministration