• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 350
  • Last Modified:

How can i get the filesystem information for linux ?

I would like to know the function for getting filesystem information of linux( the information of superblock and cylinder group, the size of
 free inodes and blocks, etc) through some function of c language.

Which function can I use ? and how can i use the funtions ?

waiting for kindly answer.

Thanks and Best Regards,

  • 2
1 Solution
bwleeulAuthor Commented:
Adjusted points from 50 to 100
Check out the *stat* system calls.. For eg., statfs, fstatfs, stat, lstat etc.
I believe these calls shoudl give you what you want.

Anand .K
bwleeulAuthor Commented:
thanks, anandk.

I had test the function, statfs.

struct statfs buf;
int ret;

ret = statfs("/dev/hda1", &buf);

The value of ret was always -1.

what's the problem ?

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now