Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Monitor available disk space after rm

Status
Not open for further replies.

new2unix

Programmer
Feb 5, 2001
143
US
Hi,

As a newbie, I have always thought that once the rm is issued on the files, those files would be permanately gone from the file system thus freeing up disk space. Then a colleague of mine just told be the following, which now I am getting a bit confused. This was what I was told:

"For UNIX file system, the allocated space/segments will not be released automatically by deleting the files under directory. In other words, if we have a directory that contain many files, that directory still holds the same space after all the files have been deleted. When we delete the directory and recreate it, it will have default amount of space allocated."

Is this correct? So does that mean I can't exactly believe what the df command is telling me about the available space?

Thanks,

Mike
 
No

If you have many files in a directory, then the header may grow to some significant size (i.e the directory name) By removing and recreating the directory you get this space back. The largest I have seen is about 1MB for a directory with over 250,00 files.

If a file has an attached process (e.g. a log file which is always open) then deleting it has no effect on the available space unless the process is stopped as well

I am sure there will be other cases like this, but generally if you delete a file, its gone

Alex
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top