Btrfs - Helpful commands
Useful commands for the Btrfs file system
Quick collection of useful commands for maintaining a Btrfs filesystem.
Btrfs allows for easy management of software raids in RAID0, RAID1, and RAID10. RAID5 and RAID6 are implemented but not suggested for use.
Btrfs device statistics
The Btrfs device commands are used to check the status of the device, such as read / write errors and disk usage. See the current statistic.
sudo btrfs device stats /path/to/fs
To see the current usage.
sudo btrfs device usage /path/to/fs
btrfs scrub
btrfs scrub is used to scrub a Btrfs filesystem, which will read all data and metadata blocks from all devices and verify checksums. Automatically repair corrupted blocks if there’s a correct copy available.
sudo btrfs scrub start /path/to/fs/
To see the status of an ongoing (or last run) balance use
sudo btrfs scrub status /path/to/fs/
btrfs balance
The primary purpose of the balance feature is to spread block groups across all devices so they match constraints defined by the respective profiles. See mkfs.btrfs(8) section PROFILES for more details. The scope of the balancing process can be further tuned by the use of filters that can select the block groups to process. Balance works only on a mounted filesystem.
sudo btrfs balance start /path/to/fs/
To see the status of an ongoing (or last run) balance use
sudo btrfs balance status /path/to/fs/