r/btrfs•
halfgoogle

How long does it usually take to rebuild the extent tree?

Hey, r/btrfs

Recently ran into some trouble, being unable to mount my btrfs drives. (2 4TB in I think it was single mode, the one where data is split across the drives in 1 gigabyte chunks)

​

Read on a forum that running `btrfs check --init-extent-tree` should do the trick to fix it.

(It seems like my drive was powered off before a transaction completed)

​

Anyways, I was just wondering how long it normally takes to rebuild the extent tree -- currently I'm on day 4 of the command running...

​

Surely, there must have been a better command to run, but I guess I didn't read the wiki enough..

​

As for the data on there, I'm luckily not too concerned about it,

just more interested in learning the proper way to deal with failure should something like this happen again in the future

​

Thanks

Posted Aug 18, 2020, 4:33 AM UTC

45
Deathcrow•

Read on a forum that running btrfs check --init-extent-tree should do the trick to fix it.

Some excerpts from the man page of btrfs check:

      Warning
       Do not use --repair unless you are advised to do so by a developer or an experienced user, and then only after having accepted that no fsck successfully repair all types of filesystem corruption. Eg. some other software or
       hardware bugs can fatally damage a volume.

...

there’s a warning and 10 second delay when this option is run without --force to give users a chance to think twice before running repair, the warnings in documentation have shown to be insufficient

...

  --init-extent-tree
       build the extent tree from scratch
          Note
           Do not use unless you know what you’re doing.

Why are you doing this without seeking advice beforehand? Your fs is probably toast. (to be fair, I also had to learn this lesson the hard way by blasting a btrfs from read only mountable to completely gone with btrfs check --repair)

4
th1snda7•

Not really, rebuilding the extent tree shouldn't cause data loss, and he didn't mention running --repair anywhere.

2
th1snda7•

Rebuilding the extent tree only helps in very specific cases, I'm not sure it will help you. Also, the extent tree is not strictly necessary to mount the filesystem as read-only, so you can skip it if it is corrupted with one of the rescue= options in modern kernels, but I unfortunately don't quite remember which one.

Nonetheless, it does take quite a while, there were reports of it taking weeks for some people on the mailing list.

3
rubyrt•

And, is it still running?

1
halfgoogleOP•

I figured it would be quicker to format the drive, and re-populate it with data, so that is the route I went.

2