View Full Version : F19: Can't mount btrfs file system - dmsg='btrfs: superblock checksum mismatch'

18th September 2013, 01:26 PM
Hi there,

this (only) applies to Fedora 19 with btrfs-progs-0.20.rc1.20130308git704a08c-1 (the one that came with F19 and which has not been updated as of 18 September 2013). As the current git sources of btrfs-progs are fixed, I assume that the first update of the btrfs-progs package will fix the bug as well.

After creating a btrfs file system, I filled it with data and then decided to give it a volume label with
btrfs filesystem label /dev/<aDevice> <aLabel>.

As soon as I did this, I could not mount the file system anymore, with dmsg saying 'btrfs: superblock checksum mismatch'.

And indeed, the command
btrfs-show-super /dev/<a device> confirmed that the first entry of the superblock (csum) didn't match in all copies of the superblock.

Whatever I tried with the existing tools, I couldn't mount the file system again.

The solution was to get the current btrfs-progs from git (see here (https://btrfs.wiki.kernel.org/index.php/Btrfs_source_repositories#Official_repository)., to compile them and use that btrfs tool to fix the checksum (just by setting the label again with the new btrfs binary).


btrfs-progs originally wrote broken checksums into the superblocks. This apparently has been fixed in the current git tree, but I don't know when exactly. The btrfs-progs package that came with F19 is a funny one, because it is perfectly able to detect wrong checksums, but still writes them itself.

And it seems like it's not only the label function that breaks the checksum, but other functions as well (fsck, convert, select-super, zero-log, tune, corrupt-block, according to this thread (http://comments.gmane.org/gmane.comp.file-systems.btrfs/23929)).

The btrfs kernel code tries to work around these wrong checksums by ignoring them (only) if the superblock generation number is less than 10. So if you change the label very early after creating the file system, everything works fine even with the old tools.

Hope this helps somebody.

18th September 2013, 07:00 PM
Sounds like not a lot of fun to figure that out.
Thanks for sharing.

18th September 2013, 10:29 PM

thanks for this information - I yesterday posted (http://forums.fedoraforum.org/showthread.php?t=294055) that I did a btrfs-convert with F19 from ext4 to btrfs and was not able to mount it afterwards.

it turned out the problem is what you described - after compiling the new tools I was able to fix it by setting a label. afterwards the mount worked.
however I tried to use the newly compiled btrfs-convert and it directly died with this error:

btrfs-convert test.img
No valid Btrfs found on test.img
unable to open ctree
conversion aborted.

why convert tries to find a btrfs when it should do a convert from ext4 is beyond me :confused:.
but it looks like the btrfs tools are seriously broken :(