On Jun 7, 2024, at 10:25 AM, Nic Bretz <bretznic@xxxxxxxxx> wrote: > > When I create a new directory and new files in it, I see its size and > blocks increase when running stat. After deleting all files, the size > and blocks of the directory don't decrease in stat. Correct, ext4 does not shrink directories after they have been populated. There was a patch series at https://patchwork.ozlabs.org/project/linux-ext4/patch/20190821182740.97127-1-harshadshirwadkar@xxxxxxxxx/ that fell into a crack and was never landed. However, I think that patch would still be interesting to revive. > I was thinking that ext4 runs defragmentation in the background and > eventually those two numbers will decrease. It looks like they don't. No, ext4 does not do any kind of automatic background scanning or filesystem changes. You can run (offline) "e2fsck -fD" if there is a big problem with large empty directories. Cheers, Andreas
Attachment:
signature.asc
Description: Message signed with OpenPGP