Added full zeroing option (untested)
This commit is contained in:
parent
fd08e597a0
commit
9d4902aad1
13
wipe.pl
13
wipe.pl
@ -38,6 +38,8 @@ my %color = (
|
|||||||
);
|
);
|
||||||
|
|
||||||
my $notreally = grep /--notreally/, @ARGV;
|
my $notreally = grep /--notreally/, @ARGV;
|
||||||
|
my $longrun = grep /--long/, @ARGV;
|
||||||
|
|
||||||
if (!$notreally && CONFIRMATION_PHRASE) {
|
if (!$notreally && CONFIRMATION_PHRASE) {
|
||||||
say "$color{brightred}WARNING$color{reset}: This program will $color{brightred}COMPLETELY DESTROY ALL DATA ON ALL SYSTEM DRIVES$color{reset}";
|
say "$color{brightred}WARNING$color{reset}: This program will $color{brightred}COMPLETELY DESTROY ALL DATA ON ALL SYSTEM DRIVES$color{reset}";
|
||||||
print 'Please type "'.CONFIRMATION_PHRASE.qq(" if you are $color{brightred}CERTAIN$color{reset} you want to continue: );
|
print 'Please type "'.CONFIRMATION_PHRASE.qq(" if you are $color{brightred}CERTAIN$color{reset} you want to continue: );
|
||||||
@ -125,7 +127,6 @@ sub wipethemdrives {
|
|||||||
$disksum2 = md5_base64($diskdata);
|
$disksum2 = md5_base64($diskdata);
|
||||||
close($diskr);
|
close($diskr);
|
||||||
}
|
}
|
||||||
# say "Disk Checksum: $disksum";
|
|
||||||
if ($disksum eq $clobsum) {
|
if ($disksum eq $clobsum) {
|
||||||
say +("."x$spacer)."Checksum $color{green}PASSED$color{reset}";
|
say +("."x$spacer)."Checksum $color{green}PASSED$color{reset}";
|
||||||
print " Checking raid wipe...";
|
print " Checking raid wipe...";
|
||||||
@ -141,6 +142,16 @@ sub wipethemdrives {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
# If long flag than zero whole disk and give a progress bar
|
# If long flag than zero whole disk and give a progress bar
|
||||||
|
if ($longrun) {
|
||||||
|
say "Zeroing $disks->{$diskid}{path}...";
|
||||||
|
open(my $longdiskw, ">:raw", $disks->{$diskid}{path}) or return warning("could not open $disks->{$diskid}{path}");
|
||||||
|
seek($longdiskw,0,2);
|
||||||
|
my $totalBytes = tell($longdiskw);
|
||||||
|
until (eof $longdiskw) {
|
||||||
|
print $longdiskw "\0";
|
||||||
|
printf(" %5.5s%%\r\r\r\r\r\r\r", sprintf("%.2f", (tell($longdiskw)/$totalBytes)) );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# to test a drive
|
# to test a drive
|
||||||
|
Loading…
x
Reference in New Issue
Block a user