[mythtv-users] usb mount
Mike Perkins
mikep at randomtraveller.org.uk
Mon Jan 1 22:37:32 UTC 2024
On 01/01/2024 21:39, James Linder wrote:
>
>
>> On Jan 1, 2024, at 23:52, Stephen Worthington <stephen_agent at jsw.gen.nz> 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.
>
> Why would this not work? I’m displaying my ignorance, so the question is real.
>
> After=mountStore.service
> Requires=mountStore.service
>
> James
>
Because you're waiting for the disk to actually be mounted, not for that service to run. Remember,
that service will wait until the disk 'appears' and can be mounted, which may take some time.
I'm not sure of the exact sequencing of things in systemd so I couldn't be sure just /when/ it would
trigger that the 'service' has been run. Possibly once it has flagged as started.
I don't trust systemd further than I can throw it.
--
Mike Perkins
More information about the mythtv-users
mailing list