brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: snap save makes a snapshot of a snap's data before you try something risky

Snap
~/tips/tip-snap-save-before-risky-change

sudo snap save lxd

Keep a restorable copy of an app's data and settings.

Before I change settings deep inside a snap app, I want a way back. Snap has snapshots built in.

sudo snap save lxd
snap saved

save stores the user, system and configuration data of the snap, and saved lists the snapshots with their set ID. Leave the name off to snapshot every installed snap. You can check that a set is intact:

sudo snap check-snapshot 30

Here 30 stands for the ID from your own list. To go back:

sudo snap restore 30 lxd

Restoring replaces the current data with what is in the snapshot, so anything you added since then is gone. Stop and think before you press Enter on that one.

Old sets take disk space under /var/lib/snapd/snapshots. Remove one you no longer need with sudo snap forget 30, which cannot be undone.

I would not call this a backup. The files sit on the same disk as the app, so a dead drive takes both. And an app that is writing to a database while you save may give you a copy that is not consistent, so stop it first if the data matters.

Further reading: Snapcraft: Create data snapshots

More Snap tips snap refresh --list snap services sudo snap stop --disable lxd.daemon sudo snap alias vlc my-vlc snap saved All Snap tips (14) All topics

Link