ext3 zerofree option and RedHat back port?

Andreas Dilger adilger at sun.com
Wed Sep 24 06:35:11 UTC 2008

On Sep 23, 2008  22:30 -0500, Eric Sandeen wrote:
> Ulf Zimmermann wrote:
> Ok, so you really want to zero the unused blocks in-place, and e2image
> writing out a new sparsified image isn't a ton of help.
> The tool does that, I guess - but only on an unmounted or RO-mounted
> filesystem, right?  (plus I'd triple-check that it's doing things
> correctly, opening a block device and splatting zeros around, one hopes
> that it is!)

That is WAY to scary for me on a mounted filesystem.  It is racy if the
blocks become allocated.

Instead, what I always do when creating a sparse image for e2fsck test
cases is just "dd if=/dev/zero of=/mnt/fs/zeroes bs=64k; rm /mnt/fs/zeroes"
until the filesystem is full, then the file is deleted.  This will
leave blocks "empty" for the free space in the filesystem without
any special tools.

Cheers, Andreas
Andreas Dilger
Sr. Staff Engineer, Lustre Group
Sun Microsystems of Canada, Inc.

More information about the Ext3-users mailing list