From 17b416926e733608e8503b2101796353818c07c6 Mon Sep 17 00:00:00 2001 From: bluesaxman Date: Tue, 8 Mar 2022 14:32:09 -0700 Subject: [PATCH] a syntax correction and adding dynamic block sizes to zeroing --- wipe.pl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/wipe.pl b/wipe.pl index 12a9e0e..3dc6134 100755 --- a/wipe.pl +++ b/wipe.pl @@ -167,8 +167,9 @@ sub wipethemdrives { seek($longdiskw,0,2); my $totalBytes = tell($longdiskw); seek($longdiskw,0,0); - for (0..($totalBytes/4096 - 1)) { - print $longdiskw "\0"x4096; + my $blockSize = $totalBytes / 4096; + for (0..($totalBytes/$blockSize - 1)) { + print $longdiskw "\0"x$blockSize; if ( !($_ % 4) ) { system("hdparm -F ".$disks->{$diskid}{path}." 1>/dev/null 2>/dev/null"); } @@ -178,7 +179,7 @@ sub wipethemdrives { "Zeroing ".$disks->{$diskid}{path}, "."x(tell($longdiskw)/$totalBytes*($spacer+11)), (tell($longdiskw)/$totalBytes)*100 , - "ETA: ".$diskTimes[7].", )".$diskTimes[2].":".$diskTimes[1].":".$diskTimes[0]; + "ETA: ".$diskTimes[7].", ".$diskTimes[2].":".$diskTimes[1].":".$diskTimes[0]); } } my $leftover = $totalBytes - tell($longdiskw);