I recently had a problem on my test box running btrfs where it would not boot up past the grub menu. I managed to boot off a live CD and found that I couldn’t mount the boot disk either and it gave the error:
mount: wrong fs type, bad option, bad superblock on /dev/sda1, or too many mounted file systems
Looking in dmesg I found this error over and over:
parent transid verify failed on 5413130240 wanted 22358 found 22337
It appears that the disk filesystem had become corrupted after a “power failure”. Running the fsck -t btfs /dev/sda1 returned no errors and found no problems.
It turns out the fsck tools bundled in ubuntu 11.04 (and even those downloadable from the btrfs website) weren’t able to fix this specific issue.
I did however manage to fix it by checking out a copy from btrfs-tools git repository and using the latest files from the lead developer’s git, even though his last change was some time back I guess this hadn’t been merged into the main tree.
So the fix
boot from the live cd cd ~ mkdir btrfs-tools cd btrfs-tools git clone git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-progs-unstable.git
Download the btrfs-select-super.c, disk-io-c and disk-io.h from the link above and drop them into the git cloned folder above.
cd into the cloned folder and run
./configure make all make btrfs-select-super chmod 750 ./btrfs-select-super ./btrfs-select-super -s 1 /dev/sda1
where “1” is the second superblock copy (zero being the default which has become corrupted) and /dev/sda1 the target disk/partition.
Once you’ve done this run ./btrfsck /dev/sda1 and reboot. If all is well your PC should now boot.
If that doesn’t work try superblock 2.
./btrfs-select-super -s 2 /dev/sda1
Update:
You might also like to try the patch in the mailing-list here and mount the filesystem as read-only. If it works this would let you get your data off at least.
Update 2:
Check out the new restore tool to recover files from the broken filesystem.
I’m having this same problem, however none of the superblocks are ok on my btrfs volume, and btrfsck -s 1 /dev/mapper/home does not succeed without displaying the same “parent transid verify failed” messages. Do you have any other suggestions?
I think if all your alternative super-blocks are corrupted you’re out of luck until the developer produces a fully functional btrfsck. I guess it’s still quite early in the development cycle but I remember reading somewhere that btrfs was going to be the default in v16 but I see that’s been pulled now.
You could have a look through or post your output to the mailing list.