Why is my directory empty and large?

This commit is contained in:
Ian Gulliver
2019-04-21 17:31:29 +00:00
parent 3a8ce6d5c4
commit f17582013b
4 changed files with 37 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
<!--# set var="title" value="Why is my directory empty and large?" -->
<!--# set var="date" value="March 2, 2006" -->
<!--# include file="include/top.html" -->
This is more a curiosity question than a problem. Try this:
mkdir temp
cd temp
seq 1 30000 | xargs touch
ls -lhd .
find . -type f | xargs rm
ls -lhd .
Doing this on ext3 shows a 432k directory that stays that size even after the files are removed. It appears that ext3 practices lazy deletion, leaving the directory structures intact. It probably assumes that a directory that was large once will be large again, so it can save the allocation expense in the future.
<!--# include file="include/bottom.html" -->

View File

@@ -39,6 +39,7 @@
1. 2009-Sep-11: [Confusing BIND with CNAMEs](2009-09-11-confusing-bind-with-cnames.html)
1. 2009-Feb-19: [The odd case of my mugging](2019-02-19-the-odd-case-of-my-mugging.html)
1. 2009-Feb-03: [5-packet TCP connection?](2009-02-03-5-packet-tcp-connection.html)
1. 2006-Mar-02: [Why is my directory empty and large?](2006-03-02-why-is-my-directory-empty-and-large.html)
1. 2006-Feb-26: [Why isnt mod\_auth\_pam working with NIS?](2006-02-26-why-isnt-mod_auth_pam-working-with-nis.html)
1. 2006-Feb-26: [SCTP Part #1](2006-02-26-sctp-part-1.html)
1. 2006-Feb-13: [Is sleep(3) effected by time changes?](2006-02-13-is-sleep-effected-by-time-changes.html)