14.4. Reverting to a virtual machine snapshot by using the command line
To return a virtual machine (VM) to the state saved in a snapshot, you can use the command-line-interface (CLI).
Prerequisites
- A snapshot of the VM is available, which you have previously created in the web console or by using the command line.
- Optional: You have created a snapshot of the current state of the VM. If you revert to a previous snapshot without saving the current state, changes performed on the VM since the last snapshot will be lost.
Procedure
Use the
virsh snapshot-revertutility and specify the name of the VM and the name of the snapshot to which you want to revert. For example, the following command reverts theTestguest2VM to theclean-installsnapshot.# virsh snapshot-revert Testguest2 clean-install Domain snapshot clean-install reverted
Verification
Display the currently active snapshot for the reverted VM:
# virsh snapshot-current Testguest2 --name clean-install