
snapper: Essential Snapshot Management
What is snapper?
snapper is a filesystem snapshot management tool (commonly used with Btrfs and other Linux filesystems) that helps you create, list, and delete snapshots. It operates per-config, so you’ll often work with a specific config tied to a directory or mount point.
Quick-start flow
- List available configs to see what you can manage.
- Create a config for a path you want to snapshot.
- Create snapshots with descriptions before risky operations.
- List and delete as needed.
1) List snapshot configs
This shows the configs you currently have registered.
snapper list-configs
Common pitfall: you might expect a config for every mount. Snapper only shows what’s configured; you may need to create a config for new paths you want snapshotted.
2) Create a snapper config
Create a dedicated config for a directory (path).
snapper -c myconfig create-config /path/to/directory
Notes:
- Replace myconfig with your desired config name.
- The path should be a filesystem where snapshots will be stored (snapper often uses Btrfs subvols).
Potential pitfall: running as a regular user may fail if the system requires root privileges or proper permissions. Use sudo when needed.
3) Create a snapshot with a description
Capture the current state before making changes.
snapper -c myconfig create -d "Before big update" "/path/to/directory"
- The -d/—description helps you remember why this snapshot exists.
- You can omit the path if the config already points to the target; otherwise include it.
4) List snapshots for a config
See all snapshots tied to a config.
snapper -c myconfig list
Filter quickly by grep if you’re after a specific snapshot description or date:
snapper -c myconfig list | grep -i "Before big update"
Common pitfall: listing snapshots may show many entries. Use date and description to identify the correct one to restore or delete.
5) Delete a single snapshot
Keep your snapshot count under control by removing old entries.
snapper -c myconfig delete 123
Where 123 is the snapshot number shown in the list output.
6) Delete a range of snapshots
If you need to prune several consecutive snapshots:
snapper -c myconfig delete 120-125
This deletes snapshots from 120 through 125 inclusive.
Practical tips
- Always verify the config and path before creating or deleting snapshots.
- Prefer descriptive snapshot descriptions, e.g., before major upgrades or configuration changes.
- If you’re unsure about the filesystem type (Btrfs, LVM, etc.), consult your distro docs or the snapper manpage before heavy use.
- Regularly prune old snapshots to avoid consuming all space; automated hooks can help, but manual review is wise.
Common mistakes
- Running snapper commands without the correct -c config or on the wrong path.
- Deleting snapshots by number without verifying the exact item you’re removing.
- Assuming every directory has a snapper config by default; you must create configs for paths you want to snapshot.
Where to learn more
- Snapper man page: snapper —help or man snapper
- Configuration specifics vary by distro and filesystem; refer to your distribution’s documentation for integration details.