Understand the alert
This alert is triggered when the percentage of used Btrfs data space exceeds the configured threshold. Btrfs (B-tree file system) is a modern copy-on-write (CoW) filesystem for Linux which focuses on fault tolerance, repair, and easy administration. This filesystem also provides advanced features like snapshots, checksums, and multi-device spanning.
What does high Btrfs data usage mean?
High Btrfs data usage indicates that a significant amount of the allocated space for data blocks in the filesystem is being used. This could be a result of many factors, such as large files, numerous smaller files, or multiple snapshots.
Troubleshoot the alert
Before you attempt any troubleshooting, make sure you have backed up your data to prevent potential data loss or corruption.
Add more physical space: You can add a new disk to the filesystem, depending on your infrastructure and disk RAID configuration. Remember to unmount the drive if it's already mounted, then use the
btrfs device addcommand to add the new disk and balance the system.Delete snapshots: Review the snapshots in your Btrfs filesystem and delete any unnecessary snapshots. Use the
btrfs subvolume listcommand to find snapshots andbtrfs subvolume deleteto remove them.Enable compression: By enabling compression, you can save disk space without deleting files or snapshots. Add the
compress=algmount option in yourfstabconfiguration file or during the mount procedure, wherealgis the compression algorithm you want to use (e.g.,zlib,lzo,zstd). You can apply compression to existing files using thebtrfs filesystem defragmentcommand.Enable deduplication: Implement deduplication to identify and merge blocks of data with common sequences using copy-on-write semantics. You can use third-party tools dedicated to Btrfs deduplication, such as duperemove, bees, and dduper. However, research their stability and reliability before employing them.
Perform a balance: If the data and metadata are unevenly allocated among disks, especially in Btrfs filesystems with multiple disks, you can perform a balance operation to reallocate space between data and metadata. Use the
btrfs balancecommand with appropriate usage parameters to start the balance process.