How to use snapshots on Virtualbox

Published: December 1, 2025 (Updated: Dec 1, 2025)

Enjoying this content? Subscribe to the Channel!

Mastering VirtualBox Snapshots: Your Essential Guide to Saving and Restoring VM States

Hi there! This is Darren O’Neill from Darren’s Tech Tutorials, and today we’re diving into one of the most powerful and useful features of VirtualBox: Snapshots.

If you’ve ever hesitated before making a risky configuration change, or if you need a guaranteed rollback point before testing new software, Snapshots are your safety net. They allow you to instantly save the entire state of your virtual machine (VM) and return to it later. I can tell you, this feature has saved me on numerous occasions!

In this guide, we’ll walk through the process of taking a snapshot of a running virtual machine and then restoring it to completely undo any subsequent changes.


Why Snapshots Are Your VM Superpower

Think of a VirtualBox snapshot as a save point in a video game. It captures the machine’s exact status—its memory, disk files, hardware configuration, and even what applications are currently running.

When should you use a snapshot?

  • Before system updates: Rollback if the update breaks dependencies.
  • Testing new software: Isolate potentially malicious or unstable applications.
  • Configuration changes: Guarantee a working instance to fall back on before modifying network settings or core system files.

Step 1: Taking a Snapshot of a Running Virtual Machine

For this tutorial, we are using a CentOS VM that is currently running and accessible via SSH.

  1. Locate the Snapshot Menu: With your VirtualBox Manager open, ensure your target VM is selected. On the right-hand panel, look for the small three-dot menu icon (often labeled “Menu”) next to the VM details.
  2. Access Snapshots: Click the three dots, then select Snapshots.
  3. View Current State: You will see the Snapshots panel. Initially, you should only see the “Current State” listed, with no existing saved snapshots.
  4. Take the Snapshot: Click the Take button (often represented by a small camera icon).
  5. Name Your Snapshot: A dialog box will appear. Give your snapshot a clear, descriptive name. Since we are taking this before making changes, we’ll call ours: Before File.
  6. Click OK.

VirtualBox will now begin saving the machine state. This process might take a few seconds, as it writes the state of the machine’s memory and disks to a file. Once complete, your new snapshot will appear in the list!


Step 2: Testing the Rollback – Making Changes

To demonstrate how effective the rollback is, let’s make a clear, measurable change on the running VM that we want to undo later.

  1. Connect to the VM: Access your running VM (either through the main console or via SSH).

  2. Create a New File: Use the touch command to create a new file, and then add content to it.

    # Create the file
    touch testfile
    
    # Insert some content
    echo "Hello, I am the test file." > testfile
    
  3. Verify the Change: If you run ls, you should clearly see testfile listed in the directory.

We now have a test file on the machine, but we have a safe snapshot (Before File) that was taken before this file existed.


Step 3: Restoring Your VM to a Previous State

The moment of truth! To undo the changes we just made, we need to restore our saved state.

Crucial Prerequisite: You cannot restore a snapshot while the VM is running. You must first power it down safely.

  1. Power Off the VM: Execute the shutdown command on your virtual machine.

    sudo init 0
    # or sudo shutdown now
    
  2. Wait for Shutdown: Wait for the VM to fully power off and show the “Powered Off” state in the VirtualBox Manager.

  3. Initiate Restore: In the Snapshots menu, select the snapshot you want to return to (Before File).

  4. Click Restore: Click the Restore button.

  5. Confirmation Check: VirtualBox will ask if you want to create a snapshot of the current machine state (the one with the test file) before restoring. Since we want to completely erase the current state and return to the past, do not check this box.

  6. Click Restore.

VirtualBox will now restore the machine. This process may take a minute or two as it reverses the state and sets the disks back to their previous configuration.


Step 4: Verification and Conclusion

The restore is complete! Now let’s verify that the snapshot did its job.

  1. Power On the VM: Start the virtual machine as you normally would.

  2. Log In: Once the VM boots back up, log in to the system.

  3. Check the File System: Navigate back to the directory where you created the testfile and run the ls command again.

    ls
    

The Result: The testfile is gone! Because we restored our state, we have literally gone back in time to the exact moment the snapshot was taken, wiping out the creation of that file and any other configuration changes made afterward.

Snapshots are a remarkably useful tool, ensuring that no matter how complex or risky your testing is, you always have a known, working state to return to. They make testing configurations in your lab environment painless and safe!

If this guide was helpful and snapshots saved your machine, please do like the video and subscribe to Darren’s Tech Tutorials for more clear, accessible technology guides. Thank you for watching!