Configure Btrfs Snapshots on elementary OS
Btrfs is a modern Linux file system that combines ordinary storage with features such as copy-on-write, checksums, subvolumes and snapshots. For an elementary OS computer, its most useful role is creating a restorable point before a system upgrade, driver change or major configuration experiment.
Snapshots are especially helpful on a desktop that changes regularly. You can test a new kernel, install a different desktop utility or adjust system files, then return to an earlier state if the change causes trouble. The process is fast because a snapshot initially records metadata rather than copying every file.
There is an important distinction between a snapshot and a backup. A snapshot normally lives on the same physical disk as the original data, so it will not protect against disk failure, theft, fire or accidental deletion of the whole file system. Personal files should still be copied to another disk, a NAS or a reputable cloud service.
The method below suits an existing elementary OS installation where you are comfortable with a terminal and a live USB. Repartitioning an installed system carries real risk. If you are installing from scratch, choosing a deliberate Btrfs layout during installation is usually cleaner than converting a working system afterwards.
| Approach | Strengths | Limitations | Best use |
|---|---|---|---|
| Ext4 with ordinary backups | Simple, mature and widely supported | No instant file-system snapshots | A low-maintenance desktop |
| Btrfs with manual snapshots | Flexible, efficient and built into the file system | Requires planning and maintenance | Experienced users who want rollback points |
| Btrfs with Snapper | Snapshot policies and cleanup can be automated | Setup is more involved on elementary OS | Regular system changes and upgrades |
| Timeshift in Btrfs mode | Easier graphical workflow | Its expected subvolume layout must be followed | Users who prefer a guided tool |
| Separate backup drive | Protects against disk failure and deletion | Uses extra hardware and takes longer | Essential protection for personal data |
Decide Whether Btrfs Fits Your Desktop
Btrfs is a good match for users who want recoverable system changes rather than simply a different storage format. A snapshot can preserve the state of /etc, installed software metadata and other operating-system files before a risky operation. It can also make it easier to inspect an earlier version of a configuration file.
The benefit is less significant when the computer is used for web browsing, documents and a few stable applications. Snapshots do not make applications safer, and they do not replace a copy of documents. They can also consume substantial space when large files are changed repeatedly after a snapshot is created.
Laptop users in Sydney or Melbourne may appreciate snapshots when relying on an NBN connection for updates and recovery downloads. A local rollback can be quicker than reinstalling the system over a busy home connection. If an elementary OS machine travels between home, university and work, however, an external backup remains important because a lost laptop takes its snapshots with it.
Check the hardware before proceeding. Solid-state drives perform well with Btrfs, while older hard disks may feel slower during heavy copy-on-write activity. Keep reasonable free space, enable TRIM for SSDs, and avoid treating compression as a substitute for capacity. A modern Linux kernel and the btrfs-progs package are required.
Plan Partitions And Subvolumes
A fresh installation gives you the cleanest design. Use a GPT-partitioned disk with an EFI System Partition formatted as FAT32, followed by a Btrfs partition for the Linux system. A swap partition is optional; a swap file needs extra care on Btrfs because copy-on-write must be disabled for it. Hibernation also requires enough swap and additional configuration.
Within the Btrfs volume, separate subvolumes for the root system and user data. A practical arrangement is @ mounted at /, @home mounted at /home, and optionally @log mounted at /var/log. Some snapshot tools expect particular names, so decide whether you will use Timeshift, Snapper or manual commands before creating the layout.
Keeping /home separate prevents a system rollback from silently replacing every personal configuration file. It also means a restored root snapshot may leave an application’s settings from a newer state in place. That trade-off is usually preferable to losing current documents or browser profiles, and it reinforces the need to back up /home independently.
For an existing installation, do not attempt to change the root file system while it is mounted and running normally. Boot an elementary OS live USB, use lsblk -f and btrfs filesystem show to identify devices, then make a full backup. The Australian Consumer Law can help with faulty goods, but it does not recover data damaged by an unsafe partitioning operation, so hardware warranty rights should not be confused with data protection.
Create And Inspect Snapshots
Install the basic tools from the terminal:
sudo apt update
sudo apt install btrfs-progs
Confirm the mounted file system before making a snapshot:
findmnt -no SOURCE,FSTYPE,OPTIONS /
sudo btrfs filesystem usage /
The output should identify Btrfs as the file-system type. A manual read-only snapshot of the root subvolume might look like this:
sudo btrfs subvolume snapshot -r / /.snapshots/root-before-upgrade
The destination must be on the same Btrfs volume. The -r option makes the result read-only, which protects the snapshot from casual changes. Snapshot directories are often placed in /.snapshots, but that directory must be created on the correct Btrfs subvolume rather than inside a location that will be captured recursively.
To inspect available snapshots, use:
sudo btrfs subvolume list /
To remove an obsolete snapshot, first ensure it is not mounted or being used by a recovery tool, then run:
sudo btrfs subvolume delete /.snapshots/root-before-upgrade
A snapshot created immediately before an upgrade is useful only if the system can boot into it or if its contents can be copied back from a live environment. Snapshot creation alone does not automatically add a recovery entry to GRUB. That is why boot integration and a tested live USB matter.
Automate Safely With Snapper
Snapper provides policies for creating, comparing and deleting Btrfs snapshots. It can create snapshots before and after package operations, allowing you to identify which files changed. On Ubuntu-based systems, package availability and integration can vary by release, so check the package version offered by your elementary OS base before relying on automatic hooks.
After installing Snapper, create a configuration for the root subvolume, commonly with a command similar to:
sudo snapper -c root create-config /
Inspect the generated configuration before enabling frequent snapshots:
sudo snapper -c root get-config
Set a conservative timeline policy. Hourly snapshots are excessive for many desktops; a few daily snapshots and several recent administrative snapshots may be enough. Use Snapper’s cleanup settings to cap the number retained, because Btrfs snapshots share unchanged blocks but still grow as files are modified.
A safe routine is to create a named snapshot before a major update, perform the update, test the desktop and then remove the snapshot after several successful boots. Snapshots of a root subvolume do not consistently capture databases, virtual machines or application data that is changing during the operation. Stop those programs first, and use application-specific export tools for important data.
Manage Space Performance And Recovery
Monitor capacity with:
sudo btrfs filesystem usage /
sudo btrfs filesystem df /
The first command gives a broader view of allocated and unallocated space, while the second reports data and metadata allocation. Btrfs can appear to have free space while a particular allocation profile is becoming constrained, so use both commands when diagnosing warnings.
Compression can save space and often helps SSD workloads. Add compress=zstd:3 to the relevant Btrfs mount options in /etc/fstab, then remount or reboot. Existing files are not necessarily recompressed immediately; new writes and rewritten files receive the option. Test performance rather than assuming a higher compression level is better.
A balance operation can redistribute chunks when allocation becomes uneven:
sudo btrfs balance start -dusage=75 -musage=75 /
Do not run balance commands routinely on a nearly full disk or interrupt important maintenance without a reason. Keep at least a sensible reserve of free space, particularly on laptops with a 256 GB drive. Snapshots retain old extents, so deleting large files may not release as much space as expected until the snapshots holding those extents are removed.
For rollback, use a live USB if the installed system will not boot. Mount the Btrfs volume, list subvolumes, and identify the known-good snapshot. A complete rollback may require renaming the current root subvolume, creating a writable replacement from the snapshot, correcting /etc/fstab, and rebuilding the boot configuration. This is safer when documented in advance and practised on a spare installation.
Combine Snapshots With Everyday Safeguards
Snapshots work best as one layer in a broader recovery routine. Use a separate drive for /home, project directories and exported application data. A USB SSD is practical for many Australian households, while a NAS can suit a home office in Brisbane or Perth. Encrypt portable backup media and keep at least one backup disconnected when it is not being updated.
Encrypting the main disk with LUKS and using Btrfs inside the encrypted container protects data if a laptop is lost. It does not protect files while the machine is unlocked, and it does not turn snapshots into off-device backups. Store recovery keys safely, test them before travelling and record the disk layout somewhere separate from the computer.
Be selective with software installed outside the elementary AppCenter or trusted repositories. When testing downloads from unfamiliar sources, including unsafe download sites, verify the publisher, prefer signed packages and scan scripts before running them with sudo. A snapshot can reverse file changes, but it cannot undo an exposed password, stolen browser session or malicious action on another device.
Gaming is another reason to separate expectations. Steam libraries, Proton prefixes and large game files can make snapshots grow quickly, especially when updates replace many files. Keep game libraries outside the snapshot scope where practical, and consult elementary OS gaming for platform-specific guidance. A snapshot should protect the operating system and configuration, not become a duplicate archive of every installed game.
Before using Btrfs as the only recovery mechanism, perform a trial. Create a disposable file, take a snapshot, modify the file and restore or copy it from the snapshot. Then boot the live USB, identify the Btrfs volume and confirm that you can mount it. The concrete next step is to create a full external backup, verify it opens, and only then create a read-only snapshot before the next system upgrade.