LinuxQuestions.org
Help answer threads with 0 replies.
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 01-05-2013, 02:54 AM   #1
yo8rxp
Member
 
Registered: Jul 2009
Location: Romania
Distribution: Ubuntu 10.04 Gnome 2
Posts: 102

Rep: Reputation: 31
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
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,321
Blog Entries: 28

Rep: Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141
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: 102

Original Poster
Rep: Reputation: 31
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: 102

Original Poster
Rep: Reputation: 31
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: Arch, Kubuntu
Posts: 1,281

Rep: Reputation: 320Reputation: 320Reputation: 320Reputation: 320
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: 102

Original Poster
Rep: Reputation: 31
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



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

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

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