First, ensure you've got valid superblocks:
btrfs rescue super-recover -v <device>
btrfs find-root <device>
to find the best tree root to use in repair:
root nodeshould have the highest level
generation, the higher chance the fs can be recovered using that root.
Find the cleanest output from the following commands:
btrfs check --tree-root <block> --super <sup>
<sup>is either 0, 1 or 2.
<block>is is given by btrfs find-root (note: don't multiply by block size, even though the manual says <bytenr>)
Then repair the filesystem as follows:
btrfs check --repair --tree-root <block> --super <sup>
Note the addition of
--repair to actually change the filesystem.
BTRFS: is it possible to switch to another tree root?
I get my BTRFS partition damaged and mount -o usebackuproot ... does not...Super User