-
df strange behavior
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
-
Re: df strange behavior
Op Thu, 21 Aug 2008 15:15:49 +0200 schreef fnadeau <fred.nadeau@gmail.com>:[color=blue]
> 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?[/color]
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:
[url]http://www.opera.com/mail/[/url]
-
Re: df strange behavior
Hi!
Boudewijn Dijkstra <boudewijn@indes.com> wrote:[color=blue]
>Op Thu, 21 Aug 2008 15:15:49 +0200 schreef fnadeau <fred.nadeau@gmail.com>:[color=green]
>> 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[/color][/color]
[color=blue]
>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);
>}[/color]
[color=blue]
>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;
>};[/color]
[color=blue]
>Assuming that a filesystem block on 72.16.0.50:/VOLUME1/PUB/ is 512 bytes,
>then:
>f_blocks ~= 0xB3333333
>f_bavail ~= 0xC0D00000[/color]
[color=blue]
>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.[/color]
[color=blue]
>So, either make bigger blocks or modify the system to use a struct statfs
>with 64-bit values.[/color]
No need to modify the system yourself. It *has* been modified
in-between. Either wait for the upcoming release or use -current
(snapshots).
[color=blue]
>/Boudewijn[/color]
Kind regards,
Hannah.