Use this when using Btrfs subvolumes, snapshots, compression or RAID on Linux.
Btrfs · Linux Storage
Btrfs is a copy-on-write Linux file system with checksums, subvolumes, snapshots, compression and built-in RAID 1/10. RAID 5/6 is still not recommended for production use.
1. Btrfs: COW, snapshots, subvolumes, checksums, compression.
2. Use RAID1/10, not 5/6 for important data.
3. Watch metadata space.
4. Scrub and balance.
5. Snapper for snapshots.
files → Btrfs → devices
Context & applicabilityCommon mistakes · platform/version boundaries
- RAID 5/6 profiles for data — still not recommended due to write-hole issues.
- Running out of metadata space while
dfshows free space — checkbtrfs filesystem usageand balance. - Running
btrfs check --repairwithout backups. - Copy-on-write fragmentation for VM images and databases — use
chattr +Con empty directories.
Operational reference
Fast context before you go deeper.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- Btrfs RAID 5/6 is not recommended for production.
- Free space can run out in metadata before data.
- Snapshots are cheap but keep old data alive.
btrfs filesystem show— devicesbtrfs filesystem usage <mount>— allocationbtrfs device stats <mount>— errors
ReferenceImportant terms & boundaries1 section · depth on demand
In depth
Btrfs on Linux: default root filesystem on openSUSE and Fedora Workstation, with subvolumes used for snapshot-based rollback (snapper).
btrfs subvolume list /
snapper list
snapper rollback 42
btrfs device add /dev/sdc /data; btrfs balance start -dconvert=raid1 -mconvert=raid1 /data
btrfs device stats /data # per-device error counters
Keep 10–20 % free, schedule monthly scrubs, and watch btrfs device stats — non-zero corruption counters mean a disk or cabling problem.
ReferenceConfiguration & state1 section · depth on demand
Commands
mkfs.btrfs -L data /dev/sdb /dev/sdc -d raid1 -m raid1
btrfs subvolume create /data/projects
btrfs subvolume snapshot -r /data/projects /data/.snap/projects-$(date +%F)
btrfs filesystem usage /data
btrfs scrub start /data ; btrfs scrub status /data
btrfs balance start -dusage=50 /data
Documented example, not captured output. Avoid RAID5/6 for metadata in production; watch "unallocated" space (filesystem usage) — Btrfs can report free space but fail to allocate metadata. Default on openSUSE and Fedora desktops.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Linux Storage → Btrfs. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://docs.kernel.org/block/index.html · confidence 94%