[mythtv-users] usb mount

Stephen Worthington stephen_agent at jsw.gen.nz
Mon Jan 1 15:52:17 UTC 2024


On Mon, 1 Jan 2024 22:29:30 +0800, you wrote:

>Boot with USB plugged in does not generate a udev event (which might be the original problem !

Ouch! That is a nasty bug.  It would certainly explain the USB drive
not mounting from fstab.

>This works
>
>[Unit]
>Description=Mount /Store
>After=online.target
>Wants=apache2.service
>Wants=network-online.target
>
>[Service]
>Type=simple
>ExecStartPre=bash -c "while [ ! -b /dev/disk/by-label/MYTHTV ]; do sleep 1; done"
>ExecStart=mount /dev/disk/by-label/MYTHTV /store
>
>[Install]
>WantedBy=multi-user.target

That looks like a decent workaround.  I think I would also add an
overall timeout, so it does not keep on going forever if the USB drive
is not powered on at boot time.  So maybe add a counter and exit the
loop when it hits 60 seconds?

It would also likely be a good idea for mythbackend to wait for /store
to be mounted before it tries to start - if there is a recording
scheduled for around the time the PC boots, mythbackend can start
recording directly after it is started, which will not work very well
if there is nowhere for it to write recording files.  So add:

[Unit]
Wants=store.mount
After=store.mount

to the mythbackend service.


More information about the mythtv-users mailing list