How can I fill the free space with zeroes in Ubuntu 12.04 (ext4)?
It's rather simple:
dd if=/dev/zero of=/some/path/to/zerofile bs=128M count=NumOf128MBlocksToFillTheDiskWith
You'd better have some space left untouched with that commands, say 1 %. By default
EXT…FSes have special amount of reserved space for root user (AFAIR, 5 %), so in case you'd run this command as ordinary user, you won't fill up the whole disk, and that's great, since another system software running as
root may malfunction in that case. But even running this
dd as ordinary user you'd better not use the rest available space (95 %), otherwise other programms like, say Firefox, wouldn't be happy to realize they can't write to disk anymore and you may end up with inconsistent data. So leave the space untouched. It'd be even better to run this in single mode, then you'd squeeze the maximum and won't hurt anything.
After that, needless to say, but just in case — simply remove
P. S. Thanks to @Weijian for sharing info regarding
zerofree which does suit better for