LinuxQuestions.org
Register a domain and help support LQ
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
 
LinkBack Search this Thread
Old 01-05-2013, 02:54 AM   #1
yo8rxp
Member
 
Registered: Jul 2009
Location: Romania
Distribution: Ubuntu 10.04 Gnome 2
Posts: 53

Rep: Reputation: 13
Mount point by device ID


Hi ppl !

#lsusb
Bus 001 Device 011: ID 0951:161a Kingston Technology
Bus 001 Device 010: ID 0951:1642 Kingston Technology

ls -l /dev/disk/by-* do not show any info regarding device ID and mount point
mtab lists only mount point for a block device , but cant find anywhere a relation between device ID and mount point

How can i get the mount point for lets say " ID 1651 ???

Sincerely, Gabriel
 
Old 01-05-2013, 08:10 PM   #2
frankbell
Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Debian, Mageia, Mint
Posts: 6,891

Rep: Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269
Are you perhaps thinking of mounting by UUID? The UUID is not exactly the same as the device ID.

This article helped me:

http://www.virtualhelp.me/component/...-uuid-or-label
 
Old 01-08-2013, 05:47 AM   #3
yo8rxp
Member
 
Registered: Jul 2009
Location: Romania
Distribution: Ubuntu 10.04 Gnome 2
Posts: 53

Original Poster
Rep: Reputation: 13
Nope mate, trying to write a small bash to execute an app. when USB device ID is present,if not present then not running that app which resides inside that flash.

In server mode , USB flash aint mounted when inserted, and cannot look in /media/ for a specific label like "1Gb_special" because is not mounted.

If knowing somehow that lsusb | grep "ID 0951:1624" is linked to /dev/sdg i can do a pretty job indeed by mounting that device in a folder that i can work with.
Otherwise i can do it by mounting all sdX unmounted devices one by one and scan for a file inside but it is ugly.

Want to be more like an HASP key, that's why i need to detect the /dev/sdX name for a specific flash device ID
Same bash will be on more than 1 server , and for one is /dev/sdb other can be /dev/sdg depending by how many drives are present there

Hope that my english is readable !

I did a mistake in my question , saying mount point instead of /dev/sdX name

Last edited by yo8rxp; 01-08-2013 at 06:04 AM.
 
Old 01-08-2013, 06:50 AM   #4
yo8rxp
Member
 
Registered: Jul 2009
Location: Romania
Distribution: Ubuntu 10.04 Gnome 2
Posts: 53

Original Poster
Rep: Reputation: 13
Case closed

My bad was to believe that all flash disks report unique ID s , i discovered that 2 identical flash memories report same ID.

Have to buy a HASP and rethink all from scratch.


Thanks for quick reply Frankbell !!
 
Old 01-08-2013, 06:51 AM   #5
eSelix
Senior Member
 
Registered: Oct 2009
Location: Wroclaw, Poland
Distribution: Kubuntu
Posts: 1,189

Rep: Reputation: 301Reputation: 301Reputation: 301Reputation: 301
If you use udev you can easily create a link to device with your own name (for example "/dev/id0951-1624") when usb drive is connected. And then mount with that name. You can also use "--no-canonicalize" option for mount to store path to devices as entered.

As frankbell write, the UUID mechanism was created, it is unique. Did you checked "/dev/disk/by-uuid"? These device links (by-id, by-label, etc.) are created when device is connected, not when mounted.

Last edited by eSelix; 01-08-2013 at 06:54 AM.
 
Old 01-08-2013, 01:09 PM   #6
yo8rxp
Member
 
Registered: Jul 2009
Location: Romania
Distribution: Ubuntu 10.04 Gnome 2
Posts: 53

Original Poster
Rep: Reputation: 13
true eSelix , and thanks 4 the pile-up

I simply do not agree with messing up udevadm , which indeed is the mechanism preventing things shuffle up in linux.
However , I did sort this up by looping as root at start up
and greping there for USB serial number that i want, which point afterwards to it's dev node.
fdisk -l | grep -o 0xc7bd6c97
fdisk -l | sed -e '1,/0xc7bd6c97/d' | grep -m1 "/dev" | sed 's/ .*//g'
in this way I can get a lock on unique serial number and not messing up udev on multiple servers

Could be ugly from a professional point of view but now i'm happy

Last edited by yo8rxp; 01-08-2013 at 01:52 PM.
 
  


Reply

Tags
mountpoint, usb thumb drive


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mount Point for Tape device shubhamuddu Linux - Newbie 6 07-10-2012 03:46 AM
What is the easiest way to match a mount point to a device? worm5252 Linux - Newbie 3 12-28-2009 06:49 PM
Mount problem - device already mounted or mount point busy zahoo Linux - General 7 08-28-2009 05:02 PM
find mount point given device kornelix Programming 2 04-13-2007 09:01 AM
would it make sense to have 2 mount point for 1 device? sirpelidor Linux - Hardware 3 12-27-2003 12:10 PM


All times are GMT -5. The time now is 01:48 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration