File space allocation/deallocation under Unix (BSD4.x)

Greg Pasquariello X1190 gpasq at picuxa.UUCP
Wed Jul 13 23:11:50 AEST 1988


In article <9662 at eddie.MIT.EDU> rich at eddie.MIT.EDU (Richard Caloggero) writes:
>
>
>     If you create a directory "d", then create a file "d/f" 1 megabyte
>long (big), then "rm d/f", is it true that the space remains allocated
>to directory "d" and cannot be garbage collected or otherwise reclaimed
>until another file is created in directory "d" or "d" is deleted?  If this is true, why?
>-- 
>						-- Rich (rich at eddie.mit.edu).


No, this is not true.  What really happens is the inode is removed (thereby
"freeing" the disk space), but the filename remains in the directory (which
is really just a file with special permissions that holds other file names
and i-numbers).  The i-number in the directory entry is zeroed, signifying
a free slot in the directory.  When a new file is created in that directory,
any free slots are used for the new name and i-number rather than adding onto
the directory file itself.
-- 
=========================================================================
Greg Pasquariello                   AT&T Product Integration Center
att!picuxa!gpasq                299 Jefferson Rd, Parsippany, NJ 07054
=========================================================================



More information about the Comp.unix.wizards mailing list