badblocks script against multiple drives

Programming languages, Coding, executables, and scripting.
Post Reply
Message
Author
cphillips
Posts: 1
Joined: 2017-02-23 15:37

badblocks script against multiple drives

#1 Post by cphillips »

Hi all,

I have a load of disks to check for bad sectors and intend on using badblocks.

I have a server with 12 drive slots and would like to test all 12 at the same time.

I have a script but it is running through them one at a time, I'd like all 12 to run in parallel.

Here's the script at present:


Code: Select all

#!/bin/bash
if [ -f badblocks.out ];
then
           rm -f badblocks.out
   fi

   touch badblocks.out

   for drv in {b..k};
   do
               echo "SCANNING /dev/sd$drv">> badblocks.out
                   badblocks -v /dev/sd$drv >> badblocks.out 
done
Can anyone advise on how I can get this to run all drives at once? Would save me a whole load of time!

Thanks in advance.

User avatar
dasein
Posts: 7775
Joined: 2011-03-04 01:06
Location: Terra Incantationum

Re: badblocks script against multiple drives

#2 Post by dasein »

cphillips wrote: I have a load of disks to check for bad sectors and intend on using badblocks.
Forcing reallocation with dd achieves the same goal in a lot less time.

Post Reply