5

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, what's up with this strange behaviour?

2 Answers 2

14

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).

5
  • 8
    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. Oct 7, 2010 at 2:32
  • 3
    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, 2010 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.) Nov 13, 2010 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, 2010 at 19:38
  • this space is also important to avoid fragmentation
    – Kiwy
    Mar 18, 2014 at 13:29
2

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .