Announcement

Collapse
No announcement yet.

[SOLVED] - BTRFS - unable to access data - "Couldn't read tree root" Error.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [SOLVED] - BTRFS - unable to access data - "Couldn't read tree root" Error.

    Hello, Dear Btrfs Friends - nice to meet you!

    I use btrfs for the first time and I do it because of the de-duplication feature which I was going to have
    However before I could even give it a try... today I cannot access my important data anymore and I need your help to solve the problem, please!
    I wouldn't like to abandon using btrfs and I hope there's a way to get back my data, with your Great Help!

    I googled and executed the below commands but even if the "chunk-recover" says that "chunk tree recovered successfully", I still cannot mount the btfrs store...

    1). $ sudo btrfs check /dev/md0
    Opening filesystem to check...
    checksum verify failed on 7653130240 found 000000B6 wanted 00000000
    checksum verify failed on 7653130240 found 000000B6 wanted 00000000
    bad tree block 7653130240, bytenr mismatch, want=7653130240, have=0
    Couldn't read tree root
    ERROR: cannot open file system

    2). $ sudo btrfs rescue chunk-recover /dev/md0
    Scanning: DONE in dev0
    Check chunks successfully with no orphans
    Chunk tree recovered successfully

    ​3). $ sudo mount /dev/md0 /mnt/.MD0
    mount: /mnt/.MD0: wrong fs type, bad option, bad superblock on /dev/md0, missing codepage or helper program, or other error.​

    4). Gparted is showing that my data is physically present:
    https://drive.google.com/file/d/1e6J...gTA/view?pli=1

    Thanks in advance and kind regards~~Piotrek~~pe3no
    Last edited by pe3no; Sep 20, 2023, 06:03 AM. Reason: Typo/s correction/s

    #2
    So you put btrfs on top of mdadm? IMO, not a good idea and totally not necessary. BTRFS handles multiple devices natively without mdadm or lvm needed at all. Basically, you've added a layer of complication and potential failure to no benefit.

    I assume you have a backup of your "important" data.

    I have no ideas at all about how to help. After doing the rescue does btrfs check run without error?

    Try sudo mount -t btrfs /dev/md0 /mnt/,MD0 then look out the output of dmesg and see what it spits out.

    Seems likely you'll need to wipe and restore your backup. If you do, don't use btrfs on top of mdadm.
    Last edited by Snowhog; Sep 20, 2023, 11:04 AM. Reason: Emphasize the DON'T

    Please Read Me

    Comment


      #3
      Dear oshunluvr thank you very much for your message

      I understand the importance of backups and I'm in progress with it but... my backup drive arrival is delayed by more than one week so I was not able to backup all my data to pendrive...
      I hope that there are chances to get back my really important data... the gparted is showing that my data is present (as I shown) and the "Chunk tree recovered successfully" sounds promissing... ?
      Well, I did the mdadm using the enterprise MZ7KH480HAHQ-00005​ drives to avoid the risky hardware and I didn't know that it's a bad idea to put btrfs on it... Now I know it ...
      I did what you suggested. Could you have a look, please?

      $ sudo mount -t btrfs /dev/md0 /mnt/.MD0
      mount: /mnt/.MD0: wrong fs type, bad option, bad superblock on /dev/md0, missing codepage or helper program, or other error.​

      $ dmesg
      [28316.034123] BTRFS info (device md0): flagging fs with big metadata feature
      [28316.034126] BTRFS info (device md0): disk space caching is enabled
      [28316.034127] BTRFS info (device md0): has skinny extents
      [28316.036914] BTRFS error (device md0): bad tree block start, want 7653130240 have 0
      [28316.036922] BTRFS warning (device md0): failed to read tree root
      [28316.091038] BTRFS error (device md0): open_ctree failed

      Thank you in advance for additional help and kind regards~~Piotrek~~pe3no

      Comment


        #4
        Start here: https://forum.rockstor.com/t/btrfs-e...k-start/5569/3

        good luck

        Please Read Me

        Comment


          #5
          Dear oshunluvr thank you very much for your additional Great Advice ​​

          Based on the article you mentioned I did the following:

          5). I skipped what they called as the "least recommended", i.e.: I did not zero out the BTRFS transaction log:
          [NOT DONE]: btrfs zero-log /dev/<btrfs-device>

          6). I tried but I couldn't mount the partition in recovery mode, in order to copy the contents elsewhere.
          $ sudo mount -t btrfs -o rootflags=recovery,nospace_cache /dev/md0 /mnt/md0
          [FAILED] wrong fs type, bad option, bad superblock on /dev/md0, missing codepage or helper program, or other error.

          7). Their second suggestion to mount and recover with clearing cache was not successful either...
          $ sudo mount -t btrfs -o rootflags=recovery,nospace_cache,clear_cache /dev/md0 /mnt/md0
          [FAILED] mount: /mnt/md0: wrong fs type, bad option, bad superblock on /dev/md0, missing codepage or helper program, or other error.​

          8). The fourth tip to dump the filesystem to another location, using "restore" command failed too...
          $ sudo btrfs restore /dev/md0 /tmp/md0
          [FAILED] checksum verify failed on 7653130240 found 000000B6 wanted 00000000
          checksum verify failed on 7653130240 found 000000B6 wanted 00000000
          bad tree block 7653130240, bytenr mismatch, want=7653130240, have=0
          Couldn't read tree root
          Could not open root, trying backup super
          checksum verify failed on 7551205376 found 000000B6 wanted 00000000
          checksum verify failed on 7551205376 found 000000B6 wanted 00000000
          bad tree block 7551205376, bytenr mismatch, want=7551205376, have=0
          Couldn't read tree root
          Could not open root, trying backup super
          checksum verify failed on 7551205376 found 000000B6 wanted 00000000
          checksum verify failed on 7551205376 found 000000B6 wanted 00000000
          bad tree block 7551205376, bytenr mismatch, want=7551205376, have=0
          Couldn't read tree root
          Could not open root, trying backup super

          ​Thank you in advance for additional help and kind regards~~Piotrek~~pe3no

          Comment


            #6
            Dear oshunluvr and Dear Other FRTB Friends - I don't give up to restore my FRTB data...
            I will be very thankful for every your additional hint and/or any suggestion

            9). I'm googling the phrase: 'BTRFS - unable to access data - "Couldn't read tree root" Error.'

            10). I followed this article, with a promissing title: "[SOLVED] BTRFS mounting issue" (https://bbs.archlinux.org/viewtopic.php?id=264191)
            ... but I haven't been successfull... Could you have a look at my attempts and suggest maybe what I missed, please... ?

            11). According to the suggestions in that article, I searched "Well block (number)" occurrences:
            $ sudo btrfs-find-root /dev/md0
            Code:
            Couldn't read tree root
            Superblock thinks the generation is 8336
            Superblock thinks the level is 1
            Well block 7549403136(gen: 8673 level: 0) seems good, but generation/level doesn't match, want gen: 8336 level: 1
            Well block 7979008(gen: 8658 level: 0) seems good, but generation/level doesn't match, want gen: 8336 level: 1
            Well block 5619712(gen: 8656 level: 0) seems good, but generation/level doesn't match, want gen: 8336 level: 1
            Well block 8217526272(gen: 8655 level: 1) seems good, but generation/level doesn't match, want gen: 8336 level: 1
            Well block 8172896256(gen: 8596 level: 0) seems good, but generation/level doesn't match, want gen: 8336 level: 1
            Well block 8171290624(gen: 8594 level: 0) seems good, but generation/level doesn't match, want gen: 8336 level: 1
            Well block 8170766336(gen: 8594 level: 0) seems good, but generation/level doesn't match, want gen: 8336 level: 1
            Well block 7814676480(gen: 7489 level: 0) seems good, but generation/level doesn't match, want gen: 8336 level: 1
            ​12). Then I executed a series of "btrfs restore -t (number)" commands and I put the numbers from the previous output, trying which one would work.

            13). Attempt 1/8​ (number=7549403136)[FAILED]
            Code:
            $ sudo btrfs restore -t 7549403136 /dev/md0 /tmp/md0
            parent transid verify failed on 7549403136 wanted 8336 found 8673
            parent transid verify failed on 7549403136 wanted 8336 found 8673
            Ignoring transid failure
            checksum verify failed on 7549222912 found 000000B6 wanted 00000000
            checksum verify failed on 7549222912 found 000000B6 wanted 00000000
            bad tree block 7549222912, bytenr mismatch, want=7549222912, have=0
            WARNING: could not setup extent tree, skipping it
            checksum verify failed on 6045696 found 000000B6 wanted 00000000
            checksum verify failed on 6045696 found 000000B6 wanted 00000000
            bad tree block 6045696, bytenr mismatch, want=6045696, have=0
            Couldn't setup device tree
            Could not open root, trying backup super
            parent transid verify failed on 7549403136 wanted 8677 found 8673
            parent transid verify failed on 7549403136 wanted 8677 found 8673
            Ignoring transid failure
            checksum verify failed on 7549222912 found 000000B6 wanted 00000000
            checksum verify failed on 7549222912 found 000000B6 wanted 00000000
            bad tree block 7549222912, bytenr mismatch, want=7549222912, have=0
            WARNING: could not setup extent tree, skipping it
            checksum verify failed on 6045696 found 000000B6 wanted 00000000
            checksum verify failed on 6045696 found 000000B6 wanted 00000000
            bad tree block 6045696, bytenr mismatch, want=6045696, have=0
            Couldn't setup device tree
            Could not open root, trying backup super
            parent transid verify failed on 7549403136 wanted 8677 found 8673
            parent transid verify failed on 7549403136 wanted 8677 found 8673
            Ignoring transid failure
            checksum verify failed on 7549222912 found 000000B6 wanted 00000000
            checksum verify failed on 7549222912 found 000000B6 wanted 00000000
            bad tree block 7549222912, bytenr mismatch, want=7549222912, have=0
            WARNING: could not setup extent tree, skipping it
            checksum verify failed on 6045696 found 000000B6 wanted 00000000
            checksum verify failed on 6045696 found 000000B6 wanted 00000000
            bad tree block 6045696, bytenr mismatch, want=6045696, have=0
            Couldn't setup device tree
            Could not open root, trying backup super
            ​14). Attempt 2/8​ (number=7979008​)[FAILED​]​
            Code:
            $ sudo btrfs restore -t 7979008​ /dev/md0 /tmp/md0
            ERROR: 7979008​ is not a valid numeric value.​
            ​15). Attempt 3/8​ (number=5619712​)[FAILED​]​​
            Code:
            $ sudo btrfs restore -t 5619712 /dev/md0 /tmp/md0
            parent transid verify failed on 5619712 wanted 8336 found 8656
            parent transid verify failed on 5619712 wanted 8336 found 8656
            Ignoring transid failure
            checksum verify failed on 5455872 found 000000B6 wanted 00000000
            checksum verify failed on 5455872 found 000000B6 wanted 00000000
            bad tree block 5455872, bytenr mismatch, want=5455872, have=0
            WARNING: could not setup extent tree, skipping it
            checksum verify failed on 6045696 found 000000B6 wanted 00000000
            checksum verify failed on 6045696 found 000000B6 wanted 00000000
            bad tree block 6045696, bytenr mismatch, want=6045696, have=0
            Couldn't setup device tree
            Could not open root, trying backup super
            parent transid verify failed on 5619712 wanted 8677 found 8656
            parent transid verify failed on 5619712 wanted 8677 found 8656
            Ignoring transid failure
            checksum verify failed on 5455872 found 000000B6 wanted 00000000
            checksum verify failed on 5455872 found 000000B6 wanted 00000000
            bad tree block 5455872, bytenr mismatch, want=5455872, have=0
            WARNING: could not setup extent tree, skipping it
            checksum verify failed on 6045696 found 000000B6 wanted 00000000
            checksum verify failed on 6045696 found 000000B6 wanted 00000000
            bad tree block 6045696, bytenr mismatch, want=6045696, have=0
            Couldn't setup device tree
            Could not open root, trying backup super
            parent transid verify failed on 5619712 wanted 8677 found 8656
            parent transid verify failed on 5619712 wanted 8677 found 8656
            Ignoring transid failure
            checksum verify failed on 5455872 found 000000B6 wanted 00000000
            checksum verify failed on 5455872 found 000000B6 wanted 00000000
            bad tree block 5455872, bytenr mismatch, want=5455872, have=0
            WARNING: could not setup extent tree, skipping it
            checksum verify failed on 6045696 found 000000B6 wanted 00000000
            checksum verify failed on 6045696 found 000000B6 wanted 00000000
            bad tree block 6045696, bytenr mismatch, want=6045696, have=0
            Couldn't setup device tree
            Could not open root, trying backup super
            ​16). Attempt 4/8​ (number=8217526272)[FAILED]​​
            Code:
            $ sudo btrfs restore -t 8217526272 /dev/md0 /tmp/md0
            parent transid verify failed on 8217526272 wanted 8336 found 8655
            parent transid verify failed on 8217526272 wanted 8336 found 8655
            Ignoring transid failure
            ​​17). Attempt 5/8​ (number=8172896256)[FAILED]​​​
            Code:
            $ sudo btrfs restore -t 8172896256 /dev/md0 /tmp/md0
            parent transid verify failed on 8172896256 wanted 8336 found 8596
            parent transid verify failed on 8172896256 wanted 8336 found 8596
            Ignoring transid failure
            WARNING: could not setup extent tree, skipping it
            Couldn't setup device tree
            Could not open root, trying backup super
            parent transid verify failed on 8172896256 wanted 8677 found 8596
            parent transid verify failed on 8172896256 wanted 8677 found 8596
            Ignoring transid failure
            WARNING: could not setup extent tree, skipping it
            Couldn't setup device tree
            Could not open root, trying backup super
            parent transid verify failed on 8172896256 wanted 8677 found 8596
            parent transid verify failed on 8172896256 wanted 8677 found 8596
            Ignoring transid failure
            WARNING: could not setup extent tree, skipping it
            Couldn't setup device tree
            Could not open root, trying backup super​
            ​18). Attempt 6/8​ (number=8171290624)[FAILED]​​​​
            Code:
            $ sudo btrfs restore -t 8171290624 /dev/md0 /tmp/md0
            parent transid verify failed on 8171290624 wanted 8336 found 8594
            parent transid verify failed on 8171290624 wanted 8336 found 8594
            Ignoring transid failure
            WARNING: could not setup extent tree, skipping it
            Couldn't setup device tree
            Could not open root, trying backup super
            parent transid verify failed on 8171290624 wanted 8677 found 8594
            parent transid verify failed on 8171290624 wanted 8677 found 8594
            Ignoring transid failure
            WARNING: could not setup extent tree, skipping it
            Couldn't setup device tree
            Could not open root, trying backup super
            parent transid verify failed on 8171290624 wanted 8677 found 8594
            parent transid verify failed on 8171290624 wanted 8677 found 8594
            Ignoring transid failure
            WARNING: could not setup extent tree, skipping it
            Couldn't setup device tree
            Could not open root, trying backup super
            ​19). Attempt 7/8​ (number=8170766336)[FAILED]​​​
            Code:
            $ sudo btrfs restore -t 8170766336 /dev/md0 /tmp/md0
            parent transid verify failed on 8170766336 wanted 8336 found 8594
            parent transid verify failed on 8170766336 wanted 8336 found 8594
            Ignoring transid failure
            WARNING: could not setup extent tree, skipping it
            Couldn't setup device tree
            Could not open root, trying backup super
            parent transid verify failed on 8170766336 wanted 8677 found 8594
            parent transid verify failed on 8170766336 wanted 8677 found 8594
            Ignoring transid failure
            WARNING: could not setup extent tree, skipping it
            Couldn't setup device tree
            Could not open root, trying backup super
            parent transid verify failed on 8170766336 wanted 8677 found 8594
            parent transid verify failed on 8170766336 wanted 8677 found 8594
            Ignoring transid failure
            WARNING: could not setup extent tree, skipping it
            Couldn't setup device tree
            Could not open root, trying backup super​
            ​20). Attempt 8/8​ (number=7814676480)[FAILED]​​​​​​
            Code:
            $ sudo btrfs restore -t 7814676480 /dev/md0 /tmp/md0
            parent transid verify failed on 7814676480 wanted 8336 found 7489
            parent transid verify failed on 7814676480 wanted 8336 found 7489
            Ignoring transid failure
            WARNING: could not setup extent tree, skipping it
            Couldn't setup device tree
            Could not open root, trying backup super
            parent transid verify failed on 7814676480 wanted 8677 found 7489
            parent transid verify failed on 7814676480 wanted 8677 found 7489
            Ignoring transid failure
            WARNING: could not setup extent tree, skipping it
            Couldn't setup device tree
            Could not open root, trying backup super
            parent transid verify failed on 7814676480 wanted 8677 found 7489
            parent transid verify failed on 7814676480 wanted 8677 found 7489
            Ignoring transid failure
            WARNING: could not setup extent tree, skipping it
            Couldn't setup device tree
            Could not open root, trying backup super​
            21). Having had no success above, I cannot execute the restore command, which would be:
            [NOT EXECUTED]​​​​​​​ $ sudo btrfs restore -i -v -m -t (number) /dev/md0 /tmp/md0

            ​Thank you in advance for additional help and kind regards~~Piotrek~~pe3no​
            Last edited by pe3no; Sep 30, 2023, 04:17 PM. Reason: I unified the code

            Comment


              #7
              Dear BTRFS Friends - let me share the good news with you

              22). [SOLVED] - the 2 above commands combined together allow to recover the BTRFS data, even if the message does not confirm that.

              23). I installed btrfs-progs:
              $ sudo apt-get install btrfs-progs

              24). I re-executed the "find root" command, which points to "Well blocks XXXXXXXX"
              $ sudo btrfs-find-root /dev/md0
              Well block 8217526272 (gen: 8655 level: 1) seems good, but generation/level doesn't match, want gen: 8336 level: 1

              25). The command for "Well block" = "8217526272" silently recovered BTRFS data from /dev/md0, giving the wrong sensation that something was blocked and after a hard reset all disappeared from /tmp/md0
              $ sudo btrfs restore -t 8217526272 /dev/md0 /tmp/md0

              26). In my case 52860 items have been recovered, 313.1 GB, which does not correspond with what gparted was showing but I'm happy that I was able to restore all that

              Kind regards~~Piotrek~~pe3no.

              Comment

              Working...
              X