Mind Dump, Tech And Life Blog
written by Ivan Alenko
published under license CC4-BY
posted in category Systems Software / GNU Linux
posted at 07. Mar '24

Howto Fix Btrfs Bad Superblock (space_cache)

Recently I installed PeppermintOS to my older mini PC and chose Btrfs as a filesystem for /home and xfs for /. And then when I restarted to a new shiny system, I couldn’t log in. Not much in logs, at least lightdm printed something and then error -1. At least I knew there was an error. Then I noticed my user is missing a home directory. Weird. So I created one and then I checked mounts and found out that my whole /home is not mounted. So I mounted it:

$ mount /home
[  478.766180] BTRFS error (device nvme0n1p3): cannot disable free space tree
[  478.766989] BTRFS error (device nvme0n1p3): open_ctree failed
mount: /home: wrong fs type, bad option, bad superblock on /dev/nvme0n1p3, missing codepage or helper program, or other error.
    dmesg(1) may have more information after failed mount system call.

That was bad. I don’t have the full dmesg output, I started with searching the error and found a solution here: https://github.com/btrfs/btrfs-todo/issues/29. Thanks.

So the system installer added wrong option to fstab and I had to change space_cache to space_cache=v2 that like:

# /etc/fstab
UUID=123456 /home btrfs defaults,noatime,space_cache,autodefrag,discard,compress=lzo 0 0


# /etc/fstab
UUID=123456 /home btrfs defaults,noatime,space_cache=v2,autodefrag,discard,compress=lzo 0 0

Hooray! Now it works.

Add Comment