LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Detect storage device by checking mounted file system to Linux (https://www.linuxquestions.org/questions/programming-9/detect-storage-device-by-checking-mounted-file-system-to-linux-410780/)

syseeker 02-02-2006 04:17 AM

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

m2acis 02-02-2006 04:30 AM

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

primo 02-02-2006 11:48 AM

See getmntent(3) You may use it on /etc/mtab (and perhaps /proc/mounts too)

ta0kira 02-02-2006 01:58 PM

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

syseeker 02-06-2006 10:14 AM

Thank you! :)


All times are GMT -5. The time now is 06:06 AM.