Skip to content

Arch Linux BTRFS Guide

Mattscreative edited this page Dec 5, 2025 · 2 revisions

Arch Linux Btrfs Guide

Complete beginner-friendly guide to Btrfs on Arch Linux, including installation, subvolumes, snapshots, compression, and Btrfs management.


Table of Contents

  1. Understanding Btrfs
  2. Creating Btrfs
  3. Subvolumes
  4. Snapshots
  5. Compression
  6. Troubleshooting

Understanding Btrfs

What is Btrfs?

Btrfs is modern filesystem with advanced features.

Features:

  • Snapshots
  • Compression
  • Copy-on-write
  • Subvolumes
  • RAID support

Creating Btrfs

Format Btrfs

Create filesystem:

# Format as Btrfs
sudo mkfs.btrfs /dev/sda1

# With label
sudo mkfs.btrfs -L "MyData" /dev/sda1

Mount Btrfs

Mount:

# Mount
sudo mount /dev/sda1 /mnt/data

# With compression
sudo mount -o compress=zstd /dev/sda1 /mnt/data

Subvolumes

Create Subvolume

Create subvolume:

# Create subvolume
sudo btrfs subvolume create /mnt/data/subvol1

# List subvolumes
sudo btrfs subvolume list /mnt/data

# Delete subvolume
sudo btrfs subvolume delete /mnt/data/subvol1

Mount Subvolume

Mount subvolume:

# Mount subvolume
sudo mount -o subvol=subvol1 /dev/sda1 /mnt/subvol1

Snapshots

Create Snapshot

Create snapshot:

# Create snapshot
sudo btrfs subvolume snapshot /mnt/data /mnt/data/snapshot-$(date +%Y%m%d)

# List snapshots
sudo btrfs subvolume list /mnt/data

Restore Snapshot

Restore:

# Delete corrupted subvolume
sudo btrfs subvolume delete /mnt/data/corrupted

# Restore from snapshot
sudo btrfs subvolume snapshot /mnt/data/snapshot-20240115 /mnt/data/restored

Compression

Enable Compression

Set compression:

# Mount with compression
sudo mount -o compress=zstd /dev/sda1 /mnt/data

# Or in fstab
UUID=xxxx-xxxx /mnt/data btrfs defaults,compress=zstd 0 2

Compression Levels

Compression options:

  • zlib: Good compression
  • lzo: Fast compression
  • zstd: Balanced (recommended)

Troubleshooting

Btrfs Errors

Check filesystem:

# Check Btrfs
sudo btrfs check /dev/sda1

# Scrub
sudo btrfs scrub start /mnt/data

Balance Filesystem

Balance:

# Balance filesystem
sudo btrfs balance start /mnt/data

# Check usage
sudo btrfs filesystem usage /mnt/data

Summary

This guide covered Btrfs creation, subvolumes, snapshots, compression, and troubleshooting.


Next Steps


This guide is based on the ArchWiki. For the most up-to-date information, always refer to the official ArchWiki.

Clone this wiki locally