LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-02-2007, 01:12 PM   #1
Andy@DP
Member
 
Registered: Aug 2003
Posts: 208

Rep: Reputation: 30
Confused by df/du results


Hi,

I've got a 2Gb hda which has debian installed and a 160Gb hdb, split roughly into a 20Gb partition and a 140Gb partition. Doing a df when mounted produces:
Code:
Filesystem            Size  Used Avail Use% Mounted on
/dev/hda1             1.9G  246M  1.5G  14% /
tmpfs                 126M     0  126M   0% /lib/init/rw
udev                   10M   64K   10M   1% /dev
tmpfs                 126M     0  126M   0% /dev/shm
/dev/hdb2             129G  188M  122G   1% /mnt/data
/dev/hdb1              19G  173M   18G   1% /mnt/http
Doing a du of hdb1 and 2 produces:
Code:
16K	/mnt/data/lost+found
12K	/mnt/data/files
32K	/mnt/data
4.0K	/mnt/http/www
16K	/mnt/http/lost+found
24K	/mnt/http
So where has the extra 188Mb and 173Mb of used space come from??? The partitions are both formatted as ext3 AFAIK.
 
Old 07-02-2007, 08:26 PM   #2
ak_random
Member
 
Registered: Jun 2007
Location: Silicon Valley, CA
Distribution: Xubuntu
Posts: 83

Rep: Reputation: 15
What's the output of "du -ks /mnt/data /mnt/http" ?
 
Old 07-02-2007, 09:19 PM   #3
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
fdisk: total size of disk, including all partitions and empty space
df: capacity and utilization of mounted partition(s)
du: space used by file(s)
 
Old 07-03-2007, 01:03 AM   #4
Andy@DP
Member
 
Registered: Aug 2003
Posts: 208

Original Poster
Rep: Reputation: 30
ak_random - the output is:
Code:
24	/mnt/data
24	/mnt/http
cheers!

EDIT: both dirs are empty now, thats why data has been reduced by 8K...
 
Old 07-03-2007, 01:01 PM   #5
ak_random
Member
 
Registered: Jun 2007
Location: Silicon Valley, CA
Distribution: Xubuntu
Posts: 83

Rep: Reputation: 15
Quote:
Originally Posted by Andy@DP
EDIT: both dirs are empty now, thats why data has been reduced by 8K...
If they're empty, that would explain the discrepency between your original df output and the du output.
 
Old 07-03-2007, 01:33 PM   #6
Andy@DP
Member
 
Registered: Aug 2003
Posts: 208

Original Poster
Rep: Reputation: 30
No, you've got me wrong.

I only took out an 8K text file out of /mnt/data/files. So my df output still shows 180Mb approx used on each partition when df shows 24K per partition used.
 
Old 07-03-2007, 01:43 PM   #7
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
df gives you the disk space used by the partition, and how much of that disk space is actually used.

du gives you the space used by files and directories.

Here is the output on my system:
Code:
sh-3.1$ df /dev/sda1
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda1             73917408  10984996  59177624  16% /
sh-3.1$ du /
<snipped>
11765634
The difference between du and df(Used) is minor and may have to do with how the filesystem works. (For me, close enough)
 
Old 07-03-2007, 01:46 PM   #8
Andy@DP
Member
 
Registered: Aug 2003
Posts: 208

Original Poster
Rep: Reputation: 30
OK, thanks for the info. I see you data is pretty close but 24K to 180Mb is a little on the large side, don't you think?

EDIT: my df/du results:
Code:
df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/hdb1             19236308    176204  18082952   1% /mnt/http

du
24	/mnt/http

Last edited by Andy@DP; 07-03-2007 at 01:49 PM.
 
Old 07-03-2007, 02:09 PM   #9
ak_random
Member
 
Registered: Jun 2007
Location: Silicon Valley, CA
Distribution: Xubuntu
Posts: 83

Rep: Reputation: 15
Quote:
Originally Posted by Andy@DP
OK, thanks for the info. I see you data is pretty close but 24K to 180Mb is a little on the large side, don't you think?
Possibly, but this is likely to be space used by file system metadata. Right now, 180MB is a hair under 1% of the total file system size. This compares favorably with pixellany's info: he has about a 780MB difference between du and df, and this amounts to a hair over 1% of the total file system size.

Every file system has metadata which takes space. Some use this space even on a newly created file system, while others use this space after you've consumed space (and even free it). I don't know the details of ext2/ext3, but I suspect this is the likely source of the disk usage.
 
Old 07-03-2007, 02:17 PM   #10
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Your data shows 19M 1k blocks total = ~19GB

Used = 176K 1K blocks = ~176MB

for du, did you enter "du /mnt/http"?
 
Old 07-03-2007, 02:28 PM   #11
Andy@DP
Member
 
Registered: Aug 2003
Posts: 208

Original Poster
Rep: Reputation: 30
Yeah I used du -s /mnt/http.

Where has the 176Mb come from, there is nothing on that drive apart from an empty folder called www and du says there is 24K used space.

EDIT: Just did a wee check and the partition is 176MB as ext3 and 44Mb ext2, so I know where 132Mb has gone - it's the journaling system. So 44Mb doesn't seem that bad.

Is it wise to keep both as ext3 or is ext2 just as good, with weekly backups?

Last edited by Andy@DP; 07-03-2007 at 02:39 PM.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
chkrootkit results rdwinders Linux - Newbie 4 01-22-2007 03:10 PM
Help with DD and emailing the results booyaadewd Linux - Newbie 6 09-22-2006 03:48 PM
A possible bug - please try for results aikidoist72 Ubuntu 2 04-11-2005 06:53 PM
Bonnie++ results jpc82 Linux - Software 0 04-17-2004 06:39 AM
suse8 Results ! ! sapilas Linux - Distributions 11 05-14-2002 02:38 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:15 PM.

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