Mounting USB devices with stable names

Robin Laing Robin.Laing at drdc-rddc.gc.ca
Fri Nov 10 21:50:01 UTC 2006


Mike McCarty wrote:
> Robin Laing wrote:
> 
>> Mike McCarty wrote:
>>
>>> Robin Laing wrote:
>>>
>>>>
>>>> I label all my devices when I format them.  They then mount as 
>>>> /media/{label name}.
>>>
>>>
>>> You label your cameras and printers when you format them?
>>>
>>>
>> Oops, I should have said cards and hard drives.  All my USB devices 
>> are either cards or hard drives.  I take the card out of my camera as 
>> it doesn't drain the batteries then.
> 
> 
> If you persisted, I was going to ask you about your keyboard and mouse.
> 
> :-)

My mouse and keyboard are not usb so it wouldn't have worked.  Ha Ha.

> 
> Furthermore, my question also involved (if you read my original
> message) ethernet cards.
> 
> I trow you don't label your ethernet cards when you format them. :-)
> 
> [snip]
> 
>>> That doesn't fix the fact that /etc/fstab has to point to a device
>>> name, and that is a moving target. Sometimes I have to mount /dev/sda1
>>> and sometimes /dev/sde1 and sometimes /dev/sdf1 for the same physical
>>> device.
>>>
>>> Mike
>>
>>
>>
>> I look at the mount point to work with.  In my case, all my cards or 
> 
> 
> You didn't address my statement, though. Currently, my fstab has to
> have the mount parameters in it, and that has to point to a node in
> /dev. The node I need to use changes based on the phase of the moon,
> and other things I don't have control over. So each time I boot, I have
> to edit /etc/fstab to fiddle it up to correspond to how the machine
> came up. This is true even if I use the mount point when mounting
> (which I normally do), rather than the device node (which I rarely
> do).

In my case, hal sets the fstab.  There are no entries for /dev/sd(x) in 
my work computer.  At least not until I plug in my USB stick.

This is the tail of my /etc/fstab at work before I insert my stick.

/dev/hdc                /media/cdrecorder       auto 
pamconsole,exec,noauto,managed 0 0
-----
Here it is after.

/dev/hdc                /media/cdrecorder       auto 
pamconsole,exec,noauto,managed 0 0
/dev/sda1               /media/Robin_Laing      vfat 
pamconsole,exec,noauto,fscontext=system_u:object_r:removable_t,utf8,managed 
0 0
-----
And external hard drive.

/dev/hdc                /media/cdrecorder       auto 
pamconsole,exec,noauto,managed 0 0
/dev/sda1               /media/MES_R_LAING      vfat 
pamconsole,exec,noauto,fscontext=system_u:object_r:removable_t,utf8,managed 
0 0
------
External HD and Stick

/dev/sda1               /media/MES_R_LAING      vfat 
pamconsole,exec,noauto,fscontext=system_u:object_r:removable_t,utf8,managed 
0 0
/dev/sdb1               /media/Robin_Laing      vfat 
pamconsole,exec,noauto,fscontext=system_u:object_r:removable_t,utf8,managed 
0 0

------

It is done automatically.

> 
>> HD's will mount under media with the name they are labeled with.  Thus 
>> my work HD comes up with my section and my name every time.
>>
>> My work thumb drives do the same thing.
> 
> 
> You seem to be talking about a separate topic, altogether, now.
> 
> I asked about a unified approach to having persistent naming of
> devices under Linux. You appear not to be discussing this topic.
> You seem to be discussing having persistent naming for file
> systems, for which so far I have had no need.
> 
> It appears that there may be a partial solution for disc or
> disc emulating devices with udev, the jury is still out on
> that one for me, especially as I haven't investigated the
> controversy that seems to surround it. But I'm grateful
> for the pointer to udev, and intend to investigate it further.
> It appears to address somewhat the issue of printers, as
> well. It does not seem to address ethernet ports.
> 
> The overall topic seems not to have been addressed at all,
> AFAICT.Now my ethernet ports (embeded on mother board) seem to be set in /etc/sysconfig/ or someplace.  I don't remember.  I have only had one issue with ethernet since putting FC4 on my computer.  See what happens when FC6 gets installed.

> 
> Mike

Now my ethernet ports (embedded on mother board) seem to be set in 
/etc/sysconfig/ or someplace.  I don't remember.  I have only had one 
issue with ethernet since putting FC4 on my computer.  See what happens 
when FC6 gets installed.  I only use the one port.

I find it hard to have a default name for every device as that would 
entail millions of names to deal with duplication of devices on the same 
machine.  If the device is identified, then that should be enough.  Let 
the user customize.

I would have to look at my USB printer at home.  The printer installer 
created all the device info for that.  It would have been nicer if cups 
would have handled that but that is life.  No real difference than the 
last time I had to install a printer on Windows.

I will say that in the past I made the mistake of messing with the 
/etc/fstab file only to be screwed up.  I have also found that the 
mounting of my USB devices changes depending on the port used or the 
order that they are plugged in.  But because things have just worked 
with the labels, it hasn't been a problem so I have not looked back 
since trying to get hotplug to work.

I am no wizard with this and you are now asking me questions beyond my 
experience.

Good luck.
-- 
Robin Laing




More information about the fedora-list mailing list