is*hosting Blog & News - Next Generation Hosting Provider

How snapshots work and when you need them

Written by is*hosting team | Feb 25, 2023 11:00:00 AM

Snapshot technology is necessary if you want to make changes to a virtual machine and not be afraid of "messing up" the whole system. A snapshot is an opportunity to go back and correct mistakes.

What is a snapshot?

A snapshot saves the state of a virtual machine or file system. For example, snapshots can include VM settings, RAM, and disk contents.

A file system snapshot captures files and directories of the file system at a specific moment in time. You can also take a snapshot of a database.

A snapshot of a virtual machine saves its settings, operating system, and other files. For example, you can take a snapshot of a virtual machine with "freshly installed" Windows so that you can then make changes that involve some risk.

What are snapshots used for?

After you create a snapshot, any changes you make are not written to disk, but to a separate file. In case of failure, inappropriateness or incorrectness of the changes made, it is enough to delete this file and you will restore the original state of the file system or virtual machine. If changes need to be saved, they will be written to disk and work will continue as usual.

Computer snapshots can also be taken during your experiment, so the structure of the snapshots will be represented as a tree or a chain. Then, if you delete one of the snapshots, all changes after it will be lost. If you cancel a snapshot, all of its contents will be merged with the following snapshot or with the current state of the VM.

For example, if you work with VirtualBox and try to restore the system state from a snapshot, you will get a notification that the changes you have made will be irretrievably deleted.

Snapshot features:

  • Snapshots of data can be taken both when the machine is on and when it is off;
  • Snapshots do not take up much RAM. But if you won't control their creation, snapshots can quickly become larger than the file system;
  • Snapshots can slow down the operation of a virtual machine, so it is recommended not to store them for more than 72 hours. They are automatically deleted after a while;
  • There are no security risks when creating data snapshots;
  • Snapshots can be quickly created and recovered.

The difference between backups and snapshots 

Backup is a copy of all or part of the files, while a snapshot is a fixation of the system state.

Backup

Snapshot

Stored on a third-party device

Stored near the system

Copy of any kind of data

Fixation of the system and its state at a certain point in time

Stored for a long time

Stored for a limited amount of time and automatically deleted

Takes up a lot of RAM

Takes up a small amount of RAM

May be stored on different devices in multiple copies

Stored as a hierarchy or chain

Can only be created on a turned on device

Can be created both on a turned on and off device

Long-term file archiving

Short-term state storage

Created on a regular basis

Good for one-time creation

Backups are necessary for archiving data to restore access to it in case of failure and restore the functionality of the whole system. You can back up all files or only certain files.

Snapshots are ideal for experiments with the system, and for correcting mistakes after changes have been made. Snapshots are an opportunity to try something new without the fear of breaking the already-built structure.