[H-GEN] MySQL filling up /
Paul Gearon
pag at pisoftware.com
Tue Jan 6 01:04:02 EST 2004
Michael Anthon wrote:
>
> I've come across an odd situation that I can't fully resolve. We
> noticed today that the root partition on one of our servers was full.
> Investigation showed something a bit strange... du was reporting only 5G
> used and df was reporting 9G used. I've never seen such a large
> discrepency between these 2 tools before.
>
> In the end [1] I bounced the mysql server and all of a sudden I had 4G
> free and df was reporting only 5G used.
>
> A bit more searching showed others having similar problems but no real
> definitive answers that I could find. Mostly there was a recommendation
> to set the mysql "tmpdir" to something other than /tmp, which is all
> well and good but doesn't really explain what was happening.
>
> The real thing I can't understand is how mysql was able to use up 4G of
> space on the disk without me being able to find out where it was doing
> it (and yes, tmpdir was set to /tmp and I know how to show hidden files)
>
> Can anyone shed some light on this for me?
I'm speculating on your specific situation here, but I think I know
what's happening. Under Linux, you can unlink files which are open in a
process. The OS still knows where the file is, so the file handle works
fine. However, the directory entry has been removed, so it doesn't show
up for any other processes.
Actually, it's very handy for programs which want to remove themselves
on completion (such as installation programs). They simply delete
themselves, and then when the process finishes (and the OS closes the
final handle for the executable file) the space on the disk will be
marked as available. Windows doesn't allow opened files to be unlinked
at all, with the result that installation programs like this have to
leave a request with the OS to delete themselves on the next reboot. (Yuck)
du iteratively looks down directory trees, and adds the sizes of all the
files it finds (this ignores slack space, so the usage from du will be
slightly less than the space taken up on the disk). I believe that df
is calculated from the free blocks on the disk. This will always result
in a larger figure than du reports (due to the slack space being counted
by df), but it will be significantly larger if there are large open
files that have been unlinked.
--
Regards,
Paul Gearon
Software Engineer Telephone: +61 7 3876 2188
Plugged In Software Fax: +61 7 3876 4899
http://www.PIsoftware.com PGP Key available via finger
Catapultam habeo. Nisi pecuniam omnem mihi dabis, ad caput tuum saxum
immane mittam.
(Translation from latin: "I have a catapult. Give me all the money,
or I will fling an enormous rock at your head.")
More information about the General
mailing list