6.9. Snapshots

6.9.1. Creating a Snapshot of a Virtual Machine

A snapshot is a view of a virtual machine's operating system and applications on any or all available disks at a given point in time. Take a snapshot of a virtual machine before you make a change to it that may have unintended consequences. You can use a snapshot to return a virtual machine to a previous state.

Procedure 6.11. Creating a Snapshot of a Virtual Machine

  1. Click the Virtual Machines tab and select a virtual machine.
  2. Click the Snapshots tab in the details pane and click Create.
    Create snapshot

    Figure 6.1. Create snapshot

  3. Enter a description for the snapshot.
  4. Select Disks to include using the check boxes.

    Note

    If no disks are selected, a partial snapshot of the virtual machine, without a disk, is created. You can preview this snapshot to view the configuration of the virtual machine. Note that committing a partial snapshot will result in a virtual machine without a disk.
  5. Use the Save Memory check box if you want to include the virtual machine's memory in the snapshot.
  6. Click OK.
The virtual machine's operating system and applications on the selected disk(s) are stored in a snapshot that can be previewed or restored. The snapshot is created with a status of Locked, which changes to Ok. When you click on the snapshot, its details are shown on the General, Disks, Network Interfaces, and Installed Applications tabs in the right side-pane of the details pane.

6.9.2. Using a Snapshot to Restore a Virtual Machine

A snapshot can be used to restore a virtual machine to its previous state.

Procedure 6.12. Using Snapshots to Restore Virtual Machines

  1. Click the Virtual Machines tab and select a virtual machine.
  2. Click the Snapshots tab in the details pane to list the available snapshots.
  3. Select a snapshot to restore in the left side-pane. The snapshot details display in the right side-pane.
  4. Click the drop-down menu beside Preview to open the Custom Preview Snapshot window.
    Custom Preview Snapshot

    Figure 6.2. Custom Preview Snapshot

  5. Use the check boxes to select the VM Configuration, Memory, and disk(s) you want to restore, then click OK. This allows you to create and restore from a customized snapshot using the configuration and disk(s) from multiple snapshots.
    The Custom Preview Snapshot Window

    Figure 6.3. The Custom Preview Snapshot Window

    The status of the snapshot changes to Preview Mode. The status of the virtual machine briefly changes to Image Locked before returning to Down.
  6. Start the virtual machine; it runs using the disk image of the snapshot.
  7. Click Commit to permanently restore the virtual machine to the condition of the snapshot. Any subsequent snapshots are erased.
    Alternatively, click the Undo button to deactivate the snapshot and return the virtual machine to its previous state.

6.9.3. Creating a Virtual Machine from a Snapshot

You have created a snapshot from a virtual machine. Now you can use that snapshot to create another virtual machine.

Procedure 6.13. Creating a virtual machine from a snapshot

  1. Click the Virtual Machines tab and select a virtual machine.
  2. Click the Snapshots tab in the details pane to list the available snapshots.
  3. Select a snapshot in the list displayed and click Clone.
  4. Enter the Name and Description for the virtual machine.
    Clone a Virtual Machine from a Snapshot

    Figure 6.4. Clone a Virtual Machine from a Snapshot

  5. Click OK.
After a short time, the cloned virtual machine appears in the Virtual Machines tab in the navigation pane with a status of Image Locked. The virtual machine will remain in this state until Red Hat Virtualization completes the creation of the virtual machine. A virtual machine with a preallocated 20 GB hard drive takes about fifteen minutes to create. Sparsely-allocated virtual disks take less time to create than do preallocated virtual disks.
When the virtual machine is ready to use, its status changes from Image Locked to Down in the Virtual Machines tab in the navigation pane.

6.9.4. Deleting a Snapshot

You can delete a virtual machine snapshot and permanently remove it from your Red Hat Virtualization environment. This operation is only supported on a running virtual machine.

Important

When you delete a snapshot from an image chain, ensure there is enough free space in the storage domain to temporarily accommodate both the original volume and the newly merged volume. Otherwise, snapshot deletion will fail and you will need to export and re-import the volume to remove snapshots. This is due to the data from the two volumes being merged in the resized volume and the resized volume growing to accommodate the total size of the two merged images.
  • If the snapshot being deleted is contained in a base image, the volume subsequent to the volume containing the snapshot being deleted is extended to include the base volume.
  • If the snapshot being deleted is contained in a QCOW2 (thin provisioned), non-base image hosted on internal storage, the successor volume is extended to include the volume containing the snapshot being deleted.

Procedure 6.14. Deleting a Snapshot

  1. Click the Virtual Machines tab and select a virtual machine.
  2. Click the Snapshots tab in the details pane to list the snapshots for that virtual machine.
    Snapshot List

    Figure 6.5. Snapshot List

  3. Select the snapshot to delete.
  4. Click Delete.
  5. Click OK.

Note

If the deletion fails, fix the underlying problem (for example, a failed host, an inaccessible storage device, or even a temporary network issue) and try again.