How to: enable metadata duplication on an existing btrfs filesystem
30th December 2016
Just one command: sudo btrfs balance start -v -mconvert=dup /toplevel/
where /toplevel/
is your mountpoint of the btrfs root, -v
is there for verbosity (not too verbose, don’t worry), and -mconvert=dup
literally says act on metadata only, convert data profile to DUP.
This will duplicate both metadata and btrfs system data.
Verify with: sudo btrfs fi df /toplevel
:
Data, single: total=10.00GiB, used=3.88GiB
System, DUP: total=64.00MiB, used=4.00KiB
Metadata, DUP: total=512.00MiB, used=286.18MiB
GlobalReserve, single: total=96.00MiB, used=0.00B
Explanation: on SSDs, mkfs.btrfs creates metadata in single mode (because of widely spread SSD deduplication algorithms negating duplicate entries). However, second copy of metadata increases recovery chances, especially so if your SSD does not deduplicate writes. Hence the desire to add metadata/systemdata duplication after the filesystem is created.