3

Background

I tend to save my VirtualBox VM snapshots while the system is running. This shaves off some time when I resume next work's session.

But I have read in a few places that the best thing to do is to shut the VM before taking its snapshot.

Examples

  • From The best practice to backup a system:

    For a consistent and quick snapshot I recommend you shut down the VM before taking the snapshot.

  • From this other SE answer:

    you can use VirtualBox's built in snapshot feature.

    1. shut down your guest OS
    2. In the VirtualBox Manager, select your guest VM
    3. <etc.>
  • From this website:

    Prefer snapshots of powered off system to paused or running system. Even though it’s inconvenient to setup it will save you some hard drive space.


So far the only inconveniences I have found for taking a snapshot of a running VM are:

  • System clock frozen at the time when the snapshot was taken.
  • A bit more extra storage space taken.
  • The VM's system settings (such as memory, chipset, etc.) cannot be altered.

These points above are minor issues which can be easily addressed.

But I have found nothing convincing that explains why it's better to shut down a VM before taking a snapshot.

Web searches don't turn up much either.

My question

Is it really best practice to shut a VM down before taking a snapshot? If so, why?

2
  • 2
    When returning to the snapshot, your machine is in a more stable state. E.g., it might (wrongly) assume that several network connections are open, when they are not. Commented Sep 19, 2020 at 18:45
  • 1
    Here's what I've been doing. If I plan on coming back to the snapshot later, I'll shut it down and then build the snapshot. But if I'm doing a quick test (same day) and am not planning on keeping the snapshot. Then I'll keep the VM running and build the snapshot, making the test faster for the day. You are less likely to have long-term issues if you build the snapshot with the VM off.
    – TechLoom
    Commented Jan 19, 2023 at 15:24

1 Answer 1

2

It is technically better to have the system shut down as the data is then correctly and fully written.

Provided the disk filesystem's are journalling systems the filesystem should always be consistent so it is safe (from a data/point in time recovery POV) - it might, however, be very slightly (seconds) behind the reality.

A useful way of thinking of it - Starting a snapshot of a live VM is very much akin to turning on a computer after a sudden power outage. The data on disk is consistent, but stuff you had not saved is gone, and the OS will need to fsck/check the filesystem for consistency (and replay the journal...).

Snapshotting a live VM can be a totally viable way of making backups on systems requiring very high uptime if they are web/database/transaction driven, but probably not great for desktops/places where data is stored in memory until written at a users cm and.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .