S
S
syxoi2017-01-07 16:20:02
linux
syxoi, 2017-01-07 16:20:02

How to restore btrfs with LVM and RAID0?

Hello!
One hard from the raid0 software array flew off, fortunately, I managed to dump it from the hard using ddrescue.
During operation, the system worked for some time, but due to a failed hard drive, could the system break the FS?
I restored the raid0 array, LVM volumes immediately loaded. But it didn't turn out to be that easy.
Previously, ZFS was also stored in the LVM physical volume, then I demolished it and added space to btrfs.
Now I dumped the LVM partition with btrfs (/dev/mapper/lvm-root).
Of course, it's impossible to mount even in ro:
mount lvm dir:
mount: unknown filesystem type 'zfs_member' It's not at all
clear where zfs came from?
Okay, let's try btrfs restore lvm dir:

parent transid verify failed on 341868544 wanted 66322 found 65220
parent transid verify failed on 341868544 wanted 66322 found 65220
parent transid verify failed on 341868544 wanted 66322 found 65220
parent transid verify failed on 341868544 wanted 66322 found 65220
Ignoring transid failure
Couldn't setup extent tree
Couldn't setup device tree
Could not open root, trying backup super
parent transid verify failed on 336117760 wanted 66320 found 66323
parent transid verify failed on 336117760 wanted 66320 found 66323
parent transid verify failed on 336117760 wanted 66320 found 66323
parent transid verify failed on 336117760 wanted 66320 found 66323
Ignoring transid failure
leaf parent key incorrect 336117760
Couldn't setup extent tree
parent transid verify failed on 336117760 wanted 66320 found 66323
Ignoring transid failure
leaf parent key incorrect 336117760
Couldn't setup device tree
Could not open root, trying backup super
Superblock bytenr is larger than device size
Could not open root, trying backup super

We try btrfs-find-root lvm:
parent transid verify failed on 341868544 wanted 66322 found 65220
parent transid verify failed on 341868544 wanted 66322 found 65220
parent transid verify failed on 341868544 wanted 66322 found 65220
parent transid verify failed on 341868544 wanted 66322 found 65220
Ignoring transid failure
Couldn't setup extent tree
Couldn't setup device tree
Superblock thinks the generation is 66322
Superblock thinks the level is 1
Well block 335085568(gen: 66323 level: 1) seems good, but generation/level doesn't match, want gen: 66322 level: 1
Well block 342491136(gen: 66322 level: 0) seems good, but generation/level doesn't match, want gen: 66322 level: 1
Well block 340180992(gen: 66321 level: 0) seems good, but generation/level doesn't match, want gen: 66322 level: 1
Well block 336003072(gen: 66320 level: 1) seems good, but generation/level doesn't match, want gen: 66322 level: 1
Well block 327778304(gen: 66319 level: 1) seems good, but generation/level doesn't match, want gen: 66322 level: 1
Well block 294731776(gen: 66303 level: 1) seems good, but generation/level doesn't match, want gen: 66322 level: 1
Well block 268271616(gen: 66302 level: 1) seems good, but generation/level doesn't match, want gen: 66322 level: 1
Well block 257458176(gen: 66300 level: 1) seems good, but generation/level doesn't match, want gen: 66322 level: 1
Well block 212287488(gen: 66280 level: 1) seems good, but generation/level doesn't match, want gen: 66322 level: 1
Well block 201048064(gen: 66275 level: 1) seems good, but generation/level doesn't match, want gen: 66322 level: 1
и куча бла-бла бла

so, try btrfs restore -t 335085568 lvm dir:
parent transid verify failed on 335085568 wanted 66322 found 66323
parent transid verify failed on 335085568 wanted 66322 found 66323
parent transid verify failed on 335085568 wanted 66322 found 66323
parent transid verify failed on 335085568 wanted 66322 found 66323
Ignoring transid failure
parent transid verify failed on 333627392 wanted 66323 found 66321
parent transid verify failed on 333627392 wanted 66323 found 66321
parent transid verify failed on 333627392 wanted 66323 found 66321
parent transid verify failed on 333627392 wanted 66323 found 66321
Ignoring transid failure
parent transid verify failed on 334643200 wanted 66323 found 66320
parent transid verify failed on 334643200 wanted 66323 found 66320
parent transid verify failed on 334643200 wanted 66323 found 66320
parent transid verify failed on 334643200 wanted 66323 found 66320
Ignoring transid failure
Error searching -1

and they send me to hell, but we try another block:
btrfs restore -t 27404550144 lvm dir
parent transid verify failed on 27404550144 wanted 66322 found 66204
parent transid verify failed on 27404550144 wanted 66322 found 66204
parent transid verify failed on 27404550144 wanted 66322 found 66204
parent transid verify failed on 27404550144 wanted 66322 found 66204
Ignoring transid failure
failed to inflate: -3
Error copying data for recu/home/su/.cache/opera/Cache/index-dir/the-real-index
Error searching recu/home/su/.cache/opera/Cache/index-dir/the-real-index
Error searching recu/home/su/.cache/opera/Cache/index-dir/the-real-index
Error searching recu/home/su/.cache/opera/Cache/index-dir/the-real-index
Error searching recu/home/su/.cache/opera/Cache/index-dir/the-real-index
Error searching recu/home/su/.cache/opera/Cache/index-dir/the-real-index
Error searching recu/home/su/.cache/opera/Cache/index-dir/the-real-index

Looks like something has been found! and wow!! he pulled out some files, but very few.
As I understand it, to take out all the files, you need to go through all these blocks.
Only there are a huge number of them, and I'm far from being a programmer and writing a script is a difficult task for me.
Tell me how to be?
Thank you!
:)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
syxoi, 2017-01-11
@syxoi

Generally!
Data recovery from btrfs is done like this:
1) We are looking for a block using btrfs-find-root, where there may be data. Let's look at it.
2) Using btrfs restore -it 27404550144 /dev/sda1 recu-dir we restore.
The -i (ignore errors) parameter is required, otherwise the process will stop on an error, which prevented me.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question