Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

df strange behavior

0 views
Skip to first unread message

fnadeau

unread,
Aug 21, 2008, 9:15:49 AM8/21/08
to
Hi there,

Here is a copy of my terminal output:
$ df -h
Filesystem Size Used Avail
Capacity Mounted on
/dev/wd0a 78.5M 40.9M 33.7M
55% /
/dev/wd0g 30.0G 19.7G 8.8G
69% /home
/dev/wd0d 196M 46.0K 186M
0% /tmp
/dev/wd0e 5.9G 685M 4.9G
12% /usr
/dev/wd0f 492M 387M 80.0M
83% /var
172.16.0.50:/VOLUME1/PUB/ 1.4T 348G -1011G 25% /var/
www/doc

The number on the last line are correct except for the minus sign.
Anyone knows why?

Thanks

Boudewijn Dijkstra

unread,
Aug 22, 2008, 7:16:55 AM8/22/08
to
Op Thu, 21 Aug 2008 15:15:49 +0200 schreef fnadeau <fred....@gmail.com>:

Look at /usr/src/bin/df/df.c:
void
prthuman(struct statfs *sfsp, unsigned long used)
{
prthumanval((long long)sfsp->f_blocks * (long long)sfsp->f_bsize);
prthumanval((long long)used * (long long)sfsp->f_bsize);
prthumanval((long long)sfsp->f_bavail * (long long)sfsp->f_bsize);
}

Now look at /usr/include/sys/mount.h:
struct statfs {
u_int32_t f_flags;
int32_t f_bsize;
u_int32_t f_iosize;
u_int32_t f_blocks;
u_int32_t f_bfree;
int32_t f_bavail;
u_int32_t f_files;
u_int32_t f_ffree;
fsid_t f_fsid;
uid_t f_owner;
u_int32_t f_syncwrites;
u_int32_t f_asyncwrites;
u_int32_t f_ctime;
u_int32_t f_spare[3];
char f_fstypename[MFSNAMELEN];
char f_mntonname[MNAMELEN];
char f_mntfromname[MNAMELEN];
union mount_info mount_info;
};

Assuming that a filesystem block on 72.16.0.50:/VOLUME1/PUB/ is 512 bytes,
then:
f_blocks ~= 0xB3333333
f_bavail ~= 0xC0D00000

Which means that f_bavail is negative. It is signed, because the system
allocates an almost-overflow zone of (CMIIW) 10%. Also, the real disk
size is probably larger than 1.4T.

So, either make bigger blocks or modify the system to use a struct statfs
with 64-bit values.

/Boudewijn


--
Gemaakt met Opera's revolutionaire e-mailprogramma:
http://www.opera.com/mail/

Message has been deleted
0 new messages