I am currently using LibreElec on a raspberry pi with an external hdd connected to it using an active USB hub.
It now happens, that the external HDD is only mounted after LibreElec and Kodi are fully booted (like 30-60sec after the boot). This causes several unwanted side effects, like media being missing in Kodi becaus they are on the extern hdd and cannot be found, or docker containers not starting as they rely on files storred on the external hdd.
LibreElec uses udev to automount the external hdd. This is the mount rule:
# check for blockdevices, /dev/sd*, /dev/sr* and /dev/mmc*
SUBSYSTEM!="block", KERNEL!="sd*|sr*|mmc*", GOTO="exit"
# check for special partitions we dont want mount
IMPORT{builtin}="blkid"
ENV{ID_FS_LABEL}=="EFI|BOOT|Recovery|RECOVERY|SETTINGS|boot|root0|share0", GOTO="exit"
# /dev/sd* and /dev/mmc* ith partitions/disk and filesystems only and /dev/sr* disks only
KERNEL=="sd*|mmc*", ENV{DEVTYPE}=="partition|disk", ENV{ID_FS_USAGE}=="filesystem", GOTO="harddisk"
KERNEL=="sr*", ENV{DEVTYPE}=="disk", GOTO="optical"
GOTO="exit"
# mount or umount for hdds
LABEL="harddisk"
ACTION=="add", PROGRAM="/usr/bin/sh -c '/usr/bin/grep -E ^/dev/%k\ /proc/mounts || true'", RESULT=="", RUN+="/usr/bin/systemctl restart udevil-mount@/dev/%k.service"
ACTION=="remove", RUN+="/usr/bin/systemctl stop udevil-mount@/dev/%k.service"
GOTO="exit"
# mount or umount for opticals
LABEL="optical"
ACTION=="add|change", RUN+="/usr/bin/systemctl restart udevil-mount@/dev/%k.service"
GOTO="exit"
# Exit
LABEL="exit"
Is there a way to make udev or systemd to mount the external hdd much earlier in the boot process? Best would be before Kodi starts.
Thanks so much for any help.