I wrote the perl script below to automatically zero-out the free hard disk
bits on a Linux box to reduce image
size.  It was suggested to send it to this list.  The script reads
/etc/fstab and automatically does a "dd if=/dev/zero..." on each ext3
partition.
The script was created for Fedora Core, but should work on other
distros/*nixes with just a little adaptation.

Matt

#!/usr/bin/perl

# Script to zero out all free bits on disk prior to imaging disk with G4U

open FSTAB, "/etc/fstab";
while (<FSTAB>) {
chomp;
if (/ext3/) {
if (/\s+(\/[0-9a-zA-Z\/-_]*)\s/) { $fspath = $1 };
print "Zeroing out free space on $fspath\n";
unless ( substr($fspath, -1) =~ "\/" ) { $fspath .= "/" };
system "dd if=/dev/zero of=${fspath}0bits bs=20971520";
system "rm ${fspath}0bits";
}
}
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
g4u-help mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/g4u-help

Reply via email to