df command shows 100% full, even after deleting files it shows same usage (100%)
A reboot and re-mount would solve the problem I believe.
Reason: The reason behind this is that df
utilize statfs(2) system call to get the File system stat. What it means that it checks open kernel file descriptors to count free space as it named (df = disk free). You will get a different result if you use du
. df
showing 100% used because the files were deleted are not yet released from the kernel file descriptor.
May be the following scenario will help you to understand:
-
A running process named
xyz.service
are using a file namedsomething.dump
which resides at/storage
partition. -
The
file discriptor
ofsomething.dump
is listed in theprocess file descriptor table
ofxyz.service
. -
Then you deleted
something.dump
butxyz.service
is still running. -
The
xyz.service
is not aware of the updated status ofsomething.dump
file. So file descriptor ofsomething.dump
is still there. -
Then you ran
df
command and kernel checked all the process table to see used filed descriptor to calculate free space. -
Kernel saw that the
inodes
of thatsomething.dump
file is still listed at thexyz.service
process's file descriptor table. So it countssomething.dump
is still at the file system hence it doesn't consider something.dump's inodes as free. Which is the reason you are seeing more usage. -
So when you
SIGKILL
xyz.service
those inodes will be released and you probably can see the free spaces. -
Restarting the system will do the same thing as step 7.
Ravi
Updated on September 18, 2022Comments
-
Ravi almost 2 years
Nand Flash storage partition shows as 100% full with df command. When manually calculated the usage it is about 7-80%(max) only. Deleted few files (say around 50~60MB), still df command output did not change. I can not create a new file, error: "there is no space left on the storage device". Tried
sync
command, no difference.Filesystem 1K-blocks Used Available Use% Mounted on tmpfs 262144 20780 241364 8% /tmp tmpfs 512 0 512 0% /dev /dev/ubi0_0 1275540 1275540 0 100% /storage
When the actual storage space is not full (as per the manual calculation), why doe df command shows it as 100% full?