0
 for disk in $(lspv | awk '{print $1}') ; do
   dd if=/dev/zero of=/dev/${disk} bs=1024 count=$(bootinfo -s ${disk})
   echo $disk wiped
done

How do i exclude certain disks like hdisk0,hdisk1 and hdisk3?

Regards, Adel

2 Answers2

1

The simplest way would be:

for disk in $(lspv | awk '{print $1}') ; do
   case "$disk" in
      hdisk0|hdisk1|hdisk3)
          continue
          ;;
   *)
       dd if=/dev/zero of=/dev/${disk} bs=1024 count=$(bootinfo -s ${disk})
       echo $disk wiped
       ;;
   esac
done
RyanH
  • 367
  • 1
  • 6
0

Well, either explicitly list the disks you want to erase in your command, or add some kind of filter to your command.

Perhaps something like lspv | awk '!/regex/ {print $1}'

Zoredache
  • 130,897
  • 41
  • 276
  • 420