Clear unused space with zeros

view full story

http://unix.stackexchange.com – How to clear unused space with zeros ? (We could assume specific type of partitions, like e.g. ext3/ext4, reiserfs, btrfs...) I'm looking for something smarter than cat /dev/zero > /mnt/X/big_zero ; sync; rm /mnt/X/big_zero Like FSArchiver is looking for "used space" and ignores unused, but opposite site. Purpose: I'd like to compress partition images, so filling unused space with zeros is highly recommended. (HowTos)