du vs ls vs df....odd results

Luca Ferrari fluca1978 at infinito.it
Tue Jul 31 07:18:27 UTC 2007


On Monday 30 July 2007 Luca Ferrari's cat, walking on the keyboard, wrote:
> Hi all,
> anybody can explain me what is going on here?
>
> [root at server 34]# pwd
> /vol1/sys/34
> [root at server 34]# du -hs
> 131G    .
> [root at server 34]# df -H
> Filesystem            Size  Used Avail Use% Mounted on
> /dev/md2              4.5G  2.3G  2.0G  53% /
> /dev/md4               64M  6.1M   54M  11% /boot
> none                  131M     0  130M   0% /dev/shm
> /dev/md0              6.5G  3.6G  2.6G  58% /vol1
> /dev/md1              6.5G  5.2G  1.0G  84% /vol2
> [root at server 34]# du -hs * | grep G
> 131G    stamagaz.dat
> [root at server 34]# ls -lh stamagaz.dat
> -rwxrwxrwx    1 nobody   users        1.0k lug 30 09:06 stamagaz.dat
> [root at server 34]#
>
> The /vol1/sys/34 directory seems to be of 131GB due to the stamagaz.dat
> file, that seems to be only 1 k to ls and df reports that the whole
> partition is about 3,6 GB.....what's wrong here?
>

I guess something was caching the file size. I've deleted the file, substitute 
it with a copy and now du and ls are coherent. But it was a strange behaviour 
and I'm curious to understand why.....any idea?

Luca






More information about the ubuntu-users mailing list