Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

1 Answer

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 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.

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
1  
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
add comment

Your Answer

 
discard

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.