Welcome to Linux Forums!

With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.

Linux Forum ArticlesLinux ForumsLinux Forum DownloadsLinux Hosts
Home|Register|FAQ|Member List|Calendar|Unanswered Posts|Forum Rules|Today's Posts|Advanced Search|
SEARCH FOR IN
Go Back   Linux Forums > GNU Linux Zone > Linux Applications
Reload this Page Du command inconsistency.. Or, is it?
Linux Forums
Linux Forums
Welcome To The Linux Forums!
Welcome to Linux Forums. We pride ourselves in being one of the largest Linux communities on the web, we encourage you to REGISTER on our forums and participate in the community. There are over 150,000 members ready to answer your questions. JOINING US today will allow you to make new posts, get support, send messages to other members and submit downloads to our downloads directory and many other great features!

Linux Applications I cant get "X" app to work... also discussion about linux programs.

Reply
 
Thread Tools Display Modes
Old 06-26-2008   #1 (permalink)
openuser
Just Joined!
 
Join Date: Mar 2007
Posts: 6
Question Du command inconsistency.. Or, is it?

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
__________________
openuser is offline   Reply With Quote
Old 06-26-2008   #2 (permalink)
openuser
Just Joined!
 
Join Date: Mar 2007
Posts: 6
Sorry guys, I posted this in SUSE section, and after I found out about this section, I moved it to here.
But while I was moving this, some lightning fast and very helpful member has already replied to the thread that I posted in the wrong section.

Quote:
Originally Posted by gogalthorp View Post
There is a difference in the size of a file and how much disk space that file consumes. How much space does a 1 byte file take up? Answer: depends on the block size of drive. So if you have a 1024 byte block a 1 byte long file will take up 1024 bytes of disk space. So it all depends on what you are measuring file length or disk space used.
__________________
openuser is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT. The time now is 03:17 PM.




© 2000 - 2008 - All Rights Reserved - Property of  MAS Media

Content Relevant URLs by vBSEO 3.0.0