diff --git a/2006-03-02-why-is-my-directory-empty-and-large.html b/2006-03-02-why-is-my-directory-empty-and-large.html new file mode 100644 index 0000000..9097a1d --- /dev/null +++ b/2006-03-02-why-is-my-directory-empty-and-large.html @@ -0,0 +1,18 @@ + + + + + +

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.

+ + diff --git a/index.html b/index.html index 5b33ea2..bc92686 100644 --- a/index.html +++ b/index.html @@ -40,6 +40,7 @@
  • 2009-Sep-11: Confusing BIND with CNAMEs
  • 2009-Feb-19: The odd case of my mugging
  • 2009-Feb-03: 5-packet TCP connection?
  • +
  • 2006-Mar-02: Why is my directory empty and large?
  • 2006-Feb-26: Why isn’t mod_auth_pam working with NIS?
  • 2006-Feb-26: SCTP Part #1
  • 2006-Feb-13: Is sleep(3) effected by time changes?
  • diff --git a/markdown/2006-03-02-why-is-my-directory-empty-and-large.md b/markdown/2006-03-02-why-is-my-directory-empty-and-large.md new file mode 100644 index 0000000..8b9ad01 --- /dev/null +++ b/markdown/2006-03-02-why-is-my-directory-empty-and-large.md @@ -0,0 +1,17 @@ + + + + + +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. + + diff --git a/markdown/index.md b/markdown/index.md index 6d2665b..bbf9730 100644 --- a/markdown/index.md +++ b/markdown/index.md @@ -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 isn’t 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)