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.
Write an article for LinuxForums Today! Win Great Prizes!
Find the answer to your Linux question:
New to Linux Forums? Register here for free!
    Linux Forums > GNU Linux Zone > Misc > du - df reporting ...

Forgot Password?
 Misc   Any questions or Linux discussion that does not fit in any of the other technical areas.

Site Navigation
Linux Articles
Linux Forums
Linux Downloads
Linux Hosting
Free Magazines
Job Board
IRC Chat
RSS Feeds
Linux Forum Topics
Linux Forums
Your Distro
Linux Resources
GNU Linux Zone
The Community
Reply
 
Thread Tools Display Modes
Old 07-01-2005   #1 (permalink)
Linux Newbie
 
twoHats's Avatar
 
Join Date: Jan 2005
Location: NH, USA
Posts: 200
du - df reporting ...

Ouch - that hurt - I had done this entire post, got a phoine call , when i came back i had to log in and lost the whole thing!

Here goes again:

with df i get the following:

[root@GoldenFalcon etc]# df -h /home/tom/music
Filesystem Size Used Avail Use% Mounted on
/dev/hdb1 56G 1.6G 51G 4% /home/tom/music

with du i get:
[root@GoldenFalcon etc]# du -hcs /home/tom/music
36G /home/tom/music
36G total

This (36G used) is correct - the files and file system are all usable - just not reporting correctly in df - which is what most of the GUI disk stat tools use.

Any ideas?

Thanks
__________________
- Clouds don't crash - Bertrand Meyer

registered Linux user 393557

finally - hw to brag about - but next year it will look pitifully quaint:
Athlon64 X2 3800 - 1G PC3200 - 250G SATA - ati radeon x300
circa 2006
twoHats is offline  



Reply With Quote
Old 07-02-2005   #2 (permalink)
Linux Engineer
 
Join Date: Apr 2005
Location: Buenos Aires, Argentina
Posts: 908
Well, look what I get.
Code:
serz@insitt:~$ du -hs /usr/src
301M    /usr/src
serz@insitt:~$ df -h /usr/src
Filesystem            Size  Used Avail Use% Mounted on
/dev/hda1             4.0G  1.3G  2.8G  31% /
As you can see, I get no information giving /usr/src as an argument to df.. strange, the manual says that it can do that.

I just use df to see the filesystem usage in general... for files I just use du.
__________________
serzsite.com.ar
"All the drugs in this world won\'t save you from yourself"
serz is offline   Reply With Quote
Old 07-02-2005   #3 (permalink)
Linux Newbie
 
twoHats's Avatar
 
Join Date: Jan 2005
Location: NH, USA
Posts: 200
Quote:
Originally Posted by serz
I just use df to see the filesystem usage in general... for files I just use du.
I guess i should have mentioned that a HD partition is mounted at music.

I work at least 50% of the time in GUI - the tools there worked before i changed my HD - they don't now.

I am trying to find out why.


Have fun -
__________________
- Clouds don't crash - Bertrand Meyer

registered Linux user 393557

finally - hw to brag about - but next year it will look pitifully quaint:
Athlon64 X2 3800 - 1G PC3200 - 250G SATA - ati radeon x300
circa 2006
twoHats is offline   Reply With Quote
Old 07-02-2005   #4 (permalink)
Linux Guru
 
Join Date: Oct 2001
Location: Täby, Sweden
Posts: 7,578
It's quite simple really: du and df are two quite different programs, and as such they do different things.

du collects recursive disk usage on a certain directory, and therefore gives the result you expect.

df, however, only gives information an entire filesystems. It doesn't care the slightest about certain subdirectories inside a filesystem. In more technical terms, df is just a front-end to the statfs syscall.

Quote:
Originally Posted by The manpage for df
With no arguments, df reports the space used and available on all cur-
rently mounted filesystems (of all types). Otherwise, df reports on
the filesystem containing each argument file.
As you can see from that, if you call df with a directory as the argument, it will report information about the filesystem that the given directory resides on, not about the directory itself.
Dolda2000 is offline   Reply With Quote
Old 07-02-2005   #5 (permalink)
Linux Newbie
 
twoHats's Avatar
 
Join Date: Jan 2005
Location: NH, USA
Posts: 200
Thanks

Hi Dolda2000 - I understand what you are saying - and perfectly agree with you - I am simply *not* explaining the problem correctly:

1. The "dir" i am using df on is a mount point for a file system occupying hdb1

2. The mounted partition is around 55G

3. The mounted partiton contains around 36G of data.

4. I discovered this problem by looking at KDiskFree, which tells me that:
hdb1 mounted at /home/tom/music type ext2 is 55G in size and has 50.2G free

5. only then didi i jump to CL and try df and du trying to figure out why the bad reporting on KDiskFree.

you have seen my results - i hope you understand my concern! i have about 33G of data not being reported by these tools. The data is certainly there I have been listening to the music! I assume (perhaps stupidly) that KDiskFree (like most other GUI tools) used the underlying
CL tools to get thier data.

Anyway here is df with no params - the drive in question is hdb1
Code:
[root@GoldenFalcon etc]# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/hda1             12096724   5713032   5769208  50% /
none                    256948         0    256948   0% /dev/shm
/dev/hda2             11345628   1696540   9072760  16% /mnt/Berry
/dev/hda5              6893064   1230436   5312476  19% /mnt/Woody
/dev/hda6             42599672  26160720  14275000  65% /Data
/dev/hdb1             57674192   2066096  52678412   4% /home/tom/music
If i misundersatnd the tool usage - I *do* understand the reporting which is not correct. I am just trying to find out what i need to do to correct it.

Thanks again -
__________________
- Clouds don't crash - Bertrand Meyer

registered Linux user 393557

finally - hw to brag about - but next year it will look pitifully quaint:
Athlon64 X2 3800 - 1G PC3200 - 250G SATA - ati radeon x300
circa 2006
twoHats is offline   Reply With Quote
Old 07-02-2005   #6 (permalink)
Linux Engineer
 
Join Date: Apr 2005
Location: Buenos Aires, Argentina
Posts: 908
Quote:
Originally Posted by Dolda2000
Quote:
Originally Posted by The manpage for df
With no arguments, df reports the space used and available on all cur-
rently mounted filesystems (of all types). Otherwise, df reports on
the filesystem containing each argument file.
As you can see from that, if you call df with a directory as the argument, it will report information about the filesystem that the given directory resides on, not about the directory itself.
That makes sense now. Guess I didn't read that part very well..
__________________
serzsite.com.ar
"All the drugs in this world won\'t save you from yourself"
serz is offline   Reply With Quote
Old 07-02-2005   #7 (permalink)
Linux Guru
 
Join Date: Oct 2001
Location: Täby, Sweden
Posts: 7,578
I see now, twoHats. Sorry, it seems I missed that in your first post (after all, it was obvious in the df command output).

That makes it all the more stranger, of course.

The only obvious explanation I can think of is this: Did you mean that it really is ext2, and not ext3? If it is ext2, could it be you've shut down the system without umounting /home/tom/music? In that case, it may make sense. I believe that ext2 caches the usage data in the superblock, and without proper umounting, it may have become incoherent. Try fsck'ing that filesystem. I'd also recommend you convert it to ext3 instead.
Dolda2000 is offline   Reply With Quote
Old 07-03-2005   #8 (permalink)
Linux Newbie
 
twoHats's Avatar
 
Join Date: Jan 2005
Location: NH, USA
Posts: 200
Thanks!

Hey Dolda2000 - Thanks!! The fsck was what was needed.

I didn't see it anywhere, but i seem to remember that fsck should not be done on a mounted disk. Is that right or just a bad dream i had once ?

Again thanks for the help!
__________________
- Clouds don't crash - Bertrand Meyer

registered Linux user 393557

finally - hw to brag about - but next year it will look pitifully quaint:
Athlon64 X2 3800 - 1G PC3200 - 250G SATA - ati radeon x300
circa 2006
twoHats is offline   Reply With Quote
Old 07-03-2005   #9 (permalink)
Linux Guru
 
Join Date: Oct 2001
Location: Täby, Sweden
Posts: 7,578
Quote:
Originally Posted by twoHats
I didn't see it anywhere, but i seem to remember that fsck should not be done on a mounted disk. Is that right or just a bad dream i had once ?
That's correct; never fsck a mounted disk (as long as it isn't mounted read-only). Since the kernel filesystem drivers may keep a lot of info in internal data structures that aren't flushed to block device buffers, fsck'ing a mounted filesystem may and will most likely make the filesystem driver's data structures incoherent with the disk data, which most likely results in heavy corruption.

Of course, fsck'ing a filesystem that is mounted read-only shouldn't be a worry.

Also, as I said, you should convert it to ext3. It's really simple.
Dolda2000 is offline   Reply With Quote
Old 07-03-2005   #10 (permalink)
Linux Guru
 
budman7's Avatar
 
Join Date: Oct 2004
Location: Knee deep in Grand Rapids, Michigan
Posts: 3,242
I wasn't aware that you could fsck a mounted filesystem.
When I was having problems with a Gentoo install, I was told to run fsck, when I did try, it wouldn't let me until I umounted it.
__________________
Go RedWings
How to know if you are a geek.
when you respond to "get a life!" with "what's the URL?"
- Birger

New users read The FAQ
budman7 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

Free Magazines
Run Your Own Web Server Using Linux & Apache - Free 191 Page Preview
Learn about everything you'll need to build and maintain your Linux servers, and to deploy Web applications to them.
subscribe
Open Source Security Myths Dispelled
Dispel the five major myths surrounding Open Source Security and gain the tools necessary to make a truly informed decision for your IT organization
subscribe
InformationWeek
InformationWeek is the only newsweekly you'll need to stay on top of the latest developments in information technology.
subscribe



All times are GMT. The time now is 02:43 PM.






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

Content Relevant URLs by vBSEO 3.3.1