How to fix unmountable BTRFS

(from https://superuser.com/a/1248201)

<hr>

First, ensure you've got valid superblocks:

btrfs rescue super-recover -v <device>

Use:

btrfs find-root <device>

to find the best tree root to use in repair:

  • The root node should have the highest level
  • The higher generation, the higher chance the fs can be recovered using that root.
  • Note: in your error message, wanted is the generation in the log, the found is the generation based on the tree root.

Find the cleanest output from the following commands:

btrfs check --tree-root <block> --super <sup>

Where:

  • <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

Jan 15, 2020, 17:25:25 GMT+7 1 replies