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