LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 11-12-2009, 05:17 PM   #1
Fill
Member
 
Registered: Jun 2007
Posts: 96

Rep: Reputation: 16
Recognize devices by product ID?


Hey,

I remember that I used to have my fstab filled with devices. As all of you probably know, if you connect, for example, an usb device, it will be /dev/sda. However, my /dev/sda is supposed to be another device that I added to /etc/fstab to mount on a specific directory.

What happens is that I would like to know if there is a way to recognize removable hard disks by ID or something, I remember that there was a way to do it but I just couldn't figure it out.

Any help would be appreciated.
Thanks in advance,
Fill
 
Old 11-12-2009, 05:38 PM   #2
aus9
LQ 5k Club
 
Registered: Oct 2003
Location: Western Australia
Distribution: Icewm
Posts: 5,842

Rep: Reputation: Disabled
hi

ignoring your usb device.....However, my /dev/sda is SUPPOSED to be another device that I added to /etc/fstab to mount on a specific directory.....sounds like something is not working without usb device or am I mis-reading you?

2) you are probably interested in creating an udev rule?
 
Old 11-13-2009, 01:14 AM   #3
Fill
Member
 
Registered: Jun 2007
Posts: 96

Original Poster
Rep: Reputation: 16
You're miss-reading me.

Imagine that I have a usb-disk which uses ntfs-3g on Linux and it's /dev/sda. I create an entry in /etc/fstab with /dev/sda1 saying to mount my disk using ntfs-3g filesystem, and then I indicate the mount point.

However, I disconnect the disk and then I plug my usb-pen disk. What happens is that my pen disk will be /dev/sda (because there are no other usb devices plugged), and when I type 'mount /dev/sda', it will try to mount the pen using ntfs-3g, which is totally wrong - the pen uses FAT filesystem.

So my question is how would I recognize the NTFS usb disk by product ID or something instead of /dev/sda1...
 
Old 11-13-2009, 01:43 AM   #4
cladisch
Member
 
Registered: Oct 2008
Location: Earth
Distribution: Slackware
Posts: 228

Rep: Reputation: 54
Have a look into /dev/disk/by-id/.
 
Old 11-13-2009, 03:17 AM   #5
aus9
LQ 5k Club
 
Registered: Oct 2003
Location: Western Australia
Distribution: Icewm
Posts: 5,842

Rep: Reputation: Disabled
you do not try to mount /dev/sda or sdb it has to be a partition

Code:
sux
mkdir /media/disk (if no entry)
mount /dev/sda1 /media/disk
and the whole purpose of udev rules is so each device is mounted on its own mount point.

so whether you insert disk one or two...or both....the udev rules take them to different mount points.
 
Old 11-13-2009, 03:44 AM   #6
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Quote:
Originally Posted by Fill View Post
So my question is how would I recognize the NTFS usb disk by product ID or something instead of /dev/sda1...
As aus9 says, buy writing a udev rule.

This link may be a little old, but it's the reference that I first used.

http://www.reactivated.net/writing_udev_rules.html

Cheers,

Evo2.
 
Old 11-13-2009, 01:32 PM   #7
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
udev rules rule!

Check it out - it'll do what you want, because that is (partly) what it was developed for.

But you don't mention your distro (udev doesn't exist in the older ones).
 
Old 11-21-2009, 02:59 AM   #8
Fill
Member
 
Registered: Jun 2007
Posts: 96

Original Poster
Rep: Reputation: 16
My distribution is Debian Lenny, it surely has udev. I'll give it a look, thanks for your replies!
 
Old 11-21-2009, 04:05 PM   #9
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
Quote:
My distribution is Debian Lenny, it surely has udev.
Please let us know how you progressed. Did it "work" or not ?
 
  


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
WINE - Doesn't recognize sound devices tmazz Ubuntu 0 02-19-2009 04:13 PM
Xandros 3.x doesn't recognize USB2 wireless devices rusty2 Linux - Wireless Networking 6 02-25-2006 11:43 AM
Dell BIOS often doesn't recognize devices any more! blue penguin General 3 11-13-2005 06:24 AM
cannot recognize USB devices zhuqing8027 Linux - Hardware 6 09-08-2005 12:00 AM
how do i manually load a device with known vendor and product IDs to devices? pyenos Linux - Hardware 0 03-01-2005 10:16 AM

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

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