On Sat, Apr 17, 2021 at 4:03 PM Florian Franzeck <fmfranz...@gmail.com> wrote:
> Dear users,
> I need help to recover from a btrfs error after a power cut
> btrfs-progs v5.4.1
> Linux banana 5.4.0-72-generic #80-Ubuntu SMP Mon Apr 12 17:35:00 UTC
> 2021 x86_64 x86_64 x86_64 GNU/Linux
> dmesg output:
> [   30.330824] BTRFS info (device md1): disk space caching is enabled
> [   30.330826] BTRFS info (device md1): has skinny extents
> [   30.341269] BTRFS error (device md1): parent transid verify failed on
> 201818112 wanted 147946 found 147960
> [   30.342887] BTRFS error (device md1): parent transid verify failed on
> 201818112 wanted 147946 found 147960
> [   30.344154] BTRFS warning (device md1): failed to read root
> (objectid=4): -5
> [   30.375400] BTRFS error (device md1): open_ctree failed
> Please advise what to do next to recover data on this disk
> Thank a lot


This might be repairable with 'btrfs check --repair
--init-extent-tree' but it's really slow. It's almost always faster to
just mkfs and restore from backups. If you don't have current backups,
you shouldn't use this option first because there's a chance it makes
things worse and then it's harder to recover the data.

These are safer if you need to first update backups:

Try 'mount -o usebackuproot'

If that doesn't work, there is a very small chance 5.11 or newer will
allow you to mount the file system using 'mount -o
rescue=usebackuproot,ignorebadroots'  which is a lot easier to do
recovery on because you can use normal tools to update your backups.

Try btrfs restore:


This tool is quite dense with features to help isolate what you want
to recover. But the most simple command that tries to recover
everything that isn't a snapshot:

btrfs restore -vi -D /dev/ /path/to/save/files

It is also possible to use 'btrfs-find-root' and plug in the address
for roots (try most recent first, and then go older) into the 'btrfs
restore -t' option. Basically you're pointing it to an older root that
hopefully doesn't have damage. The older back you go though, the more
stale the trees are and they could have been overwritten. So you
pretty much have to try roots in order from most recent, one by one.

Might be easier to ask on irc.freenode.net, #btrfs.

Chris Murphy

Reply via email to