LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
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 02-02-2006, 05:17 AM   #1
syseeker
Member
 
Registered: Aug 2003
Posts: 66

Rep: Reputation: 15
Detect storage device by checking mounted file system to Linux


Hi,

Is there any API to detect file system information in a host. I mean, if a host contains hard disk, USB pen drive and a SD Card connected via PCMCIA slot, is it possible to check if file systems of these storage devices are mounted to the OS?

statfs or fstatfs requires file name or file descriptor as pre-requisite, what about if we do not know any file in these devices, but would like to check what kind of storage device is attached to the host by checking file system mounted to it
 
Old 02-02-2006, 05:30 AM   #2
m2acis
LQ Newbie
 
Registered: Jan 2006
Location: Latvia, Riga
Distribution: Slackware, Ubuntu
Posts: 18

Rep: Reputation: 0
If I get you right, then ...
Code:
mount
without parameters will give you information about mounted devices and filesystems
Code:
df -h
will give you info about sizes of mounted devices in human readable (-h) format (that is with appended M for Megabytes and G for Gigabytes
 
Old 02-02-2006, 12:48 PM   #3
primo
Member
 
Registered: Jun 2005
Posts: 542

Rep: Reputation: 34
See getmntent(3) You may use it on /etc/mtab (and perhaps /proc/mounts too)
 
Old 02-02-2006, 02:58 PM   #4
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
You can find a file system by label or uuid with findfs. It isn't always accurate though, and I'm not sure how it works over a network.
ta0kira
 
Old 02-06-2006, 11:14 AM   #5
syseeker
Member
 
Registered: Aug 2003
Posts: 66

Original Poster
Rep: Reputation: 15
Thank you!
 
  


Reply


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
How To detect USB drive device file kr123 Programming 0 12-08-2005 01:01 AM
Assign one USB-storage device to one device file Misel Linux - Hardware 1 08-28-2004 04:52 AM
use of proc file system in linux device driver amitchakote Linux - Software 0 06-20-2004 12:27 PM
Checking if a device is mounted using a script thar Linux - Software 2 02-22-2004 04:17 PM
USB mass storage device file system shariqali Linux - Hardware 1 02-19-2004 11:31 AM


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