LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Disk Space Used is Less Than Size Still Available Disk Space is Zero (https://www.linuxquestions.org/questions/linux-server-73/disk-space-used-is-less-than-size-still-available-disk-space-is-zero-4175478458/)

devUnix 09-25-2013 04:16 AM

Disk Space Used is Less Than Size Still Available Disk Space is Zero
 
How comes it that Used is < Size still Avail is showing 0 in the output below:

Code:

# df -hT /export
Filesystem    Type    Size  Used Avail Use% Mounted on
/dev/drbd0    ext3    29G  27G    0 100% /export


# cat /etc/issue
Red Hat Enterprise Linux Server release 5.6 (Tikanga)
Kernel \r on an \m


acid_kewpie 09-25-2013 04:24 AM

This is usually open but deleted files. whilst you can delete a filename entry, until nothing is referencing that part of the disk, that disk space is still unavailable.

genese 09-25-2013 07:02 AM

I remember filesystems reserving some space for root exclusive access after they are declared full for non-root users.

I don't know if ext3 have this feature.

chrism01 09-27-2013 01:34 AM

Also worth checking inodes usage
Code:

df -hi

rknichols 09-27-2013 09:23 AM

The discrepancy between 29G and 27G is the 5% that by default is reserved for root. You can use tune2fs to reduce that percentage, but fragmentation can become a problem if the free space gets much below 5%. The filesystem needs some free space in each cylinder group or else files might end up scattered widely around.

smbhandary 09-28-2013 08:45 AM

This happens when live files are deleted.

lsof /export | grep -i deleted - will give you the processes that are still "writing" to files that were deleted.

If the processes are bounceable processes e.g application processes try bouncing ( restarting ) the process.

else

kill -9 <pid> - to kill the processes that are "writing" to the deleted files.

Works for me everytime.

If you dont mind getting into meetings, reboot the system. Its a thoughtfree / sweatfree fix.

rknichols 09-28-2013 01:23 PM

Quote:

Originally Posted by smbhandary (Post 5036400)
This happens when live files are deleted.

No, it doesn't. This is different from the frequently reported discrepancy between what df and du report for a filesystem. While du won't see deleted, but in use, files, for df a used block is a used block, and it makes no difference whether the file using that block does or does not have links in the directory tree.

smbhandary 10-01-2013 12:46 AM

My response is based on my working experience.
My 'usefulness' to my employer is decided on what I can fix or get fixed.
The intention of my being a member here is that I hope my experience will help someone fix her/his problem.
No offense intended in any of the above statements, please.

The problem as I understand it :

# df -hT /export
Filesystem Type Size Used Avail Use% Mounted on
/dev/drbd0 ext3 29G 27G 0 100% /export

And du / du -<summary switch> does not show cause for it


Ive doing platform support for 11 years now.

Application support teams deleting live ( in use / being written to ) application logs is a common occurrence. Ive never spent time wondering why they do it.

The ticket comes to us saying the df says the filesystem is full and du -<summary switch> does not show cause for it.

I have fixed every single such ticket using the commands provided in my last post.

Another cause of df and du not saying the same thing could be the filesystem running out of inodes. I have never faced that condition till date.


I will accept that there is something I have not considered / am not aware of, if devUNIX states that my suggestion did not fix the problem at hand.

SAbhi 10-01-2013 02:22 AM

Its is not what we have done, the cause could be anything you told or told somewhere above, mostly the cause is deleted files that are still open to write somewhere, so @devunix confirm the inode usage and crosscheck with what @smbhandary has provided, you will have the solution and cause both.

cheers :)

rknichols 10-01-2013 07:00 AM

Quote:

Originally Posted by smbhandary (Post 5037732)
The problem as I understand it :

# df -hT /export
Filesystem Type Size Used Avail Use% Mounted on
/dev/drbd0 ext3 29G 27G 0 100% /export

And du / du -<summary switch> does not show cause for it

If you would care to point out where the OP mentioned anything about du, I would like to see it.

This is a simple matter of the 5% default reserved space in the filesystem and df therefore reporting "100%" usage while the number of used blocks is less than the total.

smbhandary 10-04-2013 08:56 AM

rknichols . Point taken....
Now I know what Voltaire meant when he said " The tragedy of speaking nonsense is when it is spoken pompously"


All times are GMT -5. The time now is 11:13 PM.