Mount folder via systemd

  • Hello! I need help with systemd mount script. I need use .kodi folder from other partition on my sd card. I can do this only using

    Code
     mount <what> <where>

    I did mount script for systemd but it's not working for me

    • Official Post

    systemd starts after the boot config already mounted the second partition on the SD card to /storage and since everything is hard-coded to use /storage/.kodi you cannot then mount another partition to that path. If the other partition is EXT4 you can always switch the boot config to mount the partition with the .kodi folder you want to /storage instead - assuming this is not shared with some other OS as that's generally a bad idea as Kodi settings are OS specific.

  • you cannot then mount another partition to that path

    I have mounted .kodi folder with autostart.sh

    Bash: autostart.sh
    #!/bin/sh
    
    sleep 2;
    mount /var/media/SHARE/system/.kodi /storage/.kodi

    but services (e.g. TVheadend Server) not start

  • System that uses the SHARE partition also runs as root (I have dualboot)

    mount

    devtmpfs on /dev type devtmpfs (rw,relatime,size=369752k,nr_inodes=92438,mode=755)
    proc on /proc type proc (rw,relatime)
    sysfs on /sys type sysfs (rw,relatime)
    /dev/mmcblk0p8 on /flash type vfat (ro,noatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)
    /dev/mmcblk0p9 on /storage type ext4 (rw,noatime,data=ordered)
    /dev/loop0 on / type squashfs (ro,relatime)
    tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
    devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
    tmpfs on /run type tmpfs (rw,nosuid,nodev,mode=755)
    tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
    cgroup2 on /sys/fs/cgroup/unified type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate)
    cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,name=systemd)
    bpf on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime,mode=700)
    cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
    cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
    cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
    cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
    cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
    mqueue on /dev/mqueue type mqueue (rw,relatime)
    debugfs on /sys/kernel/debug type debugfs (rw,relatime)
    tmpfs on /var type tmpfs (rw,relatime)
    configfs on /sys/kernel/config type configfs (rw,relatime)
    tmpfs on /tmp type tmpfs (rw,nosuid,nodev)
    /dev/mmcblk0p7 on /var/media/SHARE type ext4 (rw,nosuid,nodev,noexec,noatime,data=ordered)
    /dev/mmcblk0p7 on /storage/.kodi type ext4 (rw,nosuid,nodev,noexec,noatime,data=ordered)

    Maybe I need edit mount options?

  • Try this in autostart

    Code
    sleep 2
    umount /var/media/SHARE
    mount -o rw,atime,data=ordered /dev/mmcblk0p7 /var/media/SHARE
    mount /var/media/SHARE/system/.kodi /storage/.kodi