LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 04-10-2007, 04:21 PM   #1
kornelix
Member
 
Registered: Oct 2005
Location: Germany
Distribution: Ubuntu
Posts: 56

Rep: Reputation: 24
find mount point given device


I need to find removable USB drives and their mount points.

I can find USB devices at least two ways:
1. $ udevinfo -e (look for devices with ID_TYPE=disk, ID_BUS=USB)
2. $ /dev/disk/by-id (look for "USB Flash" in file name) (symlink to /dev/xxx)

I can then find the mount point by looking for the device in /etc/mtab.

This seems an awful mess for such a simple task. Is there a simpler way?

thanks
 
Old 04-10-2007, 04:38 PM   #2
GrapefruiTgirl
Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
Have you tried the command 'lsusb' in a console? It may give you *some* of the information you want, though I am not sure if it will give you mount points. I haven't got any USB drives to try it on.
On the other hand, it doesnt look as though it gives the type of info you want.

Last edited by GrapefruiTgirl; 04-10-2007 at 04:42 PM.
 
Old 04-13-2007, 09:01 AM   #3
BotKeeper
LQ Newbie
 
Registered: Aug 2006
Posts: 17

Rep: Reputation: 0
USB (and SCSI) CDROMs are, for example, /dev/sr0. The file /proc/mounts list all mounted devices. So, you could find all mounted USB CDROMs via a command like MNT_CDS=$(awk '$1 ~ /\/dev\/sr[0-9]+$/ { print $2 }' < /proc/mounts).
 
  


Reply

Tags
device, mount, point, usb


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mount problem - device already mounted or mount point busy zahoo Linux - General 7 08-28-2009 05:02 PM
How to find the mount point for my cd-rw in cdrecord sirius57 Linux - Hardware 7 04-04-2006 06:17 PM
Where to find mount point for USB Removable device bobbelfield Mandriva 3 02-17-2006 10:37 PM
How do I map device serial number to its mount point directory? vagrawal Linux - Software 1 03-11-2004 12:25 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 09:40 PM.

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