Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
#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 ???
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
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.
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
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.