[SOLVED] Conflict between df and du?


Results 1 to 7 of 7

Thread: [SOLVED] Conflict between df and du?

  1. #1
    Join Date
    Mar 2006
    Posts
    12

    [SOLVED] Conflict between df and du?

    Okay...here's what I'm trying to wrap my brain around. I transferred about 30GB worth of files from one partition to another drive, neither of which were mounted on '/'. Afterwards, X won't start because there isn't enough free space on my root directory. So, I do:

    Code:
    # df /dev/hda1
    Filesystem          Size     Used Avail Use% Mounted On
    /dev/hda1           5.8G     5.8G     0 100% /
    I try to find the problem using du...some quick mental math tells me there's a problem so I do (from /):

    Code:
    # du -xs
    1.7G    .
    The 1.7G figure from du is much closer to what my mental math added up to and going through nearly every directory by hand backed up that figure. Why would df think that hda1 is full, and more significantly, how do I resolve this and maybe try to save some face with my wife whom I promised Linux would be plenty user friendly for her?

    If it's important, system is Mandriva 2006 (free DVD image) on AMD Athlon XP1700, 512MB RAM.

    TIA,
    Matt

  2. #2
    Join Date
    Dec 2000
    Location
    Glasgow, Scotland
    Posts
    4,361
    It might be worth doing a full du to see where all the space is being used up. It sounds like maybe a temporary or log file got filled up and didn't delete properly. You could running fsck to sort that.
    mrBen "Carpe Aptenodytes"

    Linux User #216794

    My blog page

    3rd year running - get yourself to LugRadio Live 7th-8th July 2007, Wolverhampton, UK. The premier FLOSS community event.

  3. #3
    Join Date
    Mar 2006
    Posts
    12
    Actually, I've done both. I only posted the summary from du (particularly because I'm posting from a different computer, so no cut and paste). I've been through every directory that's on the hda1 mount with du, and can't find the discrepancy.

    I also did run fsck. I had to run it with the -f flag for it to find anything. It came up with several pages of errors, all of which looks promising (lots of dtimes that were incorrect and files that had the wrong size.) I had fsck fix all the errors it found, but on a reboot, I still get the same conflicting information from df and du. I also tried running a find command for large files and didn't find anything out of the ordinary.

    Matt

  4. #4
    Join Date
    Sep 2003
    Location
    Rochester, MN
    Posts
    3,604
    When this sort of thing has happened to me it's usually because I tried to copy some files to a drive, then realized the drive wasn't mounted, then mounted it and did it again, forgetting to delete the files that I had just duplicated on /. Then the files that were in the mount directory pre-mount seem to disappear because the mounted device's files show up there. I don't know if that's a possibility in your case, but you might try unmounting those drives that were involved in the copy and make sure those directories are empty.

  5. #5
    Join Date
    Mar 2006
    Posts
    12
    Quote Originally Posted by cybertron
    When this sort of thing has happened to me it's usually because I tried to copy some files to a drive, then realized the drive wasn't mounted, then mounted it and did it again, forgetting to delete the files that I had just duplicated on /. Then the files that were in the mount directory pre-mount seem to disappear because the mounted device's files show up there. I don't know if that's a possibility in your case, but you might try unmounting those drives that were involved in the copy and make sure those directories are empty.
    That's essentially what happened, and you are 100% correct. I unmounted, the directory was totally full, rm'ed and remounted and my df now agrees with du...and I can startx

    Thanks a bunch,
    Matt

  6. #6
    Join Date
    Oct 2002
    Posts
    547
    wow, now this is a great problem/solution example, I love the OSS community!
    $whatis microsoft
    microsoft: nothing appropriate

  7. #7
    Join Date
    Sep 2003
    Location
    Rochester, MN
    Posts
    3,604
    Glad to hear you got it figured out. I hate it when hard drive space disappears for no apparent reason (1.3 GB of Mysql binary logs anyone?).

Posting Permissions

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