Creating a Snapshot in ASP using CLI

Last Updated : Nov 19, 2026 |
Prolog information
Caution:
Creating a snapshot requires shutting down the virtual machine, which causes a temporary interruption in service.
  1. Log in to the KVM host using SSH or the server console.
    ADDITIONAL INFORMATION:
    For example, ssh <USERNAME>@<KVM_HOST_IP>
  2. Run the following command to switch to root user:
    ADDITIONAL INFORMATION:
    sudo su -
  3. Run the following command to display all registered virtual machines and their current states:
    ADDITIONAL INFORMATION:
    virsh list --all
    Identify the exact name of the virtual machine for which you want to create a snapshot.
  4. Run the following command to check the current status of the virtual machine:
    ADDITIONAL INFORMATION:
    virsh domstate <VM_Name>
  5. Optional: If the virtual machine status is running, run the following command to shut down the virtual machine:
    ADDITIONAL INFORMATION:
    virsh shutdown <VM_Name>
    Wait until the virtual machine shuts down before continuing. The shutdown time depends on the guest operating system and application services.
  6. Run the following command to verify that the virtual machine is shut down:
    ADDITIONAL INFORMATION:
    virsh domstate <VM_Name>
  7. Run the following command to create the snapshot:
    ADDITIONAL INFORMATION:
    virsh snapshot-create-as --domain <VM_Name> --name <Snapshot_Name> --description <Description>
    After the snapshot is created, the following message appears: Domain snapshot <Snapshot_Name> created.
  8. Run the following command to view the list of snapshots for the virtual machine and verify that the new snapshot is listed:
    ADDITIONAL INFORMATION:
    virsh snapshot-list <VM_Name>
  9. Run the following command to start the virtual machine:
    ADDITIONAL INFORMATION:
    virsh start <VM_Name>
    When the virtual machine starts, following message appears: Domain <Snapshot_Name> started.