Disk Space Disappearing (or seeming to)

My slice is often low on disk space so I have been tracking it very carefully. I am confused about what I am seeing and wonder if I am misinterpreting or misunderstanding…

I do a du command every week or so or when disk space is low. Here is the whole history: https://spreadsheets.google.com/spreads … oIAI#gid=1">https://spreadsheets.google.com/spreadsheet/ccc?key=0Avr8qvL1EWecdGVIcVJmSVVmVldFd2dRM3dGeER2WUE&hl=en_US&authkey=CO3FoIAI#gid=1

The command I do is:

$ su

$ cd /

$ du | sort -n -k1,7 -r | head -n50

As you can see in the spreadsheet, it looks like I am doing well, the total space in use in root and other directories is maintained and actually shrinking sometimes.

And yet, when I do a df, I see the percentage free dropping. It used to float around 85-90 and now it seems to always be pushing over 90 going higher.

For example, right now df says:

/dev/xvda 16255928 15085160 510168 97% /

The two sets of data don't align. The amount of used space that df says doesn't match at all what du says.

Can someone help me interpret what might be going on, or where my disconnect is (which can be entirely my ignorance?)

Thanks a lot!

4 Replies

Is it possible that you have programs running that have files which you have unlinked open still?

Files are not truly removed as long as anything still uses them, even if they are not shown in the filesystem tree.

@hawk7000:

Is it possible that you have programs running that have files which you have unlinked open still?

Files are not truly removed as long as anything still uses them, even if they are not shown in the filesystem tree.

Good thought. It's a running server, with a fairly big mysql database and other processes…. That might explain it, I guess.

Follow up question then would be, is there any way, short of rebooting, to cause mysql to release blocks that it's holding on for for one reason or other?

Thanks!

I wouldn't expect mysql to run into that sort of thing unless you have eg removed a log file that it's still writing to or something along those lines.

As for making mysql release space you may want to "optimize" tables (http://dev.mysql.com/doc/refman/5.6/en/ … table.html">http://dev.mysql.com/doc/refman/5.6/en/optimize-table.html) if you have removed large chunks of data.

(Edit: The latter is unrelated to your disk usage mismatch)

Few points, run lsof | grep deleted to see deleted files still in use. If using innodb and mysql deleting rows doesn't remove space (makes sense huh? :P) only dropping a table does.

I set up http://dev.mysql.com/doc/refman/5.0/en/ … paces.html">http://dev.mysql.com/doc/refman/5.0/en/innodb-multiple-tablespaces.html then if you drop a table it's space is removed. To reclaim space taken up run optimize on the table however on large tables this will take a while since innodb optimize = recreate the table.

Also you can expand your disk with the free space you were given last week! :)

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct