Date: Tue, 25 May 2004 17:34:29 +0200 (CEST) From: Cordula's Web <cpghost@cordula.ws> To: jd@ods.org Cc: freebsd-questions@freebsd.org Subject: Re: Question regarding reported directory sizes. Message-ID: <20040525153429.CB45040826@fw.farid-hajji.net> In-Reply-To: <A4758F237E80785AEBADF883@[10.102.0.67]> (message from Jason DiCioccio on Tue, 25 May 2004 10:41:25 -0400) References: <A4758F237E80785AEBADF883@[10.102.0.67]>
next in thread | previous in thread | raw e-mail | index | archive | help
> 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/
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040525153429.CB45040826>