Take the 2-minute tour ×

Possible Duplicate:
ext4 partition size / free space discrepancies

The results from a df on my main drive on my server don't add up. I came close to running out of disk space, I freed 4 gigs a couple of days ago, but we're still getting weird results two days later.

Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda1             78441416  73732352    724536 100% /

Now, by my calculation, 78,441,416 - 73,732,352 = 4,709,064, so there should be over 4 gigs left, not the 724,536K that df is reporting.

I don't see this could be a quota error - though quota -f apparently isn't an option for Ubuntu and I haven't yet found a command to recompute the quota.

I'm now going through the various directories doing a du -sk (glad the server seems to have light traffic for a Monday morning) but not sure what that will tell me.

Any hints?

share|improve this question

migrated from stackoverflow.com Jan 31 '12 at 14:32

This question came from our site for professional and enthusiast programmers.

marked as duplicate by psusi, Jorge Castro, Takkat, htorque, fossfreedom Feb 1 '12 at 12:44


add comment

2 Answers

up vote 5 down vote accepted

Linux filesystems routinely reserve between 1 and 10 percent of the filesystem for the root user. This is to ensure the root user can function when a non-root user "fills" the filesystem. The df command does not show this reserved space as available.

As root, run this command: /sbin/tune2fs -l /dev/sda1
Look for the line that reads "Reserved block count".

You can also use tune2fs to change the amount reserved.

share|improve this answer
Cool, I didn't even know about this place! As you can see from my answer below, Devon's answer is correct. –  Tom Swirly Jan 31 '12 at 17:48
Question: how much space should one be reserving? There were almost 5 gigs reserved - that seems an awful lot, considering the root account only appears to be using a couple of hundred meg right now... I lowered it to 2 gig, but I'm slightly worried this isn't enough, or conversely, if I could completely safely lower it to 1 gig, well, that's another gig in the bank. –  Tom Swirly Jan 31 '12 at 17:50
add comment

OK, I think I finally worked it out, it's a combination of things.

I knew that about 1000000 blocks were reserved for "root" - but I hadn't realized that this machine had 4K blocks (I've been doing a lot of digital audio this year so for me a "block" is 1K :-D). So there's my 4 gig!

Now I have to figure out how to reduce somewhat the amount reserved for root, but that I can probably do quite easily...

Thanks for your attention!

share|improve this answer
tune2fs -m <reserved-blocks-percentage> /dev/sdxx. Note that the reserved space is used to help prevent fragmentation, so reducing it could cause performance loss. You should accept Devon_C_Miller's answer. –  jordanm Jan 30 '12 at 18:08
add comment
