BTRFS volume mount fails at boot, but works once system is up

Hi @chrismurphy

Yes just for the record if I do:

$ sudo uname -a
Linux oxygen 5.8.13-200.fc32.x86_64 #1 SMP Thu Oct 1 21:49:42 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

$ sudo lsinitrd /boot/initramfs-5.8.13-200.fc32.x86_64.img | grep btrfs
$ # No mentions of btrfs found

$ sudo dracut -f

$ sudo lsinitrd /boot/initramfs-5.8.13-200.fc32.x86_64.img | grep btrfs
$ # No mentions of btrfs found

So it might be something that dracut should be doing but isn’t. Anyway hopefully we are getting this to the right people. :wink:

Thank you ever so much for all your help with this.

Cheers, Dan

2 Likes

Yep. In the meantime, I suspect it’s possible to use a drop-in dracut configuration file to add the udev rule. Or use the x-systemd.automount mount option in fstab.

2 Likes

Hi @chrismurphy,

Yes I seem to have got it working now by doing this:

$ sudo dracut --add btrfs --force

$ sudo lsinitrd /boot/initramfs-5.8.13-200.fc32.x86_64.img | grep btrfs
Arguments: --add 'btrfs' --force
btrfs
-rw-r--r--   1 root     root           20 May 29 19:35 etc/cmdline.d/00-btrfs.conf
-rw-r--r--   1 root     root          616 May 29 19:35 usr/lib/udev/rules.d/64-btrfs.rules
-rwxr-xr-x   1 root     root       965424 May 29 19:35 usr/sbin/btrfs
lrwxrwxrwx   1 root     root            5 May 29 19:35 usr/sbin/btrfsck -> btrfs

So now the BTRFS volume mounts automatically at boot and I can’t seem to make it fail to even when my disks are in funny configurations, split between HBA and direct motherboard connections.

Presumably I will have to do this dracut --add btrfs --force everytime there is a new kernel until dracut is modified to add the minimal btrfs stuff when there is any btrfs filesystem in /etc/fstab not just the root filesystem. Or is the fact that I’ve added the btrfs module once carried forward even though fedora is using dracut --hostonly by default? I guess I will find out! :wink:

I have been looking at man dracut and it looks like I can prompt dracut to add the btrfs module by modifying /etc/dracut.conf or creating /etc/dracut.conf.d/myconf.conf. I haven’t done that yet because I want to understand it all a bit better first.

I’m sure the x-systemd.automount option in /etc/fstab would work too.

The other solution coming around the corner is to do a clean install of Fedora 33 and have it’s default btrfs root filesystem solve the problem for me too. :grinning:

2 Likes

Yes, that is all you need to do. It will have the same effect as “–add btrfs” every time dracut is run.

3 Likes