[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <A87288AE-DEE1-4D3F-9947-FB5A82F2643B@dilger.ca>
Date: Mon, 10 Jun 2024 14:55:01 -0600
From: Andreas Dilger <adilger@...ger.ca>
To: Nic Bretz <bretznic@...il.com>
Cc: Ext4 Developers List <linux-ext4@...r.kernel.org>,
Harshad Shirwadkar <harshadshirwadkar@...il.com>
Subject: Re: stat Size and Blocks numbers don't decrease after deletion
On Jun 7, 2024, at 10:25 AM, Nic Bretz <bretznic@...il.com> 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@gmail.com/ 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
Download attachment "signature.asc" of type "application/pgp-signature" (874 bytes)
Powered by blists - more mailing lists