LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-27-2011, 11:35 AM   #1
gosala
LQ Newbie
 
Registered: Mar 2011
Posts: 14

Rep: Reputation: 0
mounting 2 usb drives in to 2 different locations in linux


Hi,
here is my situation, I am writing a c program in linux and in the program I am mounting 2 usb devices attached to 2 specific ports in the computer. (eg : I have to mount the usb attached to the left port in to /mnt/left and the right port to /mnt/right) and the attachment order of those devices may differ (eg: left port usb may or may not be attached before the right.) In this case what should i do?
 
Old 03-27-2011, 01:19 PM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
Cool

The first part of the solution to your problem involves writing custom udev rules for each usb device. Each device has a unique ID. Once the rule is written to mount a specific device to a specific mount point (/mnt/left or /mnt/right), you can then add an entry to your /etc/fstab for the devices.

The second part of the solution involves determining the unique usb port identifiers. I haven't the foggiest idea how to do that. If you can figure it out, the solution *may* involve the udev rules mentioned above.

www.google.com/linux is your friend. Use it to research Unix/Linux related questions.

Good luck!

PS. Please pardon my manners. Welcome to LQ. This is a great forum for learning (just by reading threads posted by others), and for getting answers to your questions. But please use the link given above first. Most questions you may have are probably already answered on the web.

Last edited by bigrigdriver; 03-27-2011 at 06:28 PM.
 
1 members found this post helpful.
Old 03-27-2011, 01:31 PM   #3
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,291

Rep: Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322
If I were you, I would back away from that idea.

There's already a software layer (hal, dbus) that gets involved there, and I wouldn't advise fighting it. So you have to learn it:-(. There's also usb standards, (On intel's site) and kernel code - enough pain in the way to make that a real messy thing to do.

Put the disks in /etc/fstab, and the system will mount them for you

/dev/sdb1 /mnt/hd auto user 0 0

Mind you, it complains while booting if the disk isn't there.
 
1 members found this post helpful.
Old 03-27-2011, 09:20 PM   #4
gosala
LQ Newbie
 
Registered: Mar 2011
Posts: 14

Original Poster
Rep: Reputation: 0
thankx a lot for your concern business_kid and bigrigdriver,

well I went through fstab file's description. But apparently still I cannot distinguish left port and a write port in the system(It says how to mount /dev/hdb or /dev/hdc to a particular location.) How can I know for sure that left port is always /dev/hdb ? Because as I know if I attach a usb device to the left port before the right port usb ,the scsi ids assigned to each port may differ from the assigned scsi ids, when right port usb attach before the left port usb.

what I want is whether I attach left port first or right port first, the left port's usb must be mounted in to /mnt/left and right port's usb in to /mnt/right. what I should do? Is it something to do with port identifiers as bigrigdriver says ?

thnk you all.
 
Old 03-28-2011, 02:07 AM   #5
gosala
LQ Newbie
 
Registered: Mar 2011
Posts: 14

Original Poster
Rep: Reputation: 0
Hi ,

I think I found the answer. It has to be done using 'udev' rules.
thank you for your interest.
 
  


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
New to Linux and need help mounting usb drives Gygar Linux - Newbie 2 10-10-2009 10:19 PM
USB drives are not mounting: mag1strate Linux - Newbie 41 10-03-2009 09:01 AM
Mounting USB devices on fixed locations? Zmyrgel Linux - Hardware 5 07-12-2006 01:31 AM
Mounting USB drives under 2.6.x hussar Linux - General 1 03-07-2004 12:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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