LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 09-04-2009, 06:35 AM   #1
gargamel
Senior Member
 
Registered: May 2003
Distribution: Slackware, OpenSuSE
Posts: 1,839

Rep: Reputation: 242Reputation: 242Reputation: 242
KMail disk usage: confusing figures from du


Dear all,

I just got confused bei the figures I received from du -s, when I tried to find out, where the majority of my email messages is actually stored. I am using KMail in KDE 4.2.4. So I did:

Code:
# cd /home/<myuser>/.kde/share/apps# du -s -h kmail
2.1G    kmail
and

Code:
# cd kmail# du -s -h *
16K     autosave
4.0K    autosave.index.ids
4.0K    dimap
340K    imap
4.0K    lock
2.1G    mail
4.0K    search
4.0K    unfiltered.1079850475
[...]
and then

Code:
# cd mail
root@orion10:/home/<myuser>/.kde/share/apps/kmail/mail# du -s -h *
16K     Aktuell
16K     Archiv
8.0K    SP0axA2dAcU
8.0K    SP0axa00429
8.0K    SP0axeyQHCn
16K     drafts
93M     inbox
16K     outbox
75M     sent-mail
16K     templates
36K     trash
Now, this doesn't sum up to 2.1 GBytes, obviously. Puzzled by the different figures I did:

Code:
# du -s -m *
1       Aktuell
1       Archiv
1       SP0axA2dAcU
1       SP0axa00429
1       SP0axeyQHCn
1       drafts
93      inbox
1       outbox
75      sent-mail
1       templates
1       trash
According to this, and du -s -m executed from inside inbox, this folder should contain 93 MB of email messages. But ls has its own opinion on that:

Code:
# ls -lh
total 196K
drwx------ 2 myuser users 184K 2009-09-04 23:58 cur
drwx------ 2 myuser users 4.0K 2008-05-22 22:48 new
drwx------ 2 myuser users 4.0K 2009-09-04 22:04 tmp
Can anyone explain this inconsistency in the figures?

BTW, 2.1G is the correct value. Much of it are archived emails that are displayed in the GUI under folder "Archive". I see a folder with this name in ~/.kde/share/apps, but it seems to be empty.

I am puzzled now, and would appreciate, if someone explain this a little.

Thanks in advance!

gargamel

Last edited by gargamel; 09-04-2009 at 07:10 AM.
 
Old 09-04-2009, 06:49 AM   #2
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
Lets start with the ls output. Think about what directory are for linux. They are just plain files with the name and inode of the files that it contains. Typical block size of an ext3 ist 4k. So normaly every directory in linux will show up as a 4k big file. The directory cur sure contains a whole lot of files at least this would explain the size.

Now we come to the mysteries
Code:
root@orion10:/home/alex/.kde/share/apps/kmail/mail# du -s -h *
I would bet high that there are hidden files. And * as a shell globing symbol just does not match . hidden files.

That would be my explanation...
 
Old 09-04-2009, 07:06 AM   #3
gargamel
Senior Member
 
Registered: May 2003
Distribution: Slackware, OpenSuSE
Posts: 1,839

Original Poster
Rep: Reputation: 242Reputation: 242Reputation: 242
Ouch, that was too simple, and you won your bet. Thanks a lot.
In fact, the empty folder "Archive" is of now use, because the folders top-level folders shown in the GUI all have the file name extension .directory. So I found my email messages in .Archiv.directory, not in Archiv.

However, one mystery remains. I understand your explanation regarding the output of ls, and I believe you are correct. But why, then, do I get this:
Code:
/home/<myuser>/.kde/share/apps/kmail/mail/.Archiv.directory/2002# ls -lh
total 84K
drwxr-xr-x 2 myuser users  72K 2009-08-31 02:43 cur
drwxr-xr-x 2 myuser users 4.0K 2008-05-22 22:54 new
drwxr-xr-x 2 myuser users 4.0K 2009-08-30 23:08 tmp
According to your explanation, which resembles exactly what I was thinking before I saw the above, the size of cur should be 4.0K, here, too. Right?

But it's 72K... How does this fit into the picture?

Thanks again!

gargamel

Last edited by gargamel; 09-04-2009 at 07:10 AM.
 
Old 09-04-2009, 07:57 AM   #4
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
Quote:
Originally Posted by gargamel View Post
But it's 72K... How does this fit into the picture?
I did not find any documents about ext3 internals, but recalling from memory the directory is just a simple file with the names of the files that are in the directory.
So the more files you have in a directory the bigger the file resembling the directory is.
Do a ls and you should see definetly more files inside the cur directory. I tried with a simple
Code:
ls | wc
to get some numbers but this did not realy made up.
Maybe I'll find a good doc that explain the directory file a bit better. But just to thing of all the things that could/should be inside it would be
-name
-inode
-permission
-cdate, mdate, ...

Can't prove it right now but this all makes sense to me

Cheers Zhjim
 
Old 09-04-2009, 09:57 AM   #5
gargamel
Senior Member
 
Registered: May 2003
Distribution: Slackware, OpenSuSE
Posts: 1,839

Original Poster
Rep: Reputation: 242Reputation: 242Reputation: 242
Thanks for your patience, that seems to explain it. You are right all along: In cur there are over 2000 files, while in new there are 2 and tmp is empty.

Although I actually knew about the "everything is file" principle and what directories actually are in *nix, but I for some reason I never noticed what this means with regard to utilities like du and ls.

Thanks a lot!

(BTW, no need to do any further research; I am on ext4, anyway).

gargamel
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
disk usage -du disruptive Linux - Server 6 11-28-2007 09:46 AM
disk usage ?? sachinh Linux - General 3 11-16-2007 01:03 PM
disk usage? crofty13 Linux - Software 1 10-18-2007 06:42 AM
disk usage.... culin Programming 8 12-20-2006 07:58 AM
101% disk usage on an empty disk tsiuser Linux - Software 3 01-28-2004 06:24 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 11:26 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration