Script to format 4 new disks in Solaris 11

I want to develop a script that I can run like follows:

./format_disks.sh <disk name 1>, <disk name 2>, etc...

Some background. I've create a VMware based virtual machine that has Solaris 5.11 installed on it. Initially, the only disk that is on this VM is the one that hosts the OS. I then create 4 additional disks on this VM, while the VM is shutdown with the VMware software, specs as follows:

  • 2GB, named c8t1d0
  • 2GB, named c8t2d0
  • 5GB, named c8t3d0
  • 5GB, named c8t4d0

The manual process that I've been doing to get this done is running through the wizard in Solaris 5.11, by typing the format command, then supplying the values as the prompt requests the values, finagling ending the wizard by typing the label command to save the changes. I do this for each of the 4 disks above. Can I somehow accomplish the task I'm wanting by only typing the bolded command above? Or is there some other way to format disk in Solaris 5.11 other than the wizard I'm discussing?

I have never used Solaris 11 and probably never will. But I have used Solaris 10. we would always mirror our disks. I needed two disks with the same layout. I would use the interactive format command on the first and then do:

prtvtoc /dev/rdsk/${rootdisk}s2 | fmthard -s - /dev/rdsk/${rootmirror}s2

The prtvtoc command just displays the disk geometry and the fmthard command reads this for it's input. I had a bunch of disks to layout and it occurred to me to simply save the output from prtvtoc and hard code it into a script.

#! /usr/bin/ksh

repeat() {
cat << EOF
* /dev/rdsk/c1t1d0s2 partition map
*
* Dimensions:
*     512 bytes/sector
*     424 sectors/track
*      24 tracks/cylinder
*   10176 sectors/cylinder
*   14089 cylinders
*   14087 accessible cylinders
*
* Flags:
*   1: unmountable
*  10: read-only
*
*                          First     Sector    Last
* Partition  Tag  Flags    Sector     Count    Sector  Mount Directory
       0      2    00          0  20606400  20606399
       1      3    01   20606400   8649600  29255999
       2      5    00          0 143349312 143349311
       3      8    00   29256000   4324800  33580799
       4      0    00   33580800 109615872 143196671
       7      0    01  143196672    152640 143349311
EOF
}
destination=/dev/rdsk/c1t0d0s2
echo Before:
prtvtoc $destination
echo
repeat | fmthard -s - $destination
echo After:
prtvtoc $destination
exit 0

Maybe you can adapt some of this for your purposes.