Why doesn't deleting files increase available space?

Recently I got a message about "0 bytes free" on a certain partition.

So I looked and, sure enough:

$ df
Filesystem     1K-blocks      Used Available Use% Mounted on
/dev/sda1       65190604  10920296  50959160  18% /
udev              966544         4    966540   1% /dev
tmpfs             389532       744    388788   1% /run
none                5120         0      5120   0% /run/lock
none              973828       152    973676   1% /run/shm
/dev/sda5      397327316 391010276         0 100% /media/8b5e40d0-95b3-4e60-831c-e9b9aeadbfa4

there are 0 bytes available on that partition.

So I deleted a bunch of files I didn't need on this machine, and emptied the trash. I expected the "Used" to get smaller and the "Available" to get larger by the same amount.

But what actually happened was

$ df
Filesystem     1K-blocks      Used Available Use% Mounted on
/dev/sda1       65190604  10921184  50958272  18% /
udev              966544         4    966540   1% /dev
tmpfs             389532       744    388788   1% /run
none                5120         0      5120   0% /run/lock
none              973828       152    973676   1% /run/shm
/dev/sda5      397327316 390986836         0 100% /media/8b5e40d0-95b3-4e60-831c-e9b9aeadbfa4

the "Used" actually did get smaller, but the "Available" is still zero.

I rebooted the machine, and I still see 0 in the "Available" column.

Why is "Available" always zero, even when I delete a bunch of files so "Used" gets smaller?

Why doesn't deleting files increase available space?

I am running Ubuntu 12.04 LTS.

$ df -hi
Filesystem     Inodes IUsed IFree IUse% Mounted on
/dev/sda1        4.0M  512K  3.5M   13% /
udev             205K   486  204K    1% /dev
tmpfs            208K   390  208K    1% /run
none             208K     3  208K    1% /run/lock
none             208K     7  208K    1% /run/shm
/dev/sda5         25M  975K   24M    4% /media/8b5e40d0-95b3-4e60-831c-e9b9aeadbfa4

Solution 1:

Step by Step Tutorial

  1. Run sudo tune2fs -m 0 /dev/sda5 in a terminal, assuming /dev/sda5 is your drive.
  2. Enter your password (you won't see it as you type it).
  3. Check your space again, it should be free.

From man tune2fs:

-m reserved-blocks-percentage
  Set the percentage of the filesystem which may only be allocated by privileged
  processes. Reserving some number of filesystem blocks for use by privileged 
  processes  is done  to  avoid  filesystem fragmentation, and to allow system 
  daemons, such as syslogd(8), to continue to function correctly after non-privileged 
  processes are prevented from writing to the filesystem.  Normally, the default
  percentage of reserved blocks is 5%.

Solution 2:

The simple answer is delete more files. You are seeing the "reserved" blocks reclaiming themselves. Usualy 5% of a filesystem is reserved for privileged processes, is the filesystem is considered full when that limit is reached. You can adjust the limit with the tune2fs -m command. see the man pages for tune2fs for more info.

Solution 3:

When you delete a file in a partition that isn't where Ubuntu is installed at, it makes a .Trashes/.Trashes-1000 folder which is the equivalent of recycle bin. The number can differ between Ubuntu versions. Once you are in the partition, press Ctrl+h to see the hidden files which are those that start with .. If you delete this file, then you actually have deleted all the files and you will have more space.