Hi guys,
I've been developing a program that opens a pipe to a subprocess spawned with 'du' command. It builds a model of the file system using complex algorithms based on the list of files and directories combined with the size information retrieved by the du command.
During the test i noticed some inconsistencies with what the sizes of the file system the program models and the actual file system size. So took some time to figure out the reason behind it.
It turns out that if I sum up every item listed from 'du -a /target', the sum of the sizes of the files and directories are different from what 'du' command returns as total.
for example, the following if the output from a du command on a specific target:
Quote:
32 scabs/Archive.C
32 scabs/archive.conf
32 scabs/Archive.h
64 scabs/Archive_suse.o
32 scabs/Backup.C
32 scabs/backup.conf
32 scabs/Backup.h
128 scabs/Backup_suse.o
32 scabs/CheckFailedException.C
32 scabs/CheckFailedException.h
32 scabs/CheckFailedException_suse.o
32 scabs/CheckVisitor.C
32 scabs/CheckVisitor.h
192 scabs/CheckVisitor_suse.o
32 scabs/DumpFailedException.C
32 scabs/DumpFailedException.h
32 scabs/DumpFailedException_suse.o
32 scabs/PlanVisitor.h
32 scabs/DumpVisitor.C
32 scabs/DumpVisitor.h
256 scabs/DumpVisitor_suse.o
32 scabs/ErrVisitor.C
32 scabs/ErrVisitor.h
64 scabs/ErrVisitor_suse.o
32 scabs/mailSender.py
32 scabs/mailSender.pyc
32 scabs/MailVisitor.C
32 scabs/MailVisitor.h
64 scabs/MailVisitor_suse.o
32 scabs/main.C
64 scabs/main_suse.o
32 scabs/Makefile
32 scabs/Makefile.orig
32 scabs/Makefile.svn
32 scabs/PlanVisitor.C
256 scabs/PlanVisitor_suse.o
32 scabs/pre_split_archive.py
32 scabs/pre_split_backup.py
32 scabs/SCABS.C
32 scabs/SCABSException.C
32 scabs/SCABSException.h
32 scabs/SCABSException_suse.o
32 scabs/SCABS.h
160 scabs/SCABS_suse.o
32 scabs/split_archive.py
32 scabs/split.py
32 scabs/Tape.C
32 scabs/Tape.h
32 scabs/TapeOverFlowException.C
32 scabs/TapeOverFlowException.h
32 scabs/TapeOverFlowException_suse.o
128 scabs/Tape_suse.o
32 scabs/Tar.C
32 scabs/TarElem.C
32 scabs/TarElem.h
64 scabs/TarElem_suse.o
32 scabs/Tar.h
128 scabs/Tar_suse.o
32 scabs/Visitor.h
64 scabs/wxmac.icns
32 scabs/logs
3200 scabs
|
If I add all of the sizes that du listed before the grand total,
it comes out to 3168kb
but the du is claiming that the total is 3200kb.
Oddly enough, if I do 'ls -l' on the same target, it give me total size of 3168kb.
Can anyone explain what is happening here? I'm very confused
Any help or insight will be appreciated!
Thank you in advance.
--
Jin