[mythtv-users] Automounting USB drives

Stephen Worthington stephen_agent at jsw.gen.nz
Mon May 8 06:10:13 UTC 2017

On Sun, 7 May 2017 13:23:03 -0500, you wrote:

>On 05/07/2017 09:43 AM, Stephen Worthington wrote:
>> Mythbuntu 16.04, MythTV .28-fixes
>> I have three hard drives on external USB 3 mounts that I use for
>> archiving old recordings.  They are all listed in /etc/fstab to be
>> mounted automatically if present:
>> LABEL=arc1 /mnt/arc1 jfs relatime,errors=remount-ro,nofail 0 2
>> That works fine if mythfrontend is not running.  But if mythfrontend
>> is running, they all wind up being automounted under /media, on
>> something like this:
>> /media/sdp1
>> This is extremely annoying, as the /media paths change depending on
>> what order the drives are powered up in and what has previously been
>> mounted, and the paths are not in the storage group I have set up for
>> the drives, which lists them all under /mnt/arc[123].  So I always
>> have to remember to shut down mythfrontend before switching them on,
>> and inevitably I forget sometimes.
>> So does anyone know why and how mythfrontend is doing this?  Is there
>> an option somewhere I can use to stop it?
>Wondering if it's the mythmediamonitor that's doing the work. You might
>spot it in the frontend log.
>Maybe worth a try: "Ignore devices". It's in the frontend global settings.
>Assumes they have a static /dev/somethingOrAnother entry.
>Five screens in on 29-pre.

You are right, it does seem to be mythmediamonitor that is causing the
problem.  I ran mythfrontend with -v media and it shows that it is
running /usr/bin/pmount on any new USB drives that show up.

I tried the IgnoreDevices setting, and that worked with settings like
"/dev/sdo1,/dev/sdp1" - mythfrontend did not try to mount anything in
that list.  But when I started my USB dual mount, the drives came up
on devices that were one letter greater than last time, so only one of
them got excluded.  So I tried using
"/dev/disk/by-label/arc1,/dev/disk/by-label/arc2" for IgnoreDrives,
but that does not work.

Also, there is clearly a race between mythfrontend and systemd as to
which sees and mounts the drives first.  When I am not using -v media
on mythfrontend, it normally wins the race, but with -v media, it
seems to be about 50/50 between systemd winning and mythfrontend
winning.  And once I had both of them mount both drives!  And if
mythfrontend is running and fails to mount them when they are turned
on, it *will* mount them when they are unmounted from their fstab

So it looks like I will need to somehow tie down what /dev/sd?? device
each drive comes up as, so that I can then exclude those devices in
the IgnoreDrives setting.  And hope that the UDEV rules to do that do
it fast enough that mythfrontend will not see the original devices
before they get moved.  I will do some more research and then try that
when I get another safe gap in my recording schedule.

More information about the mythtv-users mailing list