LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (http://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   Port-specific USB device mounting. (http://www.linuxquestions.org/questions/linux-hardware-18/port-specific-usb-device-mounting-4175456745/)

thndrchld 04-03-2013 03:36 PM

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.

gdejonge 04-04-2013 05:33 AM

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

JZL240I-U 04-04-2013 05:56 AM

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

thndrchld 04-04-2013 09:10 AM

Quote:

Originally Posted by gdejonge (Post 4924865)
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!

michaelk 04-04-2013 09:43 AM

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.

thndrchld 04-04-2013 04:19 PM

Quote:

Originally Posted by michaelk (Post 4924989)
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)?

michaelk 04-04-2013 06:43 PM

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...

thndrchld 04-05-2013 08:26 AM

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!


All times are GMT -5. The time now is 04:02 PM.