Best Linux filesystem for sparse files

filesystems

In some filesystems, blocks used when allocating new files are used to avoid reuse. When used for sparse files, such setup would lead to the file size constantly growing. Is there a filesystem that when allocating blocks for new files would try to reuse disk space as much as possible to slow down the growth of sparse file it is created on?

Best Answer

You need any file system that supports "punch" to create holes in files where data previously existed. All files systems that support inodes (ext2/3/4, xfs, btfs, etc) support files with holes while creating the files but only recently has there been a way to remove (zero out) data in a way that creates holes. See http://lwn.net/Articles/415889/

If you are concerned with "TRIM" support for virtual disks, that's a related but different matter. That is related to the virtual disk system you use.