Exercise: Storage and Snapshots

Comparing VM and Container Snapshots

A hands-on exercise to demonstrate and compare the concept of snapshots for both a traditional virtual machine (using virt-manager) and an application container (using podman commit).
Author

Chuck Nelson

Published

November 16, 2025

1 Purpose

This exercise demonstrates the different approaches to “snapshotting” in traditional virtualization versus containerization. You will create a point-in-time snapshot of a virtual machine’s disk and memory state. Then, you will “snapshot” a container by committing its changes to a new, reusable image. This highlights the philosophical difference between stateful, persistent VMs and stateless, ephemeral containers.

2 What You’ll Accomplish

By the end of this exercise, you will be able to:

  • Create a snapshot of a VM using virt-manager.
  • Use podman commit to create a new image from a container’s changes.
  • Explain the conceptual difference between a VM snapshot and a container image.

This exercise maps to the following program and course learning outcomes:

  • Course Learning Outcomes (CLOs):
    • 1. Identify hardware and basic network components: This exercise covers the management of virtual storage components (virtual disks and container images).

This exercise develops the following skills, which align with the O*NET SOC Code 15-1232.00 for Computer User Support Specialists.

Learning Objective O*NET KSAs Technologies Used
Create a VM snapshot. Knowledge: Computers & Electronics
Skills: None
virt-manager
Create a container image from a container. Knowledge: Computers & Electronics
Skills: None
podman commit

3 Prerequisites

This exercise requires: - A running Fedora 42 VM (your main exercise environment). - A virtual machine created in virt-manager (from Exercise 9.1). It does not need to be running.

4 Step-by-Step Guide

4.1 Part 1: Virtual Machine Snapshot

A VM snapshot saves the entire state of a virtual machine at a specific moment in time—including the contents of its memory (if running) and the exact state of its virtual hard disk.

  1. Open virt-manager and ensure your VM from Exercise 9.1 is selected.
  2. Open the Snapshots View: With the VM selected, click the “View” menu, then “Snapshots”.
  3. Create a New Snapshot: Click the “Create new snapshot” button (a plus icon) in the bottom left.
  4. Name the snapshot Before-Updates and provide a simple description like “Clean install state.”
  5. Click “Finish”.
  6. A new snapshot will appear in the list. You can now make changes to your VM (like installing software), and if something goes wrong, you can select this snapshot and click “Apply” to revert the entire machine to this exact saved state.

4.2 Part 2: Container “Snapshot” (Image Commit)

Containers are typically stateless, meaning changes made inside them are lost when the container is removed. To “save” the state of a container, you don’t snapshot the running instance; instead, you commit its changes to a new, reusable image.

  1. Start a Basic Container: We will start a basic alpine container and give it a name.

    podman run -d --name=my-test-container docker.io/library/alpine sleep 3600
  2. Make a Change: Use podman exec to create a new file inside the running container. This is our “change.”

    podman exec my-test-container touch /hello-from-chuck.txt
  3. Commit the Change to a New Image: The podman commit command takes the current state of the container’s filesystem and saves it as a new image.

    podman commit my-test-container my-new-alpine-image
  4. Verify the New Image: List your local Podman images. You will see your new image in the list.

    podman images

    You can now run a new container from my-new-alpine-image, and it will already contain the /hello-from-chuck.txt file. You have created a new, reusable blueprint from your changes.

4.3 Part 3: Understand the Difference

  • The VM snapshot saved the live state of a specific, running machine. It’s a backup and a restore point.
  • The container commit created a new, stateless template (image) from the changes made in a container. It’s a way to create a new version of a blueprint.

4.4 Step 4: Clean Up

  1. Stop and remove the test container.

    podman stop my-test-container
    podman rm my-test-container
  2. Remove the new image you created.

    podman rmi my-new-alpine-image

5 Reflect and Review

ImportantReflection: 3-2-1

Now that you have completed this exercise, reflect on your experience in your Microsoft Teams Student Notebook:

  • 3 commands or actions you took in this exercise.
  • 2 technologies you used (virt-manager, podman).
  • 1 question you still have about the difference between an image and a snapshot.
TipCheck on Learning

Answer these questions in your notebook to solidify your understanding:

  1. What is the primary purpose of taking a snapshot of a VM?
  2. What does the podman commit command produce as its output?
  3. If you take a VM snapshot while the VM is running, what additional information is saved compared to a snapshot of a powered-off VM?
  4. Why is “committing an image” a more natural fit for the container philosophy than taking a live snapshot of a running container?
Back to top