What filesystems preferentially reuse blocks from deleted files

filesystems

Related to this earlier question I asked, I'd like to know what filesystems will preferentially reuse blocks that are freed when files are deleted (if any exist)?

I am only interested in stable, well-established filesystems and would prefer those that can be the boot/root partition in a Debian system (though this is not essential).


edit:
Responding to a comment, I'd like this behaviour because the fs is for a VM and is contained in a sparse raw image file on the host. If new blocks are allocated, the image file gradually loses it's sparseness over time as files are created/deleted/modified, tending towards the 'non-sparse' size, even if the total storage used on the VM remains basically constant.

Best Answer

  • If you are looking for stable and well established, then I think you are out of luck. Otherwise, btrfs behaves this way.

    You also might want to look into whether your virtual disk supports TRIM to free the blocks and make sure you enable discard in your fs.

    You also might consider just allocating smaller disks initially more sized to your anticipated needs; most filesystems can be easily expanded online these days should you need to increase it in the future.