LinuxCommandLibrary

btrfs-filesystem

Manage btrfs filesystem properties and operations

TLDR

Show filesystem usage (optionally run as root to show detailed information)

$ btrfs filesystem usage [path/to/btrfs_mount]
copy

Show usage by individual devices
$ sudo btrfs filesystem show [path/to/btrfs_mount]
copy

Defragment a single file on a btrfs filesystem (avoid while a deduplication agent is running)
$ sudo btrfs filesystem defragment [[-v|--verbose]] [path/to/file]
copy

Defragment a directory recursively (does not cross subvolume boundaries)
$ sudo btrfs filesystem defragment [[-v|--verbose]] -r [path/to/directory]
copy

Force syncing unwritten data blocks to disk(s)
$ sudo btrfs filesystem sync [path/to/btrfs_mount]
copy

Summarize disk usage for the files in a directory recursively
$ sudo btrfs filesystem du [[-s|--summarize]] [path/to/directory]
copy

Create a swap file
$ sudo btrfs filesystem mkswapfile --size [8g] --uuid [clear|random|time|UUID_value] [path/to/swapfile]
copy

SYNOPSIS

btrfs filesystem []

PARAMETERS

mkfs
    Create a btrfs filesystem.

show
    Show btrfs filesystem information.

df
    Report btrfs filesystem disk space usage.

resize
    Resize a btrfs filesystem.

sync
    Sync a btrfs filesystem.

label
    Change the label of a btrfs filesystem.

tune
    Tune btrfs filesystem parameters.

uuid
    Show or set the UUID of a btrfs filesystem.

defragment
    Defragment files on a btrfs filesystem.

balance
    Balance data across devices.

scrub
    Scrub a btrfs filesystem for errors.

check
    Check and repair a btrfs filesystem.

DESCRIPTION

The btrfs-filesystem command provides tools for managing Btrfs filesystems.
It encompasses a wide range of operations, including filesystem creation, resizing, balancing, scrubbing, and checking. These commands are essential for maintaining the integrity and optimizing the performance of Btrfs filesystems. The utility is designed to be flexible and adaptable to various storage configurations, from single-disk setups to multi-disk RAID arrays.
It is a powerful command-line tool for system administrators to interact with Btrfs filesystems directly, enabling advanced features like snapshots, checksumming, and data deduplication. Understanding and utilizing these commands effectively are crucial for leveraging the full potential of Btrfs for reliable data storage and management.

EXAMPLES

Create a btrfs filesystem:
btrfs filesystem mkfs /dev/sdb1
Show btrfs filesystem information:
btrfs filesystem show /mnt/btrfs
Resize a btrfs filesystem:
btrfs filesystem resize max /mnt/btrfs

SEE ALSO

btrfs(8), mkfs.btrfs(8)

Copied to clipboard