How to fix unmountable BTRFS

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

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 )

Then repair the filesystem as follows:

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

Note the addition of --repair to actually change the filesystem.

Sign in to participate in the conversation
CleverLibre Social

CleverLibre Social is an inclusive social instance for open discussion, learning, and community.
All cultures welcome.
Hate speech and harassment strictly forbidden.