3

I have a pi 3b running raspbian 10, installed fresh this morning. All was going well until it ceased to be able to mount my btrfs volume.

The error I get is as follows:

mount: /drive: wrong fs type, bad option, bad superblock on /dev/sdb1,
       missing codepage or helper program, or other error.

There are 2 usb drives connected which together make up one btrfs volume (it's like RAID1).

The etc/fstab entry specifies the PARTUID and that's correct, I checked.

What I've found is that if I try to mount one of the disks, it fails as above. But if I then try to mount the second disk, it works! But you can only specify one disk in fstab. And anyway, that's weird, you're only supposed to specify one of the disks and leave it up to btrfs to find the other.

The disks mount fine on other computers without the double mount call schenanegans. And I'm pretty sure at some point today it was booting ok, but to be honest there's been a lot of reboots and config today.

Nb. it also seems to mount after this command:

sudo btrfs device scan

Perhaps I need a way to get that command to run before it tries to mount it?

  • 1
    Have you tried specifying the devices (device=devicepath) in the options in fstab? – rickhg12hs Nov 3 '19 at 14:58
  • @rickhg12hs brilliant! I had not come across that before, but putting device=/dev/sda1,device=/dev/sdb1 in the fstab options seems to have fixed it and is much more elegant than the solution I'd found which involved adding another systemd unit to call btrfs device scan. Thanks! – artfulrobot Nov 3 '19 at 19:58
3

man 5 btrfs shows mount options and gives one possibility for systems where the device manager doesn't execute a btrfs device scan on its own.

device=devicepath

Specify a path to a device that will be scanned for BTRFS filesystem during mount. This is usually done automatically by a device manager (like udev) or using the btrfs device scan command (eg. run from the initial ramdisk). In cases where this is not possible the device mount option can help.

Note: booting eg. a RAID1 system may fail even if all filesystem’s device paths are provided as the actual device nodes may not be discovered by the system at that point.

On one of my systems, /etc/fstab has an entry for a multi-device btrfs filesystem and the options there are:

...  defaults,compress-force=zstd,device=/dev/sda3,device=/dev/sdb1,discard ...
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.