Snapshots


Table of Contents

Storage Snapshots

Snapshots allows you to create filesystem snapshots, and rollback the system to a previous snapshot.

  • Note: This feature requires a Btrfs filesystem. All of the FreedomBox stable disk images use Btrfs.

Snapshots

There are three types of snapshots:

  • boot: Taken when the system boots up

  • Software Installation (apt): Taken when software is installed or updated

  • Timeline: Taken hourly, daily, weekly, monthly, or yearly

The Timeline and Software Installation snapshots can be turned on or off, and you can limit the number of each type of Timeline snapshot. You can also set a percentage of free disk space to be maintained.

How Snapshots Work

Snapshots are organized as a tree. Every snapshot (including the current working state of the system, which is itself a writable snapshot) has a parent from which it was created. The stored snapshots are immutable, only current snapshot is editable.

How snapshots are a tree

Taking a snapshot never copies any data. All snapshots share their data blocks with each other. When a snapshot is created, it simply refers to the same data blocks as its parent. When you modify a file in the working state, only the modified data blocks are copied and written to new locations (this is called "copy on write", CoW). Unmodified data blocks continue to be shared between all snapshots. This is why snapshots take up very little space until data actually changes.

How data is shared across the snapshots

When you select "Restore from snapshot" in the interface, the following happens:

  1. A read-only snapshot of the current system (D) is taken, preserving any recent changes as a reference point.

  2. A new writable snapshot (B') is taken from the selected (B) snapshot, and the system is set to boot into it after a reboot.

  3. Until you reboot, the system continues to run on its existing root subvolume. After rebooting, the system runs on the restored snapshot.

What happens when restoring a snapshot