Simple Setblocksize Script

less than 1 minute read

I wrote this script for a friend that resells used computer hardware who needed to set the blocksize on a large number of disks on an array at once.

This was a fun little project, and actually helped me get on my way of building my server.

#!/usr/bin/env bash

disk_list=$(sg_scan -i |grep sg|sed -e s/\:.*//g) #finds all the disks and puts them into a var.

sbl ()
{
  echo "y"|setblocksize -b512 -t 1200 $1
}

export -f sbl

echo "${disk_list}"|xargs -n 1 -P 0 bash -c 'sbl "$@"' _

Updated: