Question regarding reported directory sizes.

Dan Nelson dnelson at allantgroup.com
Tue May 25 08:42:55 PDT 2004


In the last episode (May 25), Jason DiCioccio said:
> I know this question may seem silly..  However, here's my scenario.
> 
> I have a very large directory (say, a mail spool) whose directory entry is 
> approx 606K..
> drwx------  5 cyrus  cyrus  606208 May 25 10:29 .
> Now.. That directory had a lot of files in it.  However, after deleting all 
> of the files in that directory, the directory entry's size stays the same. 
> I realize this is fairly unimportant, however is there a way to 'garbage 
> collect' that directory entry and all others like it?

Create another file in the directory, and you'll see it shrink down. 
The truncation code is in the file create codepath, not the delete one
(which means it's not constantly trying to shrink the directory as you
delete files).

-- 
	Dan Nelson
	dnelson at allantgroup.com


More information about the freebsd-questions mailing list