- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: usb-storage question
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-16-2003 03:14 PM
тАО12-16-2003 03:14 PM
I have both a Fuji digital camera and a Lexar jump disk. Both work fine on my evo using the usb-storage module. But if I first attach one and then the other, I can't use the second without first removing the usb-storage module and then reinserting it. This is not too much of a problem for me except it requires becoming root. I noticed a similar issue with first attaching my digital camera and later attaching my brother-in-law's. Somehow something is set on attaching one device that doesn't get reset on attaching a different device.
The problem I forsee would arise if I use the camera and later my wife wants to use the jumpdisk, since for her to become root and mess with modules is more than she is comfortable with.
So the question: is there some way to reload/reset the mod-usb module without becoming root? I would then build this into a script to be run from a button on the screen.
I'm nervous about making things suid root, but maybe this is the only way?
Mike
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-16-2003 03:30 PM
тАО12-16-2003 03:30 PM
Re: usb-storage question
If so, you shoul dbe able to (as you say) create some scripts, and have them run with root privelages because they are being done from the console! Much fun.
Personally, I think this would be a good thing to talk to the people at 'http://www.linux-usb.org/' about, and see if they have any solutions (mailing list archives at http://www.linux-usb.org/mailing.html).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-16-2003 07:04 PM
тАО12-16-2003 07:04 PM
Re: usb-storage question
I would be nervous about setuid scripts too, as you can't make them :)
You would need a little C wrapper around your script or use "sudo".
However, I have never experienced this kind of thing with usb (because I have never used usb on Linux) but I would have thought the whole thing might be achieved with "cron" instead.
If you have usb as loadable modules, you could put a "rmmod -a" to run every so often from cron. This will unload unused modules.
If it really needs to be a script then just run that from cron.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-17-2003 12:45 AM
тАО12-17-2003 12:45 AM
Re: usb-storage question
Going to linux-usb is a good idea. I'll probably try that.
Mark, using cron sounds interesting. What I might try is a cron job to check if something is attached, and then if not, remove the module. Since the problem is unlikely to arise often, probably every 15 minutes or so would do it.
So some related questions:
1. Can I have both devices attached at once? Perhaps one on /dev/sda1 and one on /dev/sda2? This doesn't seem to work as I have it since I need to reload dev-usb between devices.
2. Can I have it so a plugged in device goes to a specific device? Right now the first device is always sda1, but to do the previous thing it would be nice to say that the camera, say, always goes to sda1 and the jumpdisk to sda2.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-17-2003 12:57 AM
тАО12-17-2003 12:57 AM
Re: usb-storage question
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-18-2003 03:15 AM
тАО12-18-2003 03:15 AM
Re: usb-storage question
Mark's solution is certainly the simplest; just put rmmod usb-storage in the crontab to run every few minutes. But just for fun I wrote the following script to tell me what is using the module.
Mike
#!/bin/sh
# script to check for attached usb-storage devices
# attempt to remove the usb-storage module if not in use
attached="false"
if grep ^usb-storage /proc/modules
then
echo usb-storage module loaded
# look for someone using it
for i in `ls /proc/scsi/usb-storage-0`
do
grep Vendor /proc/scsi/usb-storage-0/$i
if grep "Attached: Yes" /proc/scsi/usb-storage-0/$i
then
attached="true"
fi
done
if [ $attached == "true" ]
then
echo usb-storage in use
else
echo usb-storage not in use, attempting module removal
# check if you have the power to remove it
if [ $USER == root ]
then
/sbin/rmmod usb-storage
else
echo you need to be root to remove modules
fi
fi
else
echo usb-storage module not loaded
fi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-30-2004 01:05 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-12-2004 01:54 PM
тАО04-12-2004 01:54 PM
Re: usb-storage question
The hotplug documentation really sucks, but with a bit of help from google, I put together a script that seems to work ( be careful to correct line wrapping from the posting software):
#! /bin/sh
# remove usb_storage module when device is removed
# adapted from Martin Lohmeier's post
# http://marc.theaimsgroup.com/?l=linux-hotplug-devel&m=108058759316716&w=2
#
# put this in /etc/hotplug/usb/usb-storage
# the hotplug documentation really ought to explain this better
#
if [ "$ACTION" = "add" ]; then
cp /etc/hotplug/usb/usb-storage $REMOVER
fi
if [ "$ACTION" = "remove" ]; then
touch /tmp/usb_has_been_removed # some debugging
rmmod usb-storage
fi