linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Help recover from btrfs error
@ 2021-04-17 22:03 Florian Franzeck
  2021-04-19 21:28 ` Chris Murphy
  0 siblings, 1 reply; 2+ messages in thread
From: Florian Franzeck @ 2021-04-17 22:03 UTC (permalink / raw)
  To: linux-btrfs

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Help recover from btrfs error
  2021-04-17 22:03 Help recover from btrfs error Florian Franzeck
@ 2021-04-19 21:28 ` Chris Murphy
  0 siblings, 0 replies; 2+ messages in thread
From: Chris Murphy @ 2021-04-19 21:28 UTC (permalink / raw)
  To: Florian Franzeck; +Cc: Btrfs BTRFS

On Sat, Apr 17, 2021 at 4:03 PM Florian Franzeck <fmfranzeck@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
>

https://btrfs.wiki.kernel.org/index.php/Problem_FAQ#parent_transid_verify_failed

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:

https://btrfs.wiki.kernel.org/index.php/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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-04-19 21:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-17 22:03 Help recover from btrfs error Florian Franzeck
2021-04-19 21:28 ` Chris Murphy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).