btrfs
Manage Btrfs filesystems
TLDR
Create subvolume
List subvolumes
Show space usage information
Enable quota
Show quota
SYNOPSIS
The btrfs command operates via subcommands, each with its own options and arguments.
btrfs <subcommand> [options] [arguments]
Example subcommands include: filesystem, subvolume, device, scrub, balance, qgroup, send, receive.
PARAMETERS
filesystem
Manage Btrfs filesystems (e.g., resize, get usage information, label).
subvolume
Create, delete, list, or take snapshots of Btrfs subvolumes.
device
Add, remove, or manage devices within a Btrfs filesystem.
scrub
Scan the filesystem for integrity errors and repair them.
balance
Rebalance data chunks across devices, useful for freeing space or changing RAID levels.
qgroup
Manage quota groups for Btrfs subvolumes.
send/receive
Perform incremental filesystem transfers between Btrfs filesystems (e.g., for backup or replication).
DESCRIPTION
The btrfs command is the primary command-line utility for managing Btrfs (B-tree File System) filesystems on Linux. Btrfs is a modern copy-on-write (CoW) filesystem designed for advanced features like snapshots, subvolumes, integrated RAID, checksums, compression, and online resizing. The btrfs command allows administrators to perform a wide array of operations, including creating, mounting, and unmounting filesystems, adding and removing devices, managing subvolumes and snapshots, performing data balancing and scrubbing, and configuring quota groups. Its modular design means that various functionalities are grouped under subcommands, making it a comprehensive tool for robust and flexible storage management. It aims to address limitations of traditional filesystems by offering resilience, scalability, and advanced data management features.
CAVEATS
While widely used, Btrfs is still under active development, and some features may be considered experimental or less stable than others. It can be complex to manage, and improper use of certain commands (e.g., device delete or replace without proper understanding) can lead to data loss. Performance can sometimes be an issue on specific workloads, especially with heavy fragmentation or certain compression settings. Always ensure you are running a recent kernel version for the best stability and features.
SUBVOLUMES
Subvolumes in Btrfs are not separate block devices but are distinct, independently mountable filesystems within a single Btrfs volume. They can be nested, and form the basis for snapshots, allowing flexible directory management and isolation.
SNAPSHOTS
Btrfs snapshots are point-in-time, copy-on-write images of a subvolume. They are very efficient as they only store changes from the original, making backups and rollbacks extremely fast and space-efficient. Snapshots can be writable or read-only.
INTEGRATED RAID
Btrfs has built-in RAID capabilities (RAID0, RAID1, RAID10, RAID5, RAID6) directly within the filesystem, managing data and metadata redundancy across multiple devices. This allows for dynamic resizing and device replacement without unmounting.
HISTORY
Development of Btrfs began at Oracle in 2007, with a primary goal of providing advanced features comparable to ZFS. It was initially designed by Chris Mason. Btrfs was merged into the Linux kernel mainline in 2009 (kernel version 2.6.29). Since then, it has seen continuous development and adoption, becoming a default filesystem option for several Linux distributions, including Fedora and openSUSE. Its design introduced a new paradigm for filesystem management in Linux, moving towards a more integrated and feature-rich approach.