1

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?

  • check the output of losetup -a, if it shows any unmounted loop devices. – sai sasanka Sep 8 '17 at 6:57
  • 2
    What were the files that you deleted, could there be another process holding them open so they have not been fully removed? Check lsof -nP | grep '(deleted)' for any files that have been deleted but are still being held open. – Chris Davidson Sep 8 '17 at 7:06
  • No, I checked that there is no file is being held open after deletion. Basically I have deleted few log file. – Ravi Sep 8 '17 at 7:08
  • How did you delete the files with rm or filemanager? – user192526 Sep 8 '17 at 7:11
  • 1
    How did you check the files were not being held open by some process? Does the problem persist after the Windows Universal Solution (TM) (a.k.a. reboot)? – Satō Katsura Sep 8 '17 at 7:38
2

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 checked 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 following scenerio will help you to understand:

  1. A running process named xyz.service are using a file named something.dump which at /storage partition.

  2. The file discriptor of something.dump is listed in the process file discriptor table of xyz.service.

  3. Then you deleted something.dump but xyz.service is still running.

  4. The xyz.service is not aware of the updated satus of something.dump file. So file discriptor of something.dump is still there.

  5. Then you ran df command and kernel checked all the process table to see used filed descriptor to calculate free space.

  6. Kernel saw that fd of something.dump is still at the xyz.service process table. So it count something.dump is still at the file system hence it doesn't consider something.dump's inodes as free. Which is reason you are seeing 100% usage.

  7. So when you sigkill xyz.service those inodes will be released and you probabiliy can see the free spaces.

  8. Restarting the system will do the same thing as step 7.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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