Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

bind mount from mergerfs branch on var, system fails boot #1381

Open
yanekoyoruneko opened this issue Dec 14, 2024 · 3 comments
Open

bind mount from mergerfs branch on var, system fails boot #1381

yanekoyoruneko opened this issue Dec 14, 2024 · 3 comments

Comments

@yanekoyoruneko
Copy link

yanekoyoruneko commented Dec 14, 2024

Describe the bug

Unable to bind mount /var from /var on mergefs branch and boot system.

Reproduce

Create pool of drives (I use one drive for the purpose of this test)

mergerfs -o cache.files=auto-full,dropcacheonclose=true,category.create=mfs /mnt/tank1 /mnt/pool

Copy /var into the pool of drives

rsync -av /var /mnt/pool/var

Now create this fstab:

# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# YOUR FILESYSTEM MOUNTS
UUID=123-HDD-UUID            /mnt/tank1    xfs           defaults        0       0
/mnt/tank1                    /mnt/pool     mergerfs      cache.files=auto-full,dropcacheonclose=true,category.create=mfs 0       0
# first try to mount 'directly' from the hdd
/mnt/tank1/var                 /var          none          bind 0 0
 # this is for purpose of testing that the var is accesible from bind mount
/mnt/pool/var                 /var-test     none          bind 0 0

Verify that the system reboots fine shutdown now -r
Now edit the bind mount of /var to go directly from /mnt/pool/var

/mnt/pool/var                 /var          none          bind 0 0

Reboot and now system hangs trying to run systemd-timesyncd eventually fails and never boots
Revert fstab from recovery so the system boots fine.

Expected behavior

Its possible to mount var from create pool.

System information:

Linux homelab 6.1.0-28-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.119-1 (2024-11-22) x86_64 GNU/Linux
mergerfs v2.40.2

@trapexit
Copy link
Owner

Why do you think this is a mergerfs problem?

The first thing you should be doing is ensuring the order of the mounts. Using an option like x-systemd.requires=. mounting on most modern systems is done concurrently.

@yanekoyoruneko
Copy link
Author

yanekoyoruneko commented Dec 15, 2024

Acording to manpage it suggested it is executed sequentially. Sorry for my wrong assumption. I tried adding

x-systemd.requires=/mnt/pool,x-systemd.automount

to options to no avail. Systemd fails waiting for device to mount under /mnt/pool indefinitely and hangs everything.
I also tried to use systemd mounts:

[Unit]
Description=Bind mount /mnt/pool/var to /var
After=mnt-pool.mount
Requires=mnt-pool.mount

[Mount]
What=/mnt/pool/var
Where=/var
Type=none
Options=bind

[Install]
WantedBy=multi-user.target

I verified that mnt-pool.mount exists but systemd returns "timesyn blocked for more than ..."
I'm not sure this is not mergerfs issue because mounting from /mnt/tank1/var to /var doesn't result in such problems.

@trapexit
Copy link
Owner

You should be putting requires on each step to ensure the order. mergerfs needs to wait for every branch and your bind on mergerfs.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants