Reading Partition Space

Steve Jardine sjardine at acm.org
Tue May 6 21:58:50 PDT 2008


Actually, if anyone else is interested, you can use stat -f to get how much space is available on a partition. The only thing one must be careful of is the block size. Of course, I have tested it for Ext2/3 - but it seems to work as advertised..

  YMMV..

Thanks all.. Great as usual!


--S

P.S. No ignorance involved, misplaced brain today...

On Tue, 6 May 2008 22:00:31 -0400
Tim Wunder <tim at thewunders.org> wrote:

> On Tuesday 06 May 2008 08:29:24 pm Steve Jardine wrote:
> > All,
> >
> >     Does anyone have a good way that I can in C code get the remaining
> > space available in a partition? I do not have du, or df available to me.
> > (Embedded stuff - was stripped out).
> >
> >
> 
> Pardon my ignorance, but aren't the gnu tools written in C? Shouldn't there be 
> a source file for du or df that you could look at?
> 
> Tim
> 
> -- 
> Fedora Core release 6 (Zod), Linux 2.6.22.14-72.fc6
> KDE: 3.5.8-1 Fedora
>  21:55:01 up 12 days, 15:27,  3 users,  load average: 0.29, 0.24, 0.18
> "It's what you learn after you know it all that counts" John Wooden
> 



More information about the Linux-users mailing list