Skip to contentSkip to conversation

btrfs recovery

DISCUSSION Sebastian Gottschall 3 participants 7 messages Jan 19, 2017 – Jan 24, 2017 Btrfs file system

lore
Share & tools
lore
#0 lore raw

Hello

I have a question. after a power outage my system was turning into a unrecoverable state using btrfs (kernel 4.9) since im running --init-extent-tree now for 3 days i'm asking how long this process normally takes and why it outputs millions of lines like

Backref 1562890240 root 262 owner 483059214 offset 0 num_refs 0 not found in extent tree Incorrect local backref count on 1562890240 root 262 owner 483059214 offset 0 found 1 wanted 0 back 0x23b0211d0 backpointer mismatch on [1562890240 4096]
adding new data backref on 1562890240 root 262 owner 483059214 offset 0 found 1
Repaired extent references for 1562890240

please avoid typical answers like "potential dangerous operation" since all repair options are declared as potenial dangerous.

Sebastian

Signature · 11 lines
Mit freundlichen Grüssen / Regards

Sebastian Gottschall / CTO

NewMedia-NET GmbH - DD-WRT
Firmensitz:  Berliner Ring 101, 64625 Bensheim
Registergericht: Amtsgericht Darmstadt, HRB 25473
Geschäftsführer: Peter Steinhäuser, Christian Scheele
http://www.dd-wrt.com
email: [email protected]
Tel.: +496251-582650 / Fax: +496251-5826565
#1 lore raw
Quoted 6 lines · Sebastian Gottschall

Hello

I have a question. after a power outage my system was turning into a unrecoverable state using btrfs (kernel 4.9)
since im running --init-extent-tree now for 3 days i'm asking how long this process normally takes and why it outputs millions of lines like

--init-extent-tree will trash *ALL* current extent tree, and *REBUILD* them from fs-tree.

This can takes a long time depending on the size of the fs, and how many shared extents there are (snapshots and reflinks all counts).

Such a huge operation should only be used if you're sure only extent tree is corrupted, and other tree are all OK.

Or you'll just totally screw your fs further, especially when interrupted.

Quoted 6 lines

Backref 1562890240 root 262 owner 483059214 offset 0 num_refs 0 not found in extent tree
Incorrect local backref count on 1562890240 root 262 owner 483059214 offset 0 found 1 wanted 0 back 0x23b0211d0
backpointer mismatch on [1562890240 4096]

This is common, since --init-extent-tree trash all extent tree, so every tree-block/data extent will trigger such output

Quoted 3 lines

adding new data backref on 1562890240 root 262 owner 483059214 offset 0 found 1
Repaired extent references for 1562890240

But as you see, it repaired the extent tree by adding back EXTENT_ITEM/METADATA_ITEM into extent tree, so far it works.

If you see such output with all the same bytenr, then things goes really wrong and maybe a dead loop.

Personally speaking, normal problem like failed to mount should not need --init-extent-tree.

Especially, extent-tree corruption normally is not really related to mount failure, but sudden remount to RO and kernel wanring.

Thanks,
Qu

Quoted 7 lines

please avoid typical answers like "potential dangerous operation" since all repair options are declared as potenial dangerous.

Sebastian

#5 lore raw
In reply to Sebastian Gottschall

Sebastian Gottschall posted on Thu, 19 Jan 2017 11:06:19 +0100 as excerpted:

Quoted 4 lines

I have a question. after a power outage my system was turning into a unrecoverable state using btrfs (kernel 4.9)
since im running --init-extent-tree now for 3 days i'm asking how long this process normally takes

QW has the better direct answer for you, but...

This is just a note to remind you, in general questions like "how long" can be better answered if we know the size of your filesystem, the mode (how many devices and what duplication mode for data and metadata) and something about how you use it -- how many subvolumes and snapshots you have, whether you have quotas enabled, etc.

Normally output from commands like btrfs fi usage can answer most of the filesystem size and mode stuff, but of course that command requires a mount, and you're doing an unmounted check ATM. However, btrfs fi show should still work and give us basic information like file size and number of devices, and you can fill in the blanks from there.

You did mention the kernel version (4.9) however, something that a lot of reports miss, and you're current, so kudos for that. =:^)

As to your question, assuming a terabyte scale filesystem, as QW suggested, a full extent tree rebuild is a big job and could indeed take awhile (days).

Quoted 1 line

From a practical perspective...

Given the state of btrfs as a still stabilizing and maturing filesystem, having backups for any data you value more than the time and hassle necessary to do the backup is even more a given than on a fully stable filesystem, which means, given the time for an extent tree rebuild on that size of a filesystem, unless you're doing the rebuild specifically to get the experience or test the code, as a practical matter it's probably simply easier to restore from that backup if you valued the data enough to have one, or simply scrap the filesystem and start over if you considered the data worth less than the time and hassle of a backup, and thus didn't have one.

Signature · 3 lines
Duncan - List replies preferred.   No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master."  Richard Stallman
#2 lore raw
In reply to Qu Wenruo

Am 20.01.2017 um 02:08 schrieb Qu Wenruo:

Quoted 10 lines
Quoted 6 lines · Sebastian Gottschall

Hello

I have a question. after a power outage my system was turning into a unrecoverable state using btrfs (kernel 4.9)
since im running --init-extent-tree now for 3 days i'm asking how long this process normally takes and why it outputs millions of lines like

Quoted 4 lines

--init-extent-tree will trash *ALL* current extent tree, and *REBUILD* them from fs-tree.

This can takes a long time depending on the size of the fs, and how many shared extents there are (snapshots and reflinks all counts).

its about 1,8 tb. so not a great size, but millions of files. its a build server

Quoted 2 lines

Such a huge operation should only be used if you're sure only extent tree is corrupted, and other tree are all OK.

since operations like zero-log doesnt help and scrub cancles after 5 seconds with error (can't remember the exact error right now) i'm sure there is something corrupt in it

Quoted 2 lines

Or you'll just totally screw your fs further, especially when interrupted.

running since 4 days now and for sure i wont interrupt it now at this state

Quoted 10 lines
Quoted 7 lines

Backref 1562890240 root 262 owner 483059214 offset 0 num_refs 0 not found in extent tree
Incorrect local backref count on 1562890240 root 262 owner 483059214 offset 0 found 1 wanted 0 back 0x23b0211d0
backpointer mismatch on [1562890240 4096]

This is common, since --init-extent-tree trash all extent tree, so every tree-block/data extent will trigger such output

Quoted 7 lines
Quoted 3 lines

adding new data backref on 1562890240 root 262 owner 483059214 offset 0 found 1
Repaired extent references for 1562890240

But as you see, it repaired the extent tree by adding back EXTENT_ITEM/METADATA_ITEM into extent tree, so far it works.

If you see such output with all the same bytenr, then things goes really wrong and maybe a dead loop.

they are all incremental. so looks okay then. i just dont know where the end is

Quoted 4 lines

Personally speaking, normal problem like failed to mount should not need --init-extent-tree.

Especially, extent-tree corruption normally is not really related to mount failure, but sudden remount to RO and kernel wanring.

initially i was able to mount the fs, but it turned to be ro only.

Quoted 14 lines

Thanks,
Qu

Quoted 7 lines

please avoid typical answers like "potential dangerous operation" since all repair options are declared as potenial dangerous.

Sebastian

Signature · 11 lines
Mit freundlichen Grüssen / Regards

Sebastian Gottschall / CTO

NewMedia-NET GmbH - DD-WRT
Firmensitz:  Berliner Ring 101, 64625 Bensheim
Registergericht: Amtsgericht Darmstadt, HRB 25473
Geschäftsführer: Peter Steinhäuser, Christian Scheele
http://www.dd-wrt.com
email: [email protected]
Tel.: +496251-582650 / Fax: +496251-5826565
#6 lore raw
In reply to Duncan

Am 20.01.2017 um 09:05 schrieb Duncan:

Quoted 7 lines

Sebastian Gottschall posted on Thu, 19 Jan 2017 11:06:19 +0100 as excerpted:

Quoted 4 lines

I have a question. after a power outage my system was turning into a unrecoverable state using btrfs (kernel 4.9)
since im running --init-extent-tree now for 3 days i'm asking how long this process normally takes

Quoted 7 lines

QW has the better direct answer for you, but...

This is just a note to remind you, in general questions like "how long" can be better answered if we know the size of your filesystem, the mode (how many devices and what duplication mode for data and metadata) and something about how you use it -- how many subvolumes and snapshots you have, whether you have quotas enabled, etc.

hard to give a answer right now since the fs is still in init-tree-extent. so i cannot get any details from it while running this process. it was a standard opensuse 42.1 installation with btrfs as rootfs. the size is about 1,8 tb. no soft raid. its a hardware raid6 system using a areca controller running all as single device

Quoted 7 lines

hr

Normally output from commands like btrfs fi usage can answer most of the filesystem size and mode stuff, but of course that command requires a mount, and you're doing an unmounted check ATM. However, btrfs fi show should still work and give us basic information like file size and number of devices, and you can fill in the blanks from there.

0:rescue:~ # btrfs.static fi show
Label: none uuid: 946b1a04-c321-4a24-bfb4-d6dcfa8b52dc
Total devices 1 FS bytes used 1.15TiB
devid 1 size 1.62TiB used 1.37TiB path /dev/sda3

Quoted 3 lines

You did mention the kernel version (4.9) however, something that a lot of reports miss, and you're current, so kudos for that. =:^)

i was reading other reports first, so i know whats expected :-)
beside this im a linux developer as well, so i know whats most important to know and most systems i run are almost up to date

Quoted 4 lines

As to your question, assuming a terabyte scale filesystem, as QW suggested, a full extent tree rebuild is a big job and could indeed take awhile (days).

4992 minutes now so, 3.4 days

Quoted 13 lines

From a practical perspective...

Given the state of btrfs as a still stabilizing and maturing filesystem, having backups for any data you value more than the time and hassle necessary to do the backup is even more a given than on a fully stable filesystem, which means, given the time for an extent tree rebuild on that size of a filesystem, unless you're doing the rebuild specifically to get the experience or test the code, as a practical matter it's probably simply easier to restore from that backup if you valued the data enough to have one, or simply scrap the filesystem and start over if you considered the data worth less than the time and hassle of a backup, and thus didn't have one.

i have a backup for sure for worst case, its just not always up to date. which means i might lost minor work of 6 -7 days maximum since i cannot mirror the whole filesystem every second sourcecodes in repository are safe for sure and there will be nothing lost,but will take always some time to get the backup back to the system, reinstalling OS, etc. my OS is not very vanilla. its all a little bit customized and not sure how i did it last time and would take some time to find the right path back. so its worth to try it without going the hard way

Quoted 1 line
Signature · 11 lines
Mit freundlichen Grüssen / Regards

Sebastian Gottschall / CTO

NewMedia-NET GmbH - DD-WRT
Firmensitz:  Berliner Ring 101, 64625 Bensheim
Registergericht: Amtsgericht Darmstadt, HRB 25473
Geschäftsführer: Peter Steinhäuser, Christian Scheele
http://www.dd-wrt.com
email: [email protected]
Tel.: +496251-582650 / Fax: +496251-5826565
#3 lore raw
In reply to Qu Wenruo

Hello again

by the way. the init-extent-tree is still running (now almost 7 days). is there any chance to find out how long it will take at the end?

Sebastian

Am 20.01.2017 um 02:08 schrieb Qu Wenruo:

Quoted 54 lines
Quoted 6 lines · Sebastian Gottschall

Hello

I have a question. after a power outage my system was turning into a unrecoverable state using btrfs (kernel 4.9)
since im running --init-extent-tree now for 3 days i'm asking how long this process normally takes and why it outputs millions of lines like

--init-extent-tree will trash *ALL* current extent tree, and *REBUILD* them from fs-tree.

This can takes a long time depending on the size of the fs, and how many shared extents there are (snapshots and reflinks all counts).

Such a huge operation should only be used if you're sure only extent tree is corrupted, and other tree are all OK.

Or you'll just totally screw your fs further, especially when interrupted.

Quoted 6 lines

Backref 1562890240 root 262 owner 483059214 offset 0 num_refs 0 not found in extent tree
Incorrect local backref count on 1562890240 root 262 owner 483059214 offset 0 found 1 wanted 0 back 0x23b0211d0
backpointer mismatch on [1562890240 4096]

This is common, since --init-extent-tree trash all extent tree, so every tree-block/data extent will trigger such output

Quoted 3 lines

adding new data backref on 1562890240 root 262 owner 483059214 offset 0 found 1
Repaired extent references for 1562890240

But as you see, it repaired the extent tree by adding back EXTENT_ITEM/METADATA_ITEM into extent tree, so far it works.

If you see such output with all the same bytenr, then things goes really wrong and maybe a dead loop.

Personally speaking, normal problem like failed to mount should not need --init-extent-tree.

Especially, extent-tree corruption normally is not really related to mount failure, but sudden remount to RO and kernel wanring.

Thanks,
Qu

Quoted 7 lines

please avoid typical answers like "potential dangerous operation" since all repair options are declared as potenial dangerous.

Sebastian

Signature · 11 lines
Mit freundlichen Grüssen / Regards

Sebastian Gottschall / CTO

NewMedia-NET GmbH - DD-WRT
Firmensitz:  Berliner Ring 101, 64625 Bensheim
Registergericht: Amtsgericht Darmstadt, HRB 25473
Geschäftsführer: Peter Steinhäuser, Christian Scheele
http://www.dd-wrt.com
email: [email protected]
Tel.: +496251-582650 / Fax: +496251-5826565
#4 lore raw
Quoted 6 lines · Sebastian Gottschall

Hello again

by the way. the init-extent-tree is still running (now almost 7 days). is there any chance to find out how long it will take at the end?

Sebastian

I think it may encounters a dead loop.

If its output doesn't loop(from a large scale), then you could try wait.

But at the point trying --init-extent-tree, your chance to recover your fs is quite low then. Sorry for that.

Thanks,
Qu

Quoted 66 lines

Am 20.01.2017 um 02:08 schrieb Qu Wenruo:

Quoted 62 lines
Quoted 6 lines · Sebastian Gottschall

Hello

I have a question. after a power outage my system was turning into a unrecoverable state using btrfs (kernel 4.9)
since im running --init-extent-tree now for 3 days i'm asking how long this process normally takes and why it outputs millions of lines like

--init-extent-tree will trash *ALL* current extent tree, and *REBUILD* them from fs-tree.

This can takes a long time depending on the size of the fs, and how many shared extents there are (snapshots and reflinks all counts).

Such a huge operation should only be used if you're sure only extent tree is corrupted, and other tree are all OK.

Or you'll just totally screw your fs further, especially when interrupted.

Quoted 6 lines

Backref 1562890240 root 262 owner 483059214 offset 0 num_refs 0 not found in extent tree
Incorrect local backref count on 1562890240 root 262 owner 483059214 offset 0 found 1 wanted 0 back 0x23b0211d0
backpointer mismatch on [1562890240 4096]

This is common, since --init-extent-tree trash all extent tree, so every tree-block/data extent will trigger such output

Quoted 3 lines

adding new data backref on 1562890240 root 262 owner 483059214 offset 0 found 1
Repaired extent references for 1562890240

But as you see, it repaired the extent tree by adding back EXTENT_ITEM/METADATA_ITEM into extent tree, so far it works.

If you see such output with all the same bytenr, then things goes really wrong and maybe a dead loop.

Personally speaking, normal problem like failed to mount should not need --init-extent-tree.

Especially, extent-tree corruption normally is not really related to mount failure, but sudden remount to RO and kernel wanring.

Thanks,
Qu

Quoted 7 lines

please avoid typical answers like "potential dangerous operation" since all repair options are declared as potenial dangerous.

Sebastian