Jump to content
Read the Funtoo Newsletter: Summer 2023 ×
  • 0

Server fails to detect btrfs filesystems on boot.


lazlo.vii

Question

For several weeks I have had this issue on my server and I would like to resolve it before I upgrade the hardware this week.  Basically, btrfs partitions are not recognized when the system boots up.  In order to reboot the server I have to stop everything on my network that relies on NFS or LXD containers from the server.  Then attach a keyboard, mouse and monitor to the server and boot it up, stop the NFS daemon, run btrfs device scan, then run mount -a, then start NFS and LXD and then start my containers.  Then I disconnect my keyboard, mouse, and monitor and reconnect them to my desktop and boot it, then while it is coming up I make sure my tablet and phone don't need rebooting to reconnect to my server.  After that I can start using my computers again. 

 

So where should I be looking to find out why my server isn't scanning for btrfs devices on boot?  I have looked in dmesg and syslog, but the only info there comes from when the system tries to mount the filesystems and logs the fact that they are missing.  Manually calling btrfs device scan as root will find the drives and then they can be mounted without issue.  Therefor I think that the automated device scan is no longer functioning.  What component should be issuing this?    What other logs or configuration files should I be looking at?

 

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

I think I might have found an answer.  After googling and reading and rinsing and repeating I learned that the device scan at boot should be done by the initramfs.  So I extracted the contents of my initramfs with:

cp /boot/initramfs-debian* /tmp/initramfs.xz
	cd /tmp
	unxz *.xz
	cpio -i -d < initramfs

The first place I looked was in the "init" script in the root on the cpio and I found this code section starting at line 383:

# Setup btrfs, see bug 303529
setup_btrfsctl
	# start BTRFS volume detection
[ -x /sbin/btrfsctl ] && /sbin/btrfsctl -a

The command "btrfsctl" is deprecated.  It has been replaced with "btrfs".  Inside the cpio's /sbin "brtfs" exists but "btrfsctl" does not:

/tmp $ ls ./sbin
blkid  btrfs  init  mdadm  mdmon  modprobe

 

If I am understanding what I have read then I think the section of the init script should read:

# Setup btrfs
	setup_btrfs
	# start BTRFS volume detection
	[ -x /sbin/btrfs ] && /sbin/btrfs device scan

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...