You are not logged in.

#1 2018-12-08 12:44:02

gug9sch
Member
Registered: 2018-12-08
Posts: 1

Rescue btrfs root fs after hard shutdown

Hi everyone,

I'm not sure where to post this, so sorry if it's in the wrong section.

After my laptop went out of battery and the laptop switched off, my root fs is not mountable anymore.
I use a btrfs for the system with a luks encryption below.

The luks layer seems to be ok, as I can open it without any issues.

After booting into the LiveUSB system, I try the following:

'cryptsetup open --type luks /dev/nvme0n1p2 cryptroot'
'mount -t btrfs -o recovery,ssd,compress=lzo /dev/mapper/cryptroot /mnt/sys'

mount: /mnt/sys: wrong fs type, bad option, bad superblock on /dev/mapper/cryptroot, missing codepage or helper program, or other error.

'dmesg' returns:

[  700.781173] BTRFS warning (device dm-0): 'recovery' is deprecated, use 'usebackuproot' instead
[  700.781177] BTRFS info (device dm-0): trying to use backup root at mount time
[  700.781183] BTRFS info (device dm-0): enabling ssd optimizations
[  700.781189] BTRFS info (device dm-0): use lzo compression, level 0
[  700.781191] BTRFS info (device dm-0): disk space caching is enabled
[  700.781194] BTRFS info (device dm-0): has skinny extents
[  700.788032] BTRFS error (device dm-0): parent transid verify failed on 23773184 wanted 43323 found 45381
[  700.788124] BTRFS warning (device dm-0): failed to read root (objectid=4): -5
[  700.788453] BTRFS error (device dm-0): parent transid verify failed on 23773184 wanted 43323 found 45381
[  700.791280] BTRFS warning (device dm-0): failed to read root (objectid=4): -5
[  700.792913] BTRFS error (device dm-0): parent transid verify failed on 23773184 wanted 43323 found 45381
[  700.795402] BTRFS warning (device dm-0): failed to read root (objectid=4): -5
[  700.796891] BTRFS error (device dm-0): parent transid verify failed on 23773184 wanted 43323 found 45381
[  700.799348] BTRFS warning (device dm-0): failed to read root (objectid=4): -5
[  700.800851] BTRFS error (device dm-0): parent transid verify failed on 23773184 wanted 43323 found 45381
[  700.803280] BTRFS warning (device dm-0): failed to read root (objectid=4): -5
[  700.829419] BTRFS error (device dm-0): open_ctree failed

'btrfs check /dev/mapper/cryptroot' prints:

parent transid verify failed on 23773184 wanted 43323 found 45381
parent transid verify failed on 23773184 wanted 43323 found 45381
Ignoring transid failure
[1/7] checking root items
[2/7] checking extents
Chunk[256, 228, 1048576] stripe[1, 1048576] is not found in dev extent
... 
...  ~ 500 similar lines
... 
Chunk[256, 228, 557294026752] stripe[1, 499311968256] is not found in dev extent
owner ref check failed [23773184 16384]
ref mismatch on [23805952 16384] extent item 1, found 0
backref 23805952 root 4 not referenced back 0x55d8debb5f60
incorrect global backref count on 23805952 found 1 wanted 0
backpointer mismatch on [23805952 16384]
owner ref check failed [23805952 16384]
ref mismatch on [44125224960 16384] extent item 1, found 0
backref 44125224960 root 4 not referenced back 0x55d8ddcc35a0
incorrect global backref count on 44125224960 found 1 wanted 0
backpointer mismatch on [44125224960 16384]
owner ref check failed [44125224960 16384]
ref mismatch on [454268846080 16384] extent item 1, found 0
backref 454268846080 root 4 not referenced back 0x55d8d8347070
incorrect global backref count on 454268846080 found 1 wanted 0
backpointer mismatch on [454268846080 16384]
owner ref check failed [454268846080 16384]
ERROR: errors found in extent allocation tree or chunk allocation
[3/7] checking free space cache
[4/7] checking fs roots
[5/7] checking only csums items (without verifying data)
[6/7] checking root refs
[7/7] checking quota groups skipped (not enabled on this FS)
ERROR: transid errors in file system
Opening filesystem to check...
Checking filesystem on /dev/mapper/cryptroot
UUID: 4de4742a-fb24-441d-a27c-286818f50584
found 491272515584 bytes used, error(s) found
total csum bytes: 475302656
total tree bytes: 2986147840
total fs tree bytes: 2303967232
total extent tree bytes: 145833984
btree space waste bytes: 416351691
file data blocks allocated: 704560472064
 referenced 613534547968

I tried 'btrfs rescue zero-log /dev/mapper/cryptroot'

parent transid verify failed on 23773184 wanted 43323 found 45381
parent transid verify failed on 23773184 wanted 43323 found 45381
Ignoring transid failure
Clearing log on /dev/mapper/cryptroot, previous log_root 0, level 0

and 'btrfs check --repair /dev/mapper/cryptroot' which fails with a core dump

parent transid verify failed on 23773184 wanted 43323 found 45381
parent transid verify failed on 23773184 wanted 43323 found 45381
Ignoring transid failure
[1/7] checking root items
Fixed 0 roots.
[2/7] checking extents
Chunk[256, 228, 1048576] stripe[1, 1048576] is not found in dev extent
...
... ~ 500 similar lines
...
Chunk[256, 228, 557294026752] stripe[1, 499311968256] is not found in dev extent
owner ref check failed [23773184 16384]
repair deleting extent record: key [23773184,169,1]
adding new tree backref on start 23773184 len 16384 parent 0 root 4
Repaired extent references for 23773184
ref mismatch on [23805952 16384] extent item 1, found 0
backref 23805952 root 4 not referenced back 0x55794af21f60
incorrect global backref count on 23805952 found 1 wanted 0
backpointer mismatch on [23805952 16384]
owner ref check failed [23805952 16384]
repair deleting extent record: key [23805952,169,0]
Repaired extent references for 23805952
ref mismatch on [44125224960 16384] extent item 1, found 0
backref 44125224960 root 4 not referenced back 0x55794a02f5a0
incorrect global backref count on 44125224960 found 1 wanted 0
backpointer mismatch on [44125224960 16384]
owner ref check failed [44125224960 16384]
repair deleting extent record: key [44125224960,169,0]
Repaired extent references for 44125224960
ref mismatch on [454268846080 16384] extent item 1, found 0
backref 454268846080 root 4 not referenced back 0x557944543240
incorrect global backref count on 454268846080 found 1 wanted 0
backpointer mismatch on [454268846080 16384]
owner ref check failed [454268846080 16384]
repair deleting extent record: key [454268846080,169,0]
Repaired extent references for 454268846080
btrfs unable to find ref byte nr 517566136320 parent 0 root 2  owner 0 offset 0
transaction.c:195: btrfs_commit_transaction: BUG_ON `ret` triggered, value -5
btrfs(+0x46c37)[0x55793a4f5c37]
btrfs(btrfs_commit_transaction+0x1be)[0x55793a4f625e]
btrfs(+0x66bd5)[0x55793a515bd5]
btrfs(cmd_check+0x1384)[0x55793a518e04]
btrfs(main+0x88)[0x55793a4c20b8]
/usr/lib/libc.so.6(__libc_start_main+0xf3)[0x7f6779bec223]
btrfs(_start+0x2e)[0x55793a4c21de]

Do you have any suggestions what I could try or do you need any further information to restore the data?

Looking forward to your help.

Best,
gug9sch

P.S.: I backed up the whole decrypted drive, so I can revert to the state directly after the crash.

Offline

#2 2018-12-09 21:22:46

Bevan
Member
Registered: 2009-09-08
Posts: 99

Re: Rescue btrfs root fs after hard shutdown

Hi,

I can only suggest to post on the linux-btrfs mailing list. The developers often help in cases like this and they know best if there is a way to restore the data or if all hope is lost.

gug9sch wrote:

P.S.: I backed up the whole decrypted drive, so I can revert to the state directly after the crash.

That's good as running btrfs check --repair seems often to do more harm than good and should only be done when told to on the mailing list. However, the BUG you experience during btrfs check may be interesting for the developers as well.

Good luck!

Offline

#3 2018-12-10 07:39:26

ugjka
Member
From: Latvia
Registered: 2014-04-01
Posts: 1,794
Website

Re: Rescue btrfs root fs after hard shutdown

if you made backup, you can try

btrfsck --repair --init-extent-tree
btrfsch --repair --init-csum-tree


https://ugjka.net
paru > yay | webcord > discord
pacman -S spotify-launcher
mount /dev/disk/by-...

Offline

#4 2019-03-31 11:04:02

gyurman
Member
From: Budapest/Hungary
Registered: 2011-03-22
Posts: 65

Re: Rescue btrfs root fs after hard shutdown

Not helped. I have same with.
btrfs rescue chunk-recover -v -y
also not helped.
But I have other partition with btrfs, chunk-recover helped.

I think this is btrfs is to clumsy. Need to much time for deal with it. Check, scrub and defrag. I dont want clever, bu clumsy file system. If I not deal with it enough time, someday after partition is become read only.


ugjka wrote:

if you made backup, you can try

btrfsck --repair --init-extent-tree
btrfsch --repair --init-csum-tree

Last edited by gyurman (2019-03-31 11:05:21)

Offline

#5 2019-03-31 11:08:25

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,787
Website

Re: Rescue btrfs root fs after hard shutdown


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

Board footer

Powered by FluxBB