You are not logged in.

#1 2019-08-11 18:10:16

Semi
Member
Registered: 2019-08-11
Posts: 2

[SOLVED] Can't recover bad superblock on BTRFS filesystem

So I get the following error when trying to mount one of the btrfs partitions on my external HD:

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

Checking the filesystem on errors fails as well:

$ sudo btrfs check /dev/mapper/online 
Opening filesystem to check...
No valid Btrfs found on /dev/mapper/online
ERROR: cannot open file system

A check using the second superblock copy works fine and doesn't give any errors:

$ sudo btrfs check --super 1 /dev/mapper/online
using SB copy 1, bytenr 67108864
Opening filesystem to check...
Checking filesystem on /dev/mapper/online
UUID: 0626b3bd-4467-4e3b-90c4-eb5b3b780a87
[1/7] checking root items
[2/7] checking extents
[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)
found 2098231988224 bytes used, no error found
total csum bytes: 2041841260
total tree bytes: 2637971456
total fs tree bytes: 301219840
total extent tree bytes: 50053120
btree space waste bytes: 274742420
file data blocks allocated: 20397300502528
 referenced 2076128366592

But recovering the bad superblock gives me the following error:

$ sudo btrfs rescue super-recover -v /dev/mapper/online 
All Devices:
        Device: id = 1, name = /dev/mapper/online

Before Recovering:
        [All good supers]:
                device name = /dev/mapper/online
                superblock bytenr = 67108864

                device name = /dev/mapper/online
                superblock bytenr = 274877906944

        [All bad supers]:
                device name = /dev/mapper/online
                superblock bytenr = 65536


Make sure this is a btrfs disk otherwise the tool will destroy other fs, Are you sure? [y/N]: y
ERROR: failed to write super block for devid 1: flush error: Input/output error
Failed to recover bad superblocks

btrfs-select-super also does not work:

$ sudo btrfs-select-super -s 1 /dev/mapper/online 
ERROR: failed to write super block for devid 1: flush error: Input/output error
using SB copy 1, bytenr 67108864

What could be a reason that I can't recover the bad superblock? Do I have any other options to recover the partition?

Last edited by Semi (2019-08-11 19:48:58)

Offline

#2 2019-08-11 19:48:37

Semi
Member
Registered: 2019-08-11
Posts: 2

Re: [SOLVED] Can't recover bad superblock on BTRFS filesystem

Good news, eventually rebooting the external hard drive with the system still powered on solved the problem.
Not sure I fully understand why, but my problem is solved.

$ sudo btrfs rescue super-recover -v /dev/mapper/online 
All Devices:
	Device: id = 1, name = /dev/mapper/online

Before Recovering:
	[All good supers]:
		device name = /dev/mapper/online
		superblock bytenr = 67108864

		device name = /dev/mapper/online
		superblock bytenr = 274877906944

	[All bad supers]:
		device name = /dev/mapper/online
		superblock bytenr = 65536


Make sure this is a btrfs disk otherwise the tool will destroy other fs, Are you sure? [y/N]: y
Recovered bad superblocks successful

Offline

Board footer

Powered by FluxBB