This discussion is archived
12 Replies Latest reply: Dec 31, 2012 7:41 AM by BryanWood RSS

df -h,du -sh showing different result

Sivamani Newbie
Currently Being Moderated
Hi,

OS - RHEL 5.8

when i check for the space usage in my oracle home directory

du -sh /home/oratest

showing 36GB

and when i check each directory space usage using du -sh command the total is not equal to the 36 GB.

But when i check in GUI (rightclick -> properties) it showing only 255 MB usage.

Can anyone please explain why its showing different result.


FYI - Oracle database is sitting on this server

Thanks
  • 1. Re: df -h,du -sh showing different result
    Dude! Guru
    Currently Being Moderated
    Difficult to judge without actually seeing what you are doing or getting more details. Perhaps you do not have permissions in your GUI desktop to see all the items in that directory.
  • 2. Re: df -h,du -sh showing different result
    Sivamani Newbie
    Currently Being Moderated
    [root@xxxxxxxxxx oratest]# pwd
    /home/oratest

    [root@xxxxxxxxx oratest]# ls
    cloning_hr_scramble cmclean.sql Mail oradiag_oratest TEST_1335979.zip test.sql.backup
    cloning_hr_scramble.zip Desktop old patch test.sql

    [root@xxxxxxxxxx oratest]# du -sh
    36G .


    [root@xxxxxxxxx oratest]# du -sh cloning_hr_scramble
    36K cloning_hr_scramble

    [root@xxxxxxxxx oratest]# du -sh cmclean.sql
    8.0K cmclean.sql

    [root@xxxxxxxxx oratest]# du -sh Mail
    4.0K Mail

    [root@xxxxxxxxx oratest]# du -sh oradiag_oratest
    748K oradiag_oratest

    [root@xxxxxxxxx oratest]# du -sh TEST_1335979.zip
    6.2M TEST_1335979.zip

    [root@xxxxxxxxx oratest]# du -sh test.sql.backup
    16K test.sql.backup

    [root@xxxxxxxxx oratest]# du -sh cloning_hr_scramble.zip
    8.0K cloning_hr_scramble.zip

    [root@xxxxxxxxx oratest]# du -sh Desktop
    4.0K Desktop

    [root@xxxxxxxxx oratest]# du -sh old
    86M old

    [root@xxxxxxxxx oratest]# du -sh patch
    155M patch

    [root@xxxxxxxxx oratest]# du -sh test.sql
    4.0K test.sql


    And in GUI i m checking the properties details of /home/oratest as a root user

    the size is 255 MB

    Edited by: Sivamani on Dec 13, 2012 5:20 PM
  • 3. Re: df -h,du -sh showing different result
    Dude! Guru
    Currently Being Moderated
    Perhaps you have a hidden file or directory in the oratest directory that starts with a dot (.).

    What is the output of the "ls -la" command.
  • 4. Re: df -h,du -sh showing different result
    Sivamani Newbie
    Currently Being Moderated
    [oratest@xxxxxxxxx ~]$ ls -alh
    total 6.4M
    drwx------ 23 oratest users 4.0K Dec 13 18:11 .
    drwxr-xr-x 5 root root 4.0K Sep 28 12:11 ..
    -rw------- 1 oratest dba 10K Dec 14 13:08 .bash_history
    -rw-r--r-- 1 oratest users 33 Jul 15 2008 .bash_logout
    -rw-r--r-- 1 oratest users 229 Sep 14 14:48 .bash_profile
    -rw-r--r-- 1 oratest users 124 Jul 15 2008 .bashrc
    drwxr-xr-x 2 oratest dba 4.0K Jan 6 2012 cloning_hr_scramble
    -rw-r--r-- 1 oratest dba 6.7K Jan 6 2012 cloning_hr_scramble.zip
    -rw-r--r-- 1 oratest dba 4.6K Jun 27 11:31 cmclean.sql
    drwx------ 3 oratest dba 4.0K May 5 2012 .dbus
    drwxr-xr-x 2 oratest dba 4.0K May 5 2012 Desktop
    drwxr-x--- 2 oratest dba 4.0K May 5 2012 .eggcups
    -rw-r--r-- 1 oratest users 515 Dec 10 2007 .emacs
    drwx------ 4 oratest dba 4.0K Dec 11 18:36 .gconf
    drwx------ 2 oratest dba 4.0K Dec 11 21:52 .gconfd
    drwxr-xr-x 3 oratest dba 4.0K May 5 2012 .gnome
    drwx------ 6 oratest dba 4.0K May 5 2012 .gnome2
    drwx------ 2 oratest dba 4.0K May 5 2012 .gnome2_private
    drwxr-xr-x 2 oratest dba 4.0K May 5 2012 .gstreamer-0.10
    -rw-r--r-- 1 oratest dba 89 May 5 2012 .gtkrc-1.2-gnome2
    -rw------- 1 oratest dba 1.6K Dec 11 18:36 .ICEauthority
    -rw------- 1 oratest dba 35 Aug 7 16:55 .lesshst
    drwx------ 2 oratest dba 4.0K Sep 28 10:44 Mail
    drwx------ 3 oratest dba 4.0K May 5 2012 .metacity
    drwxr-xr-x 5 oratest users 4.0K Oct 3 17:47 .mozilla
    drwxr-xr-x 3 oratest dba 4.0K May 5 2012 .nautilus
    drwxr-xr-x 7 oratest dba 4.0K Nov 14 11:02 old
    drwxr-xr-x 3 oratest dba 4.0K Dec 21 2011 oradiag_oratest
    drwxr-xr-x 6 oratest dba 4.0K Nov 20 16:04 patch
    -rw-r--r-- 1 oratest dba 691 Oct 25 13:30 .recently-used.xbel
    drwxr-xr-x 3 oratest dba 4.0K May 5 2012 .redhat
    drwx------ 2 oratest dba 4.0K Dec 26 2011 .ssh
    -rw-r--r-- 1 oratest dba 6.2M Jan 3 2012 TEST_1335979.zip
    -rw-r--r-- 1 oratest dba 3.8K Nov 14 11:38 test.sql
    -rw-r--r-- 1 oratest dba 16K Nov 14 11:03 test.sql.backup
    drwx------ 2 oratest dba 4.0K May 5 2012 .Trash
    -rw------- 1 oratest dba 1.3K Dec 13 18:11 .viminfo
    drwxr-xr-x 2 oratest dba 4.0K Dec 11 18:36 .vnc
    -rw------- 1 oratest dba 0 Dec 12 08:33 .Xauthority
  • 5. Re: df -h,du -sh showing different result
    Sivamani Newbie
    Currently Being Moderated
    there is some hidden files.but the total size of the files inside in not equal to output of du -sh
  • 6. Re: df -h,du -sh showing different result
    Sivamani Newbie
    Currently Being Moderated
    I bounced the server..still the same result
  • 7. Re: df -h,du -sh showing different result
    Dude! Guru
    Currently Being Moderated
    There is no reason why the du command should report a different size. Some of the hidden files in your output are actually directories. Did you check the contents? The only reason I could think of is a corrupted file system structure.
  • 8. Re: df -h,du -sh showing different result
    Erman Arslan Newbie
    Currently Being Moderated
    du -shx what output does it produce? maybe there are directories that are belong to different filesystem..

    X option : skip directories on different file systems
  • 9. Re: df -h,du -sh showing different result
    Dude! Guru
    Currently Being Moderated
    No idea. It seems the OP moved along.
  • 10. Re: df -h,du -sh showing different result
    BryanWood Explorer
    Currently Being Moderated
    The OP title says "df" versus "du", which is pretty common, particularly when filehandles of running processes linger for files that have been unlinked from their parent directory: only when the running processes exit will the space be reclaimed by "df". But the thread discussion doesn't seem to involve "df" at all, and also states that OP rebooted the server to no avail.

    Best guess in that sceanrio would be that /home/oratest is a mountpoint and perhaps there are some files residing underneath the mount (in the stub directory which ordinarily is empty).

    Failing that, a more complete output would help (note that I'm intentionally removing the -h switch to du, to make computing total easier):
    root# ls -a |grep -v "\.\." | xargs -n 1 du -sx
      ... paste all of the output, including the begin and end shell prompts ...
    Hope this helps!
  • 11. Re: df -h,du -sh showing different result
    Dude! Guru
    Currently Being Moderated
    The reason why I wrote "There is no reason why the du command should report a different size." was not related to the df command. The OP computed a different total when using du on a directory compared to using du on individual files in that directory and adding it up. That's why I suggested that there might be hidden files or directories.
  • 12. Re: df -h,du -sh showing different result
    BryanWood Explorer
    Currently Being Moderated
    The main thrust of my reply was to use "ls" piped to xargs to make sure OP doesn't inadvertently skip any files or directories. My other comments are for posterity should others read the thread and get confused from the subject line's reference to "df" despite the thread being exclusively about "du". Good suggestion regarding lsof, btw...

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points