A snapshot is a copy of the user, system and configuration data stored by snapd for one or more snaps on your system.
Snapshots are generated manually with the
snap save command and automatically when a snap is removed (requires snapd 2.39+). A snapshot can be used to backup the state of your snaps, revert snaps to a previous state and to restore a fresh snapd installation to a previously saved state.
Snapshots require snap version 2.37+.
snap save command creates a snapshot for all installed snaps, or if declared individually, specific snaps:
$ sudo snap save Set Snap Age Version Rev Size Notes 30 core 1.00s 16-2.37~pre1 6229 250B - 30 core18 886ms 18 543 123B - 30 go 483ms 1.10.7 3092 387B - 30 vlc 529ms 3.0.6 770 882kB -
Each snapshot has a unique ID, or revision, shown in the Set column above. This value is unique to each save operation, regardless of the number of snaps it includes. Age is the period of time since the snapshot was created, while Version and Rev refer to the specific snap at the time of the snapshot. Size is the amount of storage used by a snapshot.
You can see the state of your system’s snapshots with the
snap saved command. Adding
--id=<set/unique ID> allows you to query a specific snapshot:
$ snap saved --id=29 Set Snap Age Version Rev Size Notes 29 vlc 2h41m 3.0.6 770 882kB -
To verify the integrity of a snapshot, use the
$ snap check-snapshot 30 Snapshot #30 verified successfully.
restore command replaces the current user, system and configuration data with the corresponding data from the specified snapshot:
$ snap restore 30 Restored snapshot #30.
By default, this command restores all the data for all the snaps in a snapshot. You can restore data for specific snaps by simply listing them after the command, and for specific users with the
Excluding a snap’s system and configuration data from snap restore is not currently possible.
forget command deletes a snapshot. This operation removes a snapshot from local storage and can not be undone:
$ snap forget 30 Snapshot #30 forgotten. $ snap saved --id=30 No snapshots found for that ID.
By default, this command deletes all the data for all the snaps in a snapshot. You can delete the data for specific snaps by listing them after the command.
Apart from on Ubuntu Core devices, where the feature is disabled by default, a snapshot is generated automatically when a snap is removed. These snapshots are retained for 31 days before being deleted automatically.
To see which snapshots are generated automatically, look for
auto in the Notes column output from snap saved:
$ snap saved Set Snap Age Version Rev Size Notes 30 go 25d5h 1.10.7 3092 387B - 30 vlc 25d0h 3.0.6 770 882kB - 31 vlc 529ms 3.0.6 770 882kB auto
As with manual snapshots, automatically generated snapshots can be manually deleted with
snap forget <set-id>.
Automatic snapshot retention time is configured with the
snapshots.automatic.retention system option. The value needs to be greater than 24 hours:
$ snap set system snapshots.automatic.retention=30h
To disable automatic snapshots, set the retention time to
$ snap set system snapshots.automatic.retention=no
Disabling automatic snapshots will not affect pre-existing automatically generated snapshots, only those generated by the removal of subsequent snaps.
Automatic snapshots require snap version 2.39+.
Snapshots are stored as a zip file for each snap, and each zip file contains the following:
On Ubuntu-based systems, snapshots are stored in the
Last updated 1 year, 5 months ago. Help improve this document in the forum.