btrfs: how to calculate btrfs compression space savings?
In Debian/Ubuntu:
apt install btrfs-compsize
compsize /mnt/btrfs-partition
In Fedora:
dnf install compsize
compsize /mnt/btrfs-partition
output is like this:
Processed 123574 files, 1399139 regular extents (1399139 refs), 69614 inline.
Type Perc Disk Usage Uncompressed Referenced
TOTAL 73% 211G 289G 289G
none 100% 174G 174G 174G
lzo 32% 37G 115G 115G
Per the btrfs wiki, there's no built-in support for this, but the compsize tool can measure compression on btrfs.
The df
output will be similar to btrfs fi df
in that it will report how much disk space is used, not the uncompressed size. The wiki says you can "kind of guess" by comparing df
output before and after compressing a file. Another option is using some program that will total up the actual data such as rsync --stats
on a dry run, which will report how much data is read.