LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 10-27-2006, 01:05 PM   #1
ftenario
Member
 
Registered: Jul 2003
Location: Camarillo, CA
Distribution: Debian
Posts: 48

Rep: Reputation: 15
Disk Usage Statistics


Hello,

How do you get the disk usage statistics just like the output of "df"?
I want to include this is my application. I was able to extract other information like cpu, memory, load average from the /proc file.

Any ideas?

thanks
ferd
 
Old 10-27-2006, 01:22 PM   #2
krizzz
Member
 
Registered: Oct 2004
Location: NY
Distribution: Slackware
Posts: 200

Rep: Reputation: 30
Hi,
Kind of quick solution would be to just call df from your program and capture the output ...
 
Old 10-27-2006, 01:28 PM   #3
ftenario
Member
 
Registered: Jul 2003
Location: Camarillo, CA
Distribution: Debian
Posts: 48

Original Poster
Rep: Reputation: 15
Thanks. I'm kind of thinking of that solution but would like to try another solution first. Perhaps a system call?

any other?
 
Old 10-27-2006, 01:33 PM   #4
krizzz
Member
 
Registered: Oct 2004
Location: NY
Distribution: Slackware
Posts: 200

Rep: Reputation: 30
Have a look at busybox's minimalistic implementation of df at www.busybox.net
 
Old 10-27-2006, 01:35 PM   #5
xhi
Senior Member
 
Registered: Mar 2005
Location: USA::Pennsylvania
Distribution: Slackware
Posts: 1,065

Rep: Reputation: 45
what does df read from? probably /proc/diskstats ? you could parse from there
 
Old 10-27-2006, 01:39 PM   #6
krizzz
Member
 
Registered: Oct 2004
Location: NY
Distribution: Slackware
Posts: 200

Rep: Reputation: 30
There's also something like statfs, try man statfs.
 
Old 10-27-2006, 02:02 PM   #7
ftenario
Member
 
Registered: Jul 2003
Location: Camarillo, CA
Distribution: Debian
Posts: 48

Original Poster
Rep: Reputation: 15
thank you for your replies. statvfs or statfs will do
 
Old 10-30-2006, 12:33 PM   #8
ftenario
Member
 
Registered: Jul 2003
Location: Camarillo, CA
Distribution: Debian
Posts: 48

Original Poster
Rep: Reputation: 15
never mind. thanks.

Last edited by ftenario; 10-30-2006 at 01:34 PM.
 
  


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
cpu usage statistics ryanmhubbard Linux - General 4 08-17-2006 10:03 AM
MRTG IP Wise Bandwidth usage statistics jayakrishnan Linux - Networking 4 02-02-2006 12:09 AM
Generate (vs)ftp usage statistics ottow Linux - Software 0 03-23-2005 03:30 PM
Linix Distribution Usage Statistics andocser Linux - Distributions 2 02-27-2005 09:57 AM
website usage statistics anneliesje Linux - Networking 2 11-09-2004 08:11 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

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

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