Xref: utzoo comp.unix.questions:8204 comp.unix.wizards:9883 comp.sys.apollo:1117
Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!mailrus!tut.cis.ohio-state.edu!osu-cis!att!occrsh!rjd
From: rjd@occrsh.ATT.COM (Randy_Davis)
Newsgroups: comp.unix.questions,comp.unix.wizards,comp.sys.apollo
Subject: Re: File space allocation/deallocation under Unix (BSD4.x)
Keywords: Unix, BSD, File, Delete
Message-ID: <296@occrsh.ATT.COM>
Date: 13 Jul 88 13:38:28 GMT
References: <9662@eddie.MIT.EDU>
Reply-To: rjd@occrsh.UUCP
Organization: AT&T Network & Data Systems, OKC
Lines: 22

In article <9662@eddie.MIT.EDU> rich@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?  What good does it do to delete files, say, in your home directory
:(if, for example, disk resources are low and you system administrator
:keeps hounding you to "clean up your directory")?
:						-- Rich (rich@eddie.mit.edu).

  When you remove the file, the space taken by the file *contents* is reclaimed,
i.e., the 1 megabye above is available for system use again.  The 16 bytes
(for System V) taken by the file entry in the directory "file" is *not*
reclaimed unless you remove the directory.
  To explain the directory part further: if you make the directory then ls -al
the directory, you will see that the directory entry, ".", takes up 32 bytes
of space; 16 bytes for the "." entry, and 16 bytes for the ".." entry (you can
check this under System V via the 'od -c .' command).  If you create a file
under this directory, the directory "file" will increase by 16 bytes to 48
bytes.  If you then remove this file, the directory "file" does *not* reduce
by 16 bytes....

Randy