Snapshot a Btrfs Filesystem Before Risky Changes
Create a copy-on-write snapshot in seconds that costs almost no extra space until files change.
Run sudo btrfs subvolume snapshot / /mnt/snapshots/root-$(date +%F) to snapshot the root filesystem; add -r for a read-only snapshot.
01Command
Command
$ sudo btrfs subvolume snapshot / /mnt/snapshots/root-$(date +%F)02What it does
A Btrfs snapshot is a copy-on-write subvolume clone: it records metadata only, so it is created in about a second and consumes no additional space until you actually modify files. Rolling back is simply deleting the broken state and restoring, or booting an older snapshot if your bootloader supports it (snapper/timeshift automate this). Add -r to make the snapshot read-only so nothing can accidentally alter it, and send/receive can then replicate read-only snapshots to another disk.
03Risk
!Warning: A snapshot protects against changes, not against disk failure — it lives on the same device, so it is no substitute for a real backup.
04Undo
Undo
$ sudo btrfs subvolume delete /mnt/snapshots/root-YYYY-MM-DD05Sources
- btrfs-subvolume(8) — control btrfs subvolume objectsEvidence: Official page documents 'btrfs subvolume snapshot <source> <dest>|<name>' including '-r' for read-only snapshots, and 'subvolume delete'; the word 'snapshot' appears throughout.
- btrfs-subvolume(8) — Debian man pageEvidence: Man page contains SNAPSHOT in the section header documenting 'btrfs subvolume snapshot [-r] <source> <dest>|<name>' and the delete subcommand.
Last verified: 2026-09-19 · Category: Files & Folders