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 03-11-2007, 04:53 AM   #1
Azalar
Member
 
Registered: Jan 2006
Distribution: Ubuntu
Posts: 42

Rep: Reputation: 15
How to mount multiple usb devices


I have an hard drive, ipod & pen drive which all connect via usb to my computer.
The problem i am having is how to setup my fstab file to handle these.
For instance if i plug all 3 of these in at the same time we could have this scenario.

hard drive = /dev/sda
ipod = /dev/sdb
pen drive = /dev/sdc

Now i could setup my fstab with these in mind but what happens if i put them in a different order?
We could then get..

ipod = /dev/sda
pen drive = /dev/sdb
hard drive = /dev/sdc

So now the fstab would be wrong and wouldnt work.
And all references to these devices would be broken in the applications that might use them.
I could ensure i put them in the correct order but that then means i have to have the hard drive and ipod plugged in to use the pen drive which seems stupid.
Also i could just assign them all to use sda and make sure i only use 1 at a time but again, what if i want to transfer files between the hard drive and the pen drive or ipod.

Could someone tell me what the common solution to this sort of this is? it must have been an issue for many people before i would have thought.
thanks
Az
 
Old 03-11-2007, 05:44 AM   #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
It's udev to the rescue.

Modern kernels now use udev for device creation. And with it for the first time Linux can have persistent device-specific device nodes. If you look in /dev/disk/by-id, you'll see an entry for every block device you have, named by serial number. These entries will always link to the correct device no matter what order you attach them, so you can use them in your fstab instead of the traditional /dev/sd* devices and you'll always mount correct hardware.

But since these names are rather cumbersome to use, udev can also be configured to create easier names for you. One simple entry in /etc/udev/rules.d and you can have links to your devices named /dev/ipod, /dev/pendrive, and /dev/harddrive, or whatever else your heart fancies. Just follow this guide: writing udev rules

Last edited by David the H.; 03-11-2007 at 05:51 AM.
 
Old 03-12-2007, 04:37 AM   #3
Azalar
Member
 
Registered: Jan 2006
Distribution: Ubuntu
Posts: 42

Original Poster
Rep: Reputation: 15
Thanks for your reply, this worked great.
Got the Ipod working with a single line in the sym links rules file.
udev rocks!
 
Old 03-12-2007, 05:00 AM   #4
Electro
LQ Guru
 
Registered: Jan 2002
Posts: 6,042

Rep: Reputation: Disabled
Do not use fstab for removable mediums. Use a combination of udev and hal.
 
Old 03-13-2007, 04:22 AM   #5
Azalar
Member
 
Registered: Jan 2006
Distribution: Ubuntu
Posts: 42

Original Poster
Rep: Reputation: 15
Why not use fstab for this?
With Amarok i can get it to issue the mount /media/ipod or eject /media/ipod and it works great.
My fstab file contains the line which allows the user mount the newly udev created /dev/ipod under /media/ipod
What benefits does hal offer over my current method?

thanks

Az
 
Old 03-14-2007, 01:37 AM   #6
Electro
LQ Guru
 
Registered: Jan 2002
Posts: 6,042

Rep: Reputation: Disabled
Linux sometimes does not release removable medium nodes, so you get copies of the nodes. HAL provides a way so that your users do not have to learn, understand, and run mount. The utilities umount and eject can still work with out the lines in fstab. I do not put removable mediums in fstab because the nodes changes all the time. I manually mount the drive myself.
 
Old 03-14-2007, 04:54 AM   #7
Azalar
Member
 
Registered: Jan 2006
Distribution: Ubuntu
Posts: 42

Original Poster
Rep: Reputation: 15
Thanks for your reply
I did a quick google search and couldn't find any decent docs covering HAL
Could you tell me the name of a few commands HAL uses so i can search by command name so i can look into it further.
thanks again
Az
 
  


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
Using multiple USB devices chestnut Linux - Hardware 6 04-21-2005 06:54 PM
using multiple USB flash devices luv2hike Slackware 7 01-04-2005 08:21 PM
Multiple USB devices with hotplug support vdemuth Slackware 2 12-06-2004 04:58 PM
USB Hub and Multiple Devices acrors Red Hat 5 08-25-2004 01:22 PM
Multiple devices on the same mount point Knotz Linux - Hardware 3 05-15-2003 03:27 AM

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

All times are GMT -5. The time now is 10:57 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