Files
firestuff/markdown/2006-03-02-why-is-my-directory-empty-and-large.md

18 lines
679 B
Markdown
Raw Permalink Normal View History

2019-04-21 17:31:29 +00:00
<!--# set var="title" value="Why is my directory empty and large?" -->
2019-04-25 02:45:09 +00:00
<!--# set var="date" value="2006-03-02" -->
2019-04-21 17:31:29 +00:00
<!--# 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" -->