Thanks Paul. Regards from VJ ----- Original Message ----- From: "Paul Howarth" <paul@xxxxxxxxxxxx> To: "For users of Fedora Core releases" <fedora-list@xxxxxxxxxx> Sent: Wednesday, November 17, 2004 11:53 AM Subject: Re: Can anybody explain the difference in the disk usage of a directory by du and the one calculated by adding up the size of every file? > VJ wrote: > > Can anybody explain the difference in the disk usage of a directory by > > du and the one calculated by adding up the size of every file? > > > > [root@dxr tmp]# echo "(0 `find /home/vj/ -name \* -printf "+%s "`) / 1024" | > > bc > > 29091 > > > > [root@dxr tmp]# du -s /home/vj/ > > 31883 /home/vj/ > > > > Thinking du might be using 1000 as 1Kb rather than 1024, following result is > > > > [root@dxr tmp]# echo "(0 `find /home/vj/ -name \* -printf "+%s "`) / 1000" | > > bc > > 29790 > > Disk space is allocated in blocks (typically 1K) so you need to round up the > size of each file to the next round 1K to get the actual size. > > This is not taking into account "sparse" files, which are written by "seeking" > to some point in a file (say 1M) and then writing some data (say 1K). The size > of such a file reported by ls will be just over 1M but it will only take up 1K > of disk space. You're unlikely to have a file like that in your home directory > though. > > Paul. > > -- > fedora-list mailing list > fedora-list@xxxxxxxxxx > To unsubscribe: http://www.redhat.com/mailman/listinfo/fedora-list >