The ext2/ext3 filesystem automatically allocate blocks when you write a sparse file, but when I no longer want some blocks of them, I found no ways to do it. It feels like using malloc() without free(). Is it possible to "free" some blocks of a sparse file? If it is, how? Don't tell me to copy it to a new file. It's too boring and needs a lot of disk space.
+2
A:
Filesystems only allocate blocks for those parts of the sparse file that do in fact have any content. Removing those blocks would be pretty stupid because that’s your data. The other blocks can not be removed because they do not exist.
Bombe
2009-08-12 09:49:09
But there really exist situations that I don't want some blocks of a file any more and want to give the space back to the filesystem.
hpsMouse
2009-08-13 02:21:28