Inconsistent /tmp Sizes
oyvinst at ifi.uio.no
Thu Nov 22 16:16:48 UTC 2007
tor, 22.11.2007 kl. 10.28 -0500, skrev Kenneth Jacker:
> [ Kubuntu 7.10; 2.6.20-16-generic #2 SMP ]
> I am showing an inconsistent /tmp usage value (hidden partition use?):
> # du -sh /tmp
> 663K /tmp
> # df -h /tmp
> Filesystem Size Used Avail Use% Mounted on
> /dev/sda6 464M 52M 388M 12% /tmp
> The output of "ls -Rs /tmp" is consistent with the first value.
> Apparently whatever the later ('df') uses is also used for internal
> checks since I first found out about this yesterday during a download
> ("partition full" error message followed by process termination).
> Rebooting (I hated to reset my "uptime"!) caused the values to be more
> or less equal. The above numbers are after about 24 hours of use ...
> implying that the "disk full" condition will most likely reoccur.
Actual space is not freed for deleted files until all processes having
open file-handles terminates or close the handles. What this means is
that there might be some process holding file-handles on files that used
to exist in /tmp, but have been deleted by some (perhaps other) process
in the mean time. du and ls only reports usages (disk blocks and actual
file sizes, respectively) for files that haven't been deleted. df, I
suspect, has better knowlegde of actual file-system block-usage for
deleted files (and other obsoleted resources), as well.
You should check using the lsof tool (man lsof).
$ lsof +D /tmp
This lists all open files (really file handles) in /tmp and what
processes owns them. However, this doesn't seem to list deleted files,
so you can do this instead:
$ lsof | grep /tmp | grep deleted
Do it as root, so you have permission to see everything on the system.
This also explains why the issue was cleared up after a reboot. However,
I'm not sure all of this applies to your case, only guessing, really ..
Worth a try.
Also, of course, check your fs with fsck if you suspect problems.
< Øyvind Stegard ~ oyvinst at ifi uio no
More information about the ubuntu-users