Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

On my Amazing 2GB EeePC Surf, I have no more space left!

This is quite normal, and it happens every now and then. Just delete a few large, unneeded files and everything should be good, right?

So I go and find a 2MB file in /tmp, and rm -rf it. Check free space again, and... still nothing?!

I had to remove about 30MB of files before it registered some free space.

Now, my question is, whats up with this strange behaviour?

share|improve this question
add comment

2 Answers

up vote 11 down vote accepted

Do the “Used” and “Available” columns of df output add up to the figure in the total column? (The output of df reflects the data from the underlying statvfs system call, so you'll find the same numbers in any other application.)

If not (which is probably the case), that's because by default, on an ext2/ext3/ext4 filesystem, 5% of the space is reserved to root. This space is not included in the “Available” column. So if you've filled exactly 95% of the filesystem, the available space is 0.

You can change the user who gets the 5%, or change the amount (all the way to 0 if you like), with tune2fs (options -g and -uto control who gets it,-mor-r` to control how much there is).

share|improve this answer
6  
Good answer, but beware that the filesystem reserves this space for root for a good reason. If system daemons can't write to the disk, bad things can happen. If an interactive user can't write to disk, there's a good chance they'll be able to cope without data loss. –  Warren Young Oct 7 '10 at 2:32
2  
To add to Warren's comment about reserved space: when space goes below a few percent, the filesystem tends to fragment like crazy, because it's sticking bits of files wherever it can find the space. There's a performance cost to keeping your drives that close to full. –  p-static Oct 7 '10 at 23:51
1  
@p-static: I think (but I could be wrong) that there won't be much of a performance hit on an SSD. (There are certainly no moving heads in an SSD, but I don't know if scattered writes have a performance impact; it might depend on the type of SSD.) –  Gilles Nov 13 '10 at 11:39
1  
There is a hit, it's just much less severe. You don't have any physical latency from moving parts, but fragmentation on a SSD still means issuing a lot of small requests for data instead of one large one. –  p-static Nov 21 '10 at 19:38
    
this space is also important to avoid fragmentation –  Kiwy Mar 18 at 13:29
add comment

Note that it's possible to have multiple hard-links to the same file, and removing one link does not cause the file to be deleted. Although this is unlikely to apply on /tmp.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.