Added the ability to wipe raid metadata... hopefully
This commit is contained in:
parent
5a8d07e678
commit
fd08e597a0
17
wipe.pl
17
wipe.pl
@ -100,14 +100,18 @@ sub wipethemdrives {
|
|||||||
# Write
|
# Write
|
||||||
say "$disks->{$diskid}{path} - Serial:$disks->{$diskid}{serial} is being wiped...";
|
say "$disks->{$diskid}{path} - Serial:$disks->{$diskid}{serial} is being wiped...";
|
||||||
my $disksum;
|
my $disksum;
|
||||||
|
my $disksum2;
|
||||||
my $spacer = 29;
|
my $spacer = 29;
|
||||||
if ($notreally) {
|
if ($notreally) {
|
||||||
$spacer = 18;
|
$spacer = 18;
|
||||||
print "Pretend wipe complete, pretending to check...";
|
print "Pretend wipe complete, pretending to check...";
|
||||||
$disksum = $clobsum;
|
$disksum = $clobsum;
|
||||||
|
$disksum2 = $clobsum;
|
||||||
} else {
|
} else {
|
||||||
open(my $diskw, ">", $disks->{$diskid}{path}) or return warning("could not open $disks->{$diskid}{path}");
|
open(my $diskw, ">", $disks->{$diskid}{path}) or return warning("could not open $disks->{$diskid}{path}");
|
||||||
print $diskw $clobber;
|
print $diskw $clobber;
|
||||||
|
seek($diskw,-10240000,2);
|
||||||
|
print $diskw $clobber;
|
||||||
close($diskw);
|
close($diskw);
|
||||||
system("sync");
|
system("sync");
|
||||||
print "Wipe attempt complete, checking...";
|
print "Wipe attempt complete, checking...";
|
||||||
@ -116,18 +120,27 @@ sub wipethemdrives {
|
|||||||
my $diskdata;
|
my $diskdata;
|
||||||
read($diskr, $diskdata, 10240000);
|
read($diskr, $diskdata, 10240000);
|
||||||
$disksum = md5_base64($diskdata);
|
$disksum = md5_base64($diskdata);
|
||||||
|
seek($diskr,-10240000,2);
|
||||||
|
read($diskr, $diskdata, 10240000);
|
||||||
|
$disksum2 = md5_base64($diskdata);
|
||||||
close($diskr);
|
close($diskr);
|
||||||
}
|
}
|
||||||
# say "Disk Checksum: $disksum";
|
# 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}";
|
||||||
# say "$disks->{$diskid}{path} is clean.";
|
print " Checking raid wipe...";
|
||||||
|
if ($disksum2 eq $clobsum) {
|
||||||
|
say +("."x$spacer)."Checksum $color{green}PASSED$color{reset}";
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
# say "Wipe Checksum: $clobsum";
|
|
||||||
say +("."x$spacer)."Checksum $color{red}FAILED$color{reset}";
|
say +("."x$spacer)."Checksum $color{red}FAILED$color{reset}";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
say +("."x$spacer)."Checksum $color{red}FAILED$color{reset}";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
# If long flag than zero whole disk and give a progress bar
|
||||||
}
|
}
|
||||||
|
|
||||||
# to test a drive
|
# to test a drive
|
||||||
|
Loading…
x
Reference in New Issue
Block a user