LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 09-25-2010, 04:29 PM   #1
SaintDanBert
Senior Member
 
Registered: Jan 2009
Location: "North Shore" Louisiana USA
Distribution: Mint-20.1 with Cinnamon
Posts: 1,771
Blog Entries: 3

Rep: Reputation: 108Reputation: 108
managing mount points for external drive "farm"


I have inherited a large number of external drives. Some are mechanical drives. Others are flash. Most are USB. Some are Secure Digital (SD) or Compact Flash (CF) or similar "media" cards. Currently, on connection, everything gets mounted automatically into a folder that is part of /media. If the drive has a "label", the mount point is /media/driveLabel. I don't want to guess or search for where this stuff gets mounted and so I'd like to "manage" all of this somehow.
Q1: Are there any end-user, desktop tools to help manage a large pool of external drives?

I know that udev rules operate to accomplish the drive device creation, configuration and mounting in a automatic way.
Q2: Are there any utilities that make it easy to administer where to mount drives, what to do when each drive gets mounted, how and when to notify the end user? and so on.

Merci d'avance,
~~~ 0;-Dan
 
Old 09-25-2010, 11:29 PM   #2
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
What's to guess? As you said, your automounter mounts all drives to /media/driveLabel. How would you like it to behave instead?

udev rules in cases like this are usually designed to create uniquely-named symlinks to the device nodes in question. You choose some characteristic about the device for the rule to match, and whenever it detects that device, it will create the corresponding link for it. Then you can use these unvarying symlinks to mount the device instead of the normal, possibly-changing /dev entries.

More on writing udev rules here.

Note though that this is separate from the behavior of your automounter, as described above, which only runs after the udev-created devices are in place. It is possible to use udev to launch some kind of automount script as well, but it's not generally recommended.

Again, I think you really need to detail exactly what kind of mount system you actually want for these devices before we can recommend a solution.
 
1 members found this post helpful.
Old 09-27-2010, 12:16 PM   #3
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,684
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
Quote:
Originally Posted by David the H. View Post
What's to guess? As you said, your automounter mounts all drives to /media/driveLabel. How would you like it to behave instead?
That's a fine choice when one knows the label. Given the OP's situation, I'm guessing he doesn't know the labels. He probably doesn't even know the UUIDs.

Quote:
Originally Posted by David the H. View Post
udev rules in cases like this are usually designed to create uniquely-named symlinks to the device nodes in question. You choose some characteristic about the device for the rule to match, and whenever it detects that device, it will create the corresponding link for it. Then you can use these unvarying symlinks to mount the device instead of the normal, possibly-changing /dev entries.

More on writing udev rules here.

Note though that this is separate from the behavior of your automounter, as described above, which only runs after the udev-created devices are in place. It is possible to use udev to launch some kind of automount script as well, but it's not generally recommended.

Again, I think you really need to detail exactly what kind of mount system you actually want for these devices before we can recommend a solution.
I'm guessing at what the OP might want, but I know it is exactly what I would want in his situation ... and I've been in a similar one a few times. To me, the ideal is to have a fixed identity for every point a drive could be plugged in to, and have the drive show up via that identity (in addition to any other). Trouble is, various technologies like USB have really made a mess of any kind of fixed identity. IMHO, it's a bad design because of that alone.

If I have a device with whole device label of "foobar", and a whole device UUID of "382f6ad2-426d-4f6e-ac6f-338a6a140d73", and I plug it into the port connected to bus 1, controller 2, port 0, hub port 3 ... which has partition 1 with a label of "xyzzy" and a UUID of "21da59e5-62c4-4ded-92ac-47a723743db3", then I'd like it to appear in some definite place based on any of those pieces of info, including the partition being based on its own info, as well as the info of the whole device plus the partition number and label.

But for now, if there is just one hard drive /dev/sda, plugging in a 2nd one always getting /dev/sdb would be fine. And automounting should have an equally fixed reference, e.g. /mnt/sdb1 for partition 1.

If there was a way to determine exactly where in the USB bus tree a device is plugged in to, which never changes when the device is unplugged and another device is plugged in to the same place (so it now references the new device), which I have not see how to get (what info I do get is an incrementing number that keeps going up every time I unplug and plug in), then I'd want a to have that reference used (in addition to being based on labels and UUIDs since those have uses, too).

There are plenty of times I simply want to access the device plugged into a specific USB port when all I know is what USB port it is (presume I have once found out the exact bus path to that port and remember the numbers).
 
1 members found this post helpful.
Old 09-27-2010, 02:28 PM   #4
SaintDanBert
Senior Member
 
Registered: Jan 2009
Location: "North Shore" Louisiana USA
Distribution: Mint-20.1 with Cinnamon
Posts: 1,771

Original Poster
Blog Entries: 3

Rep: Reputation: 108Reputation: 108
Quote:
Originally Posted by Skaperen View Post
...
There are plenty of times I simply want to access the device plugged into a specific USB port when all I know is what USB port it is (presume I have once found out the exact bus path to that port and remember the numbers).
...
Over here is this whirling state of physical hardware. When some item comes online, I always want to assign the name, "Framis" or "Foobar" or "Tom" or ... ( I could do this with Vax/Vms in a prior life ).
If there are several devices in the same family as "Framis" then I'd like consistent names for the whatever I connect regardless of which orifice I choose to use.

Also, I don't understand why USB remains such a mess. At the low levels ports and hubs and adapters will always be a mesh of parts. At the upper levels, all of that mesh should vanish under a single, unified "device" -- say /dev/usbA01...usbCNN or similar. ** MY ** configuration ought to let me map from the physical to the logical in a deterministic way.

~~~ 0;-Dan


Now software can always look for "Framis", test if it is available and readable etc and do whatever I want to happen with every such "Framis."
 
Old 09-28-2010, 03:09 PM   #5
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
I think you're both still missing that there are two separate systems involved here; udev, which creates the device nodes, and your mounting system, which creates the actual mount points from those nodes.

Not that I'm an expert on udev, but it seems to me that the default udev rules for usb are fairly reasonable and do pretty much what you'd expect them to do, and basically what you've both described. It generally appears to simply increment the device letter for each new device detected. The only thing I can criticize about that is that it sometimes doesn't seem to "clear" removed devices so that the letters can be reused, meaning that the letter will keep incrementing on multiple insertions and removals. Perhaps there are also be some factors based on how different buses are detected, but in the end the generic rules are limited to what the kernel is reporting about the hardware. I'm not going to claim to know how it works in detail

However, as I explained before, you can also create your own udev rules so that you can have fixed device symlinks for specific hardware devices. These rules can match, or partially match, just about anything the /sys device tree reports, and yes, this can include things like the physical bus address of each usb port, or the device labels, manufacturer name, serial number, or whatever. You can even use external programs or scripts to generate the device names you want it to create. If you want all usb block devices to have entries like /dev/usb01, /dev/usb02, etc. then you can, or you can have /dev/usbport01, /dev/usbport02, etc instead, or as well. In the end it all comes down to how you choose and use the matching rules. It's a very powerful and flexible system, and I'm willing to bet that both of you can build exactly the kind of device tree you want if you just take the time to figure it out. I've already linked you to the howto (but note that most of the commands like udevinfo have changed to udevadm info, etc.).

The second part, the mounting system, is harder to help with, because each distribution and desktop does things a little differently. The only thing I can suggest is that you take a look at your distribution's automount documentation. Chances are that once you have decent udev rules in place, you can also design a mount configuration to take you the rest of the way.

This is all assuming removable media of course. Fixed devices should almost always use fstab, preferably mounted according to UUID if you want to avoid possible conflicts or changes in hardware configuration.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Pen drive not mounted ...."Unable to mount, No media in drive" subashk80 Linux - Newbie 6 08-17-2009 01:38 AM
Question on External Drive Mount Points ervt Linux - General 1 04-15-2008 06:03 PM
LXer: Using external file devices in Linux: Climbing the "mount" command LXer Syndicated Linux News 0 04-02-2007 12:16 AM
Mount points on usb devices (dig. camera, zip drive, external hard disk) Impaler Linux - Hardware 3 05-29-2006 11:08 PM
External Hard Drive "locked" in Mandriva 2006 VapourTrail Linux - Software 1 03-04-2006 12:53 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 10:57 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration