2021-02-03 11:48:27 +00:00
|
|
|
# btrfs device
|
|
|
|
|
|
|
|
> Manage devices in a btrfs filesystem.
|
2022-11-15 11:50:15 +00:00
|
|
|
> More information: <https://btrfs.readthedocs.io/en/latest/btrfs-device.html>.
|
2021-02-03 11:48:27 +00:00
|
|
|
|
|
|
|
- Add one or more devices to a btrfs filesystem:
|
|
|
|
|
2025-07-20 01:28:02 +03:00
|
|
|
`sudo btrfs {{[d|device]}} {{[a|add]}} {{path/to/block_device1 path/to/block_device2 ...}} {{path/to/btrfs_filesystem}}`
|
2021-02-03 11:48:27 +00:00
|
|
|
|
|
|
|
- Remove a device from a btrfs filesystem:
|
|
|
|
|
2025-07-20 01:28:02 +03:00
|
|
|
`sudo btrfs {{[d|device]}} {{[rem|remove]}} {{path/to/device1|device_id1 path/to/device2|device_id2 ...}}`
|
2021-02-03 11:48:27 +00:00
|
|
|
|
|
|
|
- Display error statistics:
|
|
|
|
|
2025-07-20 01:28:02 +03:00
|
|
|
`sudo btrfs {{[d|device]}} {{[st|stats]}} {{path/to/btrfs_filesystem}}`
|
2021-02-03 11:48:27 +00:00
|
|
|
|
|
|
|
- Scan all disks and inform the kernel of all detected btrfs filesystems:
|
|
|
|
|
2025-07-20 01:28:02 +03:00
|
|
|
`sudo btrfs {{[d|device]}} {{[sc|scan]}} {{[-d|--all-devices]}}`
|
2021-02-03 11:48:27 +00:00
|
|
|
|
|
|
|
- Display detailed per-disk allocation statistics:
|
|
|
|
|
2025-07-20 01:28:02 +03:00
|
|
|
`sudo btrfs {{[d|device]}} {{[u|usage]}} {{path/to/btrfs_filesystem}}`
|