ZFS mount vs Docker service startup at boot

  • My Docker service is writing files to my ZFS mount point at boot before ZFS has mounted, preventing my ZFS pool from actually mounting (similar to https://forum.openmediavault.o…read/15018-Startup-order/).


    How can I ensure my ZFS pools mount before any other services run?


    Is there a systemd Required-Start dependency I can set in my /etc/init.d/docker ?



    Thanks for your help!

  • I tried removing Docker, but the Docker files are still being written to the mount point, and Docker is still listed under Services in the OMV3 GUI.


    When removing Docker, via the OMV3 GUI I:
    - disabled the Docker service
    - uninstalled Docker under Plugins
    - toggled off 'Docker CE' under OMV-Extras
    - rebooted


    Any idea why I'm still seeing Docker listed under Services and also having Docker files written at boot?

  • Hi MrWhippy,


    I've had the same problem, not only with Docker but also with NFS.


    There are binds defined in the /etc/fstab pointing into your ZFS directory which are created by the serivces and the are mounted earlier than the ZFS mount.
    Thus this will fail then because the folder is not empty.


    On my system (OMV 3.x) these entry will also remain in /etc/fstab after disabling the service, maybe they remain also when uninstalling it.


    My Workaround for the ZFS/NFS/DOCKER mount problem is:
    1. Adding "noauto" the every "bind" entry pointing to ZFS directory in /etc/fstab :

    ..

    /ZFS_Mountpoint/Dokumente /export/Dokumente none noauto,bind,nofail,_netdev 0 0
    /ZFS_Mountpoint/Docker /var/lib/docker/openmediavault none noauto,bind,defaults 0 0
    ...
    ...


    So it will not mount the binds on boot and your ZFS directory remains stll empty until ZFS mount will be done.




    2. I've created a oneliner script "/usr/local/bin/mount_binds.sh":



    Bash
    #!/bin/bash
    
    
    for i in `cat /etc/fstab | grep bind | grep ZFS_Mountpoint | awk -F " "   {'print $1'}` ;  do mount $i  ; done

    Please edit "ZFS_Mountpoint" according your ZFS directory.


    Make it executable with:
    chmod 755 /usr/local/bin/mount_binds.sh


    It will find the "bind" entries pointing to my ZFS directory in /etc/fstab and mount it then.



    3. I've created a systemd service "/lib/systemd/system/mount_binds.service" to load the script on boot:



    Set access rights:


    chmod 644 /lib/systemd/system/mount_binds.service


    First I've tested it with:
    systemctl start mount_binds.service


    After it successfully has mounted my binds I've enabled it with:
    systemctl enable mount_binds.service



    After this modification all my ZFS Directories will be mounted on boot and Docker and NFS service both are working.
    So my server is reboot-safe.



    There's also a solution with adding "x-systemd.requires=zfs-mount.service" but my systemd don't know about that flag.
    Maybe because it's not the newest but can't update because it want to install kernel 4.x and I'm on 3.16 because of iSCSI.



    Best regards,
    Mike

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!