From owner-freebsd-questions@FreeBSD.ORG Tue May 25 08:35:56 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 974EF16A4CE for ; Tue, 25 May 2004 08:35:56 -0700 (PDT) Received: from fw.farid-hajji.net (fw.farid-hajji.net [213.146.115.42]) by mx1.FreeBSD.org (Postfix) with ESMTP id D35E843D2F for ; Tue, 25 May 2004 08:35:54 -0700 (PDT) (envelope-from cpghost@cordula.ws) Received: from fw.farid-hajji.net (localhost [127.0.0.1]) by fw.farid-hajji.net (Postfix) with ESMTP id CB45040826; Tue, 25 May 2004 17:34:29 +0200 (CEST) From: Cordula's Web To: jd@ods.org In-reply-to: (message from Jason DiCioccio on Tue, 25 May 2004 10:41:25 -0400) X-Mailer: Emacs-21.3.1/FreeBSD-4.10-BETA References: Message-Id: <20040525153429.CB45040826@fw.farid-hajji.net> Date: Tue, 25 May 2004 17:34:29 +0200 (CEST) cc: freebsd-questions@freebsd.org Subject: Re: Question regarding reported directory sizes. X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: cpghost@cordula.ws List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 May 2004 15:35:56 -0000 > 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? Have you tried the obvious? 1. mkdir tmpdir 2. mv everything from olddir/* to tmpdir, [*] 3. rmdir olddir 4. mv tmpdir olddir [*] "mv olddir/* tempdir" may not work if you have many files left. Use a script, find(1), tar(1) or whatever you feel comfortable with, instead. The directory could be in theory compacted, but only if it is not in use (i.e. not mapped in the kernel's VNODE(9)s). It's perhaps too cumbersome to create a syscall that would do this. > Thanks! > Jason DiCioccio -- Cordula's Web. http://www.cordula.ws/