LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 04-03-2013, 02:36 PM   #1
thndrchld
Member
 
Registered: Dec 2009
Posts: 33

Rep: Reputation: 1
Port-specific USB device mounting.


Hello.

I'm currently in the process of deploying FOG storage nodes to 23 satellite locations of our company, some of which are a five hour drive away. Currently, I'm shipping the computers with images pre-loaded, but I would like the ability to add images later without having to send them across the VPN.

I've come up with the idea of using tiny USB flash drives, the kind similar to the nano receivers on wireless mice, to send the images when an update needs to be done.

However, each device will have a unique UUID (I presume, anyway), making it difficult to specify the mount for the device in /etc/fstab.

What I would like to do:

On the back of the computers were are using for the storage nodes, the usb ports are numbered. I would like to configure the system to always mount any storage device plugged into port 0 on /images/port0. Likewise, any device plugged into port 1 on /images/port1.

Is there any way to do this? Typically, I perma-mount usb devices via UUID, but since each of this flash drives is going to be unique, and setting each UUID by hand each time an image is upgraded will be obnoxious and time-consuming, that's not an option. Setting a LABEL on each drive will likewise be obnoxious and time-consuming unless there's some way to set the LABEL without having to mkfs the drive. Also, as the drives will likely have the FAT filesystem, I'm not even sure if LABEL= will even work for them.

I want this to be as simple for the remote user as possible. I don't want them to have to do anything but "Remove the plug in port0 and replace it with the enclosed plug, then ship back the one you've removed."

I'm open to any way I can accomplish this, and if I have to fall back on using LABEL= to mount them, then that's what I'll do. It would be much better, however, to be able to have to system automatically pick the correct mount point according to where the drive is physically plugged in.

Apologies if this isn't the right section of the board to post in. Hardware seemed the best option.
 
Old 04-04-2013, 04:33 AM   #2
gdejonge
Member
 
Registered: Aug 2010
Location: Netherlands
Distribution: Kubuntu, Debian, Suse, Slackware
Posts: 317

Rep: Reputation: 73
e2label can set a label without the need to format the drive.
Or you could use uuidgen to generate the uuid automaticly.
These tools should be all part of the e2fsprogs.

Cheers
 
Old 04-04-2013, 04:56 AM   #3
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,629

Rep: Reputation: Disabled
I'm by no means an expert here, but I would have supposed that automatic mounting off a specific port can be done via an udev rule?

http://www.reactivated.net/writing_udev_rules.html
 
Old 04-04-2013, 08:10 AM   #4
thndrchld
Member
 
Registered: Dec 2009
Posts: 33

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by gdejonge View Post
e2label can set a label without the need to format the drive.
Or you could use uuidgen to generate the uuid automaticly.
These tools should be all part of the e2fsprogs.

Cheers
Does mounting by label work for FAT devices, or is that only a feature of ext* filesystems?

I came across uuidgen in my research, but manually setting the UUID on every update we make to the images would be incredibly time consuming, as every update requires 23 flash drives (One for each satellite office). If we update 2 images at once, then we have 46 flash drives to set the uuid on.

You can see how this would get very obnoxious very quickly.

Thanks for the help!
 
Old 04-04-2013, 08:43 AM   #5
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,699

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
Quote:
Does mounting by label work for FAT devices, or is that only a feature of ext* filesystems?
Yes, and you can change it via mlabel which is part of the mtools package.

Without knowing your process it is difficult to know how obnoxious this can get but I would think it would be relatively easy to create a script to update images and change labels and / or UUIDs automatically.
 
Old 04-04-2013, 03:19 PM   #6
thndrchld
Member
 
Registered: Dec 2009
Posts: 33

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by michaelk View Post
Yes, and you can change it via mlabel which is part of the mtools package.

Without knowing your process it is difficult to know how obnoxious this can get but I would think it would be relatively easy to create a script to update images and change labels and / or UUIDs automatically.
Ok. I'll do it that way.

Next question: Is there any way to have it automatically remount the drive in the same place once it's been removed? The user's not going to be umounting it before they remove the old drive, so can I automate umount + remount when they insert the new drive (which has the same UUID or LABEL)?
 
Old 04-04-2013, 05:43 PM   #7
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,699

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
In the case of auto mounting (I can not say for all distributions / versions) even with the same label the drives will not mount to the same mount point. You still should be able to automate mount and remount...
 
Old 04-05-2013, 07:26 AM   #8
thndrchld
Member
 
Registered: Dec 2009
Posts: 33

Original Poster
Rep: Reputation: 1
Ok. You've given me something to think about. Fortunately, I have some time before we start updating images, so I can experiment and tweak until I've got a solution.

Thanks!
 
  


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
Automaticly mounting a USB flash drive to a specific directory n0wiq Linux - General 2 09-17-2009 12:26 PM
Map USB device to a specific special file DaneelGiskard Linux - Hardware 2 04-14-2007 05:37 PM
Disabling specific USB port cvweiss Linux - General 1 03-27-2006 03:32 PM
Force a USB device to use a specific /dev/ttyUSBX garnser Linux - Software 4 02-10-2006 06:28 AM
how can usb-storage device attach to specific /dev/sd* xxie Linux - Hardware 0 05-25-2004 10:14 PM

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

All times are GMT -5. The time now is 12:21 PM.

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