btrfs-device

Manage devices in a btrfs filesystem

TLDR

Add devices
$ sudo btrfs device add /dev/sdb /dev/sdc path/to/filesystem
Remove devices
$ sudo btrfs device remove /dev/sdb path/to/filesystem
Show error statistics
$ sudo btrfs device stats path/to/filesystem
Scan all disks
$ sudo btrfs device scan --all-devices
Show usage per device
$ sudo btrfs device usage path/to/filesystem

SYNOPSIS

btrfs device command [OPTIONS] [device|path]

DESCRIPTION

btrfs device manages devices in a btrfs filesystem. It can add or remove devices, display statistics, and scan for btrfs filesystems. This enables dynamic resizing and RAID configuration changes.

PARAMETERS

add

Add one or more devices to the filesystem
remove
Remove a device from the filesystem
delete
Alias for remove
stats
Show device error statistics
scan
Scan devices for btrfs filesystems
usage
Show detailed per-device allocation statistics
ready
Check if a device is ready
-d, --all-devices
Scan all devices for btrfs filesystems

INSTALL

sudo apt install btrfs-progs
sudo dnf install btrfs-progs
sudo pacman -S btrfs-progs
sudo apk add btrfs-progs
brew install btrfs-progs
nix profile install nixpkgs#btrfs-progs

CAVEATS

Removing a device requires enough space on remaining devices to hold relocated data. The filesystem must be mounted to add or remove devices. Adding devices does not automatically balance data.

HISTORY

btrfs device is part of the btrfs-progs package for managing btrfs filesystems on Linux.

SEE ALSO

btrfs(8), btrfs-balance(8), btrfs-filesystem(8)

RESOURCES

Source code · Documentation