btrfs-device
Manage Btrfs devices (add, delete, scan)
TLDR
Add one or more devices to a btrfs filesystem
Remove a device from a btrfs filesystem
Display error statistics
Scan all disks and inform the kernel of all detected btrfs filesystems
Display detailed per-disk allocation statistics
SYNOPSIS
btrfs device
PARAMETERS
add
Add one or more devices to the filesystem.
delete
Remove one or more devices from the filesystem.
ready
Mark one or more devices as ready after they have been added to the filesystem but were temporarily unavailable.
scan
Scan all block devices and try to register them into the btrfs filesystem.
usage [
Show usage information for each device in the filesystem. If
stats
Show I/O error statistics per device.
global stats [
Show global I/O error statistics across all devices. If
show [
Show detailed information about the devices in the filesystem. If
balance
Perform a balance operation to redistribute data and metadata across all devices.
DESCRIPTION
The `btrfs device` command family in Linux provides tools for managing devices that are part of a Btrfs filesystem. Btrfs is a modern copy-on-write filesystem designed for advanced features such as snapshots, checksumming, and pooling multiple physical devices into a single logical filesystem. This command family facilitates adding, removing, showing, and even balancing data across devices. This is critical for maintaining the integrity, performance, and capacity of a Btrfs filesystem.
These operations often require careful consideration, especially when removing or replacing devices, as data loss can occur if not performed correctly. Balancing data can redistribute data across the remaining devices which might take a long time depending on the overall size.
It's crucial to understand the implications of each subcommand and to back up data before performing any potentially destructive actions.
CAVEATS
Removing a device without sufficient space on the remaining devices can lead to data loss. Always check device space before removing. Consider using `btrfs filesystem df` before removing devices.
DEVICE IDS
Devices are identified by their UUID, path, or device ID. The device ID is an internal identifier assigned by the filesystem.
BALANCING
Balancing can take a very long time. Use the `-d` and `-m` options of `btrfs balance` to fine-tune which data and metadata should be balanced.
HISTORY
Btrfs was designed to address limitations in older Linux filesystems. `btrfs device` commands have evolved alongside Btrfs itself, with new features and improvements added over time to enhance device management capabilities. Initial commit happened at 2007, and first stable kernel happened at 2014. It has been used to create large and robust file systems since then.
SEE ALSO
btrfs(8), btrfs-filesystem(8), btrfs-check(8), mkfs.btrfs(8)