Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
Not sure I understand the question. But ext4 works well for sparse files and only uses what is required. – Matt Dec 2 '13 at 21:22
Create a sparse file of size 8gb. Now mount it, create some files, delete them and create some new files. Some FSes will use blocks it hadn't used before, thus making the size of the 8gb sparse file larger. I'm looking for an OS that maximizes the reusage. – d33tah Dec 2 '13 at 21:28
up vote 1 down vote accepted

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

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.

share|improve this answer
Not sure you understand what I meant... I can't imagine how a VM with a disk image being a sparse file would send a signal to the host to "punch" holes. I mean a situation where VM doesn't know that its disk is actually a sparse file and tries to reuse its disk blocks as much as possible. – d33tah Dec 3 '13 at 12:48
Ah, what you are looking for is "TRIM" support. TRIM is a system where the OS can tell the lower-level device "Hey, I've just deallocated that block. You can optimize around the fact that I don't need the data any more."It was invented for SSD drives because knowing that a block won't be used is important in SSD. It means the SSD can do "wear leveling" using that block. VM systems repurposed TRIM to know when to punch holes in files. Therefore, what you are looking for is a filesystem that sends TRIM commands and a VM system that DTRT with them. – TomOnTime Dec 4 '13 at 3:43

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.