[mythtv-users] Automounting USB drives

Hika van den Hoven hikavdh at gmail.com
Sun May 7 15:23:32 UTC 2017


Hoi Stephen,

Sunday, May 7, 2017, 4:43:14 PM, you 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?
> _______________________________________________

I don't know what is happening with mythtv. However this media
mounting is also happening on my system running with Mate and I do not
like it either. I created an udev rule that starts a script to mount
usb drives based on their label. I let it first unmount them in case
they are already mounted in media

81-private-usb.rules:

SUBSYSTEM=="block", \
        SUBSYSTEMS=="usb", \
        KERNEL=="sd?1", \
        ACTION=="add", \
        RUN+="/root/mount-usb.sh $kernel"

And then:

#!/bin/bash
declare PartID=$1
echo $1 > /root/kernel
declare PartLabel
declare Label
declare MountPath
declare Device
declare -i i=0

declare DevLabels="VideoDisk VideoDisk2"
declare DevPaths="/home/MobileMyth /home/MobileMyth2"

case $PartID in
        sd[b-z][1-9])
#       PartLabel=`blkid -o value -s LABEL /dev/usb${PartID}`
        PartLabel=`blkid -o value -s LABEL /dev/${PartID}`
        ;;
        *)
        exit
        ;;
esac
[ "$PartLabel" == "" ] && exit

for Label in $DevLabels; do
        i=$i+1
        if [ "$Label" == "$PartLabel" ]; then
                umount --force /dev/${PartID} > /dev/null
                MountPath=`echo "$DevPaths" | cut -d' ' -f$i`
                [ -d $MountPath ] || mkdir --parents $MountPath
                mount --label "$Label" $MountPath
        fi
done

if [ "$PartLabel" == BOOT ]; then
        i=0
        for Label in VAR HOME BOOT ROOT; do
                i=$i+1
                umount --force `blkid -L $Label` > /dev/null
        done
        MMountPath=/home/raspberry
        [ -d $MMountPath ] || mkdir --parents $MMountPath
        mount --label "ROOT" $MMountPath
        i=0
        for Label in VAR HOME BOOT; do
                i=$i+1
                MountPath=$MMountPath/`echo "var home boot" | cut -d' ' -f$i`
                [ -d $MountPath ] || mkdir --parents $MountPath
                mount --label "$Label" $MountPath
        done
fi


Tot mails,
  Hika                            mailto:hikavdh at gmail.com

"Zonder hoop kun je niet leven
Zonder leven is er geen hoop
Het eeuwige dilemma
Zeker als je hoop moet vernietigen om te kunnen overleven!"

De lerende Mens



More information about the mythtv-users mailing list