TIP: Click on subject to list as thread! ANSI
echo: rberrypi
to: ME@PRIVACY.NET
from: THEO
date: 2018-09-25 13:13:00
subject: Re: How to auto-mount a U

NY  wrote:
> I have a hard drive (either spinning or pen drive) which gets auto-mounted
> to /media/pi/ (where the PID varies from one drive to another but is
> fixed for any given drive). However the /dev/sd1 raw device changes from
> sda1 to sdb1 to sdc1 etc if the device gets disconnected and reconnected,
> which precludes auto-mounting /dev/sda1 to the path where I want it.

You can use the device node in /dev/disk/by-id/ or by-label to make an entry
in fstab that will always mount it in the same place.  by-id nodes are based
on the manufacturer and serial number of the device, so don't change when
it's hotplugged.

You can also make a udev rule that mounts all devices with (for instance)
Seagate's USB vendor ID to the same mount point when hotplugged.

By some combination of multiple rules, you can map multiple devices to the
same location, assuming that's your aim.

Theo

--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)

SOURCE: echomail via QWK@docsplace.org

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.