diff --git a/wipe.pl b/wipe.pl index 8d4dbea..6a1a688 100755 --- a/wipe.pl +++ b/wipe.pl @@ -66,7 +66,7 @@ sub getdisks { return %listhash; } -# To while a drive +# To whip a drive sub wipethemdrives { my $diskid = shift; my $disks = shift; @@ -102,7 +102,7 @@ sub smartcheck { my $diskid = shift; my $disks = shift; print "Checking S.M.A.R.T. variables...\n"; - print 'smartctl '.$disks->{$diskid}{"path"}.' -A -f hex,id | grep "^0x"'."\n"; +# print 'smartctl '.$disks->{$diskid}{"path"}.' -A -f hex,id | grep "^0x"'."\n"; (my $smartcommand = `smartctl $disks->{$diskid}{"path"} -A -f hex,id | grep "^0x"`) or (print $!."\ncould not check smart data, skipping\n" and return 1); for (split("\n",$smartcommand)) { my @smartdata = split(/\s+/,$_); @@ -120,7 +120,7 @@ sub smartcheck { close( $smartcommand ); for my $smartentry (sort {$a cmp $b} keys %{$disks->{$diskid}{"smart"}}) { if ($disks->{$diskid}{"smart"}{$smartentry}{"id"} =~ /0x05|0x07|0xc4|0xc5|0xc6|0xc7/) { - print $disks->{$diskid}{"smart"}{$smartentry}{"id"}." ".$disks->{$diskid}{"smart"}{$smartentry}{"name"}."\t".$disks->{$diskid}{"smart"}{$smartentry}{"raw_value"}."\t"; + printf("%-6.6s %-20.20s\t%-10.10s\t", $disks->{$diskid}{"smart"}{$smartentry}{"id"}, $disks->{$diskid}{"smart"}{$smartentry}{"name"}, $disks->{$diskid}{"smart"}{$smartentry}{"raw_value"}); if ($disks->{$diskid}{"smart"}{$smartentry}{"raw_value"} =~ /0|0\/0/) { print $color{"green"}."Passed".$color{"reset"}."\n"; } else { print $color{"red"}."Failed".$color{"reset"}."\n"; return 0} @@ -151,7 +151,7 @@ while () { $disks{$diskid}{"smartpass"} = smartcheck($diskid,\%disks); if ($disks{$diskid}{"smartpass"} == 1) { print "Smart looks good.\n"; - push(@good, $disks{$diskid}{"serial"}."\t".$disks{$diskid}{"model"}); + push(@good, sprintf("%-20.20s\t%-40.40s",$disks{$diskid}{"serial"},$disks{$diskid}{"model"})); } else { push(@failed, $disks{$diskid}{"serial"}); } } else { push(@failed, $disks{$diskid}{"serial"}); } print "="x80; @@ -159,6 +159,7 @@ while () { } print "These drives were successfully wiped and passed SMART, they may be put back into production:\n"; print $color{"green"}.join("\n",sort {$a cmp $b} uniq(@good)).$color{"reset"}; + printf " anykey("\nHit any key to see the list of failed drives. Please also note any drives that do not appear\non ether list. Those should be tried again (if they do not show up after three times assume falure)."); print "The folowing drives are bad, RMA or shred:\n"; print join("\n",sort {$a cmp $b} uniq(@failed));