[Wylug-help] Empty Directory is 1.2M

Towle, William william.towle at eldon.co.uk
Wed Apr 26 14:47:18 BST 2006


> here's a weird one:
> 
> $ ls -lha
> total 1.2M
        ^^^^ [surprise expressed]
> drwx------    2 vpopmail vchkpw 1.2M Apr 26 11:57 .
> drwx------  130 vpopmail vchkpw 8.0K Apr 26 14:08 ..

  Not really. Recall that "everything is a file" in Unix;
each directory is a table of contents (file names and
inode numbers), which gets larger the more files are
linked there.

  The kernel has two options when files are deleted:
leave "holes" in the table, or see if the disk block for
that section of the table is full of holes and restore
it to the free list. The latter doesn't allow the
directory to get as big again if the disk fills up with
files elsewhere, and besides which it's complicated to
determine and manage for other reasons.

  Off the top of my head I can't think of a means of
reclaiming the space other than moving the contents and
using rmdir, but someone else may know (asking perl to
truncate() a directory appears not to fail, but shows
no evidence of success either).

HTH,
  Wills.



More information about the Wylug-help mailing list