Results 1 to 9 of 9

Thread: [SOLVED] 11.5 GB difference between `df` and `du` output

  1. #1
    Join Date
    Mar 2008
    Beans
    6

    Question [SOLVED] 11.5 GB difference between `df` and `du` output

    Was burning a disc the other day, and it came up with an 'out of tmp space' error. So I checked out the contents of my root filesystem, cleaned out some garbage that wasn't necessary, and df still said I only had 2.6 out of 18.3 GB of space available.
    "Impossible!" I said to myself.
    As you can see:

    Code:
    ## df
    
    Filesystem           1K-blocks      Used Available Use% Mounted on
    /dev/sda1             18381960  14778256   2669928  85% /
    /dev/sdb2             11172732    158888  10450768   2% /tmp
    /dev/sdb5             40634444  14808044  23778520  39% /usr
    /dev/sdb6             22353492   1569528  19657408   8% /home
    18.3 GB total, 14.7 GB used, 2.6 GB available

    /tmp, /usr, and /home are on separate partitions, so no chance of those filling root up.
    Here's du:

    Code:
    ## du -csxk /
    3269144	/
    3269144	total
    3.2 GB used on root

    Here's what /var takes up:

    Code:
    ## du -csxk /var
    1373656	/var
    1373656	total
    1.3 GB of root is /var.

    What's taking up that 11.5 GB?
    I've done a lot of web searching looking for some answers, but haven't found anything.
    Can anyone help me?
    I hope it's something incredibly stupid, that means it's easy to fix!

    I just want my space back!

    Thank you in advance for your help!
    Stuart C. Bruce

  2. #2
    Join Date
    Jan 2007
    Location
    /bunk
    Beans
    194
    Distro
    Kubuntu 8.10 Intrepid Ibex

    Re: 11.5 GB difference between `df` and `du` output

    try du -sh, you'll get results in GB and MB format.
    Jaunty Jackalope, because we feel bad for that other guy from Full House.

  3. #3
    Join Date
    Dec 2006
    Location
    Oregon, US
    Beans
    1,541
    Distro
    Ubuntu Development Release

    Re: 11.5 GB difference between `df` and `du` output

    sudo apt-get clean
    sudo apt-get autoclean

  4. #4
    Join Date
    Feb 2008
    Location
    52°38'41.6"N/1°19'43.6"E
    Beans
    Hidden!

    Re: 11.5 GB difference between `df` and `du` output

    Did you run the du and df commands via sudo?, maybe something was created as root and you can't see it using a non-root user?

    I found that trash from the root account was a cause for missing space on my drive previously...something similar here maybe?

    Just a thought

  5. #5
    Join Date
    Mar 2008
    Beans
    6

    Re: 11.5 GB difference between `df` and `du` output

    Sorry, I should have put this in my first post, but I already tried cleaning up the packages and emptying the trash, both to no avail.
    And yes, everything was run as root. Otherwise du gives you "Permission denied" errors in /var and some other places.
    And
    Code:
    du -sh
    just displays the output in a different format.

    <sigh>

    Thanks, though...

    SCB

  6. #6
    Join Date
    Feb 2008
    Location
    52°38'41.6"N/1°19'43.6"E
    Beans
    Hidden!

    Re: 11.5 GB difference between `df` and `du` output

    The only other suggestion I can make is looking at it in more depth using a graphical too:

    sudo apt-get install baobab

    Then look for Accessories->Disk Usage Analyser

    Sorry I can't be of more help, just can't think what it could be...

  7. #7
    Join Date
    Feb 2005
    Location
    Melbourne, Australia
    Beans
    13,510
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: 11.5 GB difference between `df` and `du` output

    Quote Originally Posted by Felonious Punk View Post
    .........
    I hope it's something incredibly stupid, that means it's easy to fix!

    I just want my space back!

    Thank you in advance for your help!
    Stuart C. Bruce
    Running commands with User privileges will only show files that you have permission to read, use sudo if you want more meaningful results.
    Regards, David.
    Please use the Forum search and Wiki search for immediate help
    Please mark your thread as Solved when appropriate
    New to technical forums?: How To Ask Questions The Smart Way

  8. #8
    Join Date
    May 2006
    Beans
    160
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: 11.5 GB difference between `df` and `du` output

    Ext3 reserves some space on your partition, default is 5%. This space is critical to mitigate the effects of fragmentation and also ensures that "root" processes don't crash immediately if a user fills up the disk (since the priveledged processes can use the reserved space, things like syslogd will continue to work for a while), which is quite helpful.

    Code:
    sudo tune2fs -l /dev/sda1 | grep Reserved
    There's also a chance that your filesystem isn't taking up all the available space in the partition, although that should affect the shown (max) size in df as well. You can make the filesystem occupy the whole partition by running:

    Code:
    resize2fs /dev/sda1
    If you are still experiencing problems, try giving us the full output of the tune2fs command above (without grep'ing for anything).

  9. #9
    Join Date
    Mar 2008
    Beans
    6

    Thumbs down Re: [SOLVED] 11.5 GB difference between `df` and `du` output

    Congratulate me on my empty-head!


    Here's what happened...

    Last week I moved /usr and /home into new partitions.
    (Tried to move /var, but it didn't want to work. Tried creating /var/lock and /var/run on the mount point, but that's ok,
    I have plenty of space on root)
    Anyway, I forgot to empty out /usr on my root partition after copying everything in there to the new partition.
    So, as soon as the separate /usr partition gets mounted during boot, all the stuff in there gets hidden from du,
    but it still takes up the space as seen in df.
    Delete /usr on root partition, create the mount point, my 11.5 GB is back where it should be.

    Yay!

    Thanks everyone for your ideas.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •