[mythtv-users] usb mount

Stephen Worthington stephen_agent at jsw.gen.nz
Mon Jan 1 11:06:47 UTC 2024

On Mon, 1 Jan 2024 17:27:17 +0800, you wrote:

>My main mythtv drive is a usb drive.
>If I put, in fstab
>UUID=6a67da23-0789-42a7-bb24-ab7a1f21008c  /store     ext4 defaults      
>1  2

I would change the second to last field from 1 to 0 and see if that
helps.  It is used to tell if dump should be run on the drive to do a
backup, but no-one uses it much any more (and dump may not even be
installed).  So if you are not deliberately using dump, you should
have it set to 0.

>boot fails with a 'Enter Root Password ..." message about bad disk.
>if I put
>UUID=6a67da23-0789-42a7-bb24-ab7a1f21008c  /store     ext4 
>defaults,nofail      1  2
>Boot is normal, but the disk is not mounted

For many years, I ran my MythTV box with an external drive on a USB
mount, and I never had any problems with mounting it automatically
from fstab.  So I think you must have something misconfigured

>I made a systemctl file
>[seagull] /home/jam [842]% cat /etc/systemd/system/mountStore.service
>Description=Mount /Store
>ExecStartPre=/bin/sleep 30
>ExecStart=mount /dev/disk/by-label/MYTHTV /store
>It mounts correctly, but the service file is a bit inelegant. Using Hot 
>Plug (google for a fix) seems wrong too.
>The systemd mount options want a fixed bus id (and the usb port can change).
>The drive is a 4T so the occasional fsck will muck up timing. Any ideas 

Yes, using a time delay to get around a race condition is not a good
idea.  You always want to wait for the actual event, rather than just
delay and hope the event will happen before your selected timeout.  So
in this case, you want to be waiting for the partition to be available
to mount, so you want to be waiting for /dev/disk/by-label/MYTHTV to

You seem to have the label MYTHTV on the partition you are mounting on
that drive, so I would suggest using LABEL=MYTHTV on your fstab line
instead of UUID=6a67da23-0789-42a7-bb24-ab7a1f21008c.  But that will
not be the cause of your problem, unless the UUID value is wrong.

With your current setup, if you disable the mountStore.service and
boot, then run:

mount /store

does that work?  That command should look up the fstab entry to find
the correct partition to mount.  If it does not work, then you may
have the UUID wrong, or there may be a syntax error in fstab just
above that line.

Check the ownership and permissions.  I normally set mountpoints to
chmod a-rwx so that if they are not mounted, then there is no access
to the directory they mount on and any commands using that mountpoint
will fail, rather than writing to the directory or below it.  And I
make mountpoint directories chown root:root if they are to be mounted
from fstab.

When a USB drive is plugged in, there is a UDEV event that can be
matched against and used to mount the drive in the correct place.  I
run a nice script I found on the net called media-automount.  This
allows me to configure what happens when any USB device is plugged in
or unplugged.  I think this is it:


More information about the mythtv-users mailing list