I have somewhere an old 2T ext3 volume that holds some disk images, one of which being 1.5T in size (I know, I know). The filesystem was almost full and I needed some extra space to copy off some data. So I need to delete something in order to free up some space, right ? Wrong.
zerofree and fallocate to the rescue! [1]
root@host :/volume/images# zerofree -v 100/vm-100-disk-1.raw 221330954/236263080/402653184 root@host:/volume/images# fallocate -v --dig-holes 100/vm-100-disk-1.raw 100/vm-100-disk-1.raw: 895.5 GiB (961573908480 bytes) converted to sparse holes.
Now I have the free space to use as I wish!
Someday I must convert this volume to LVM-Thin.
[1]
root@host:~# apropos zerofree fallocate
fallocate (1) – preallocate or deallocate space to a file
zerofree (8) – zero free blocks from ext2, ext3 and ext4 file-systems