Popular Posts

Jun 25, 2019

Solaris - Script to label multiple disks

Solaris - Script to Label Multiple Disks

APPLIES TO :  Oracle SPARC Solaris

ISSUE : Assigning N number disks to a new server and labeling the disks one by one is a painful task to the Administrators 

GOAL :  Create a Script to Label the disks

SOLUTION :  Create a Script to Label the disks to make Admins Life easier.

Create three Files :   

               1. Create file named /root/format and update the below entries.
                          bash # vi /root/format
                                          label
                                          quit

               2. Create file named /root/new_disks and update list of disks to be labelled.
                          bash # vi /root/new_disks
                                          c0t0d0
                                          c0t1d0
                                          c1t0d0
                                          c1t1d0
                                          c2t0d0
                                          c2t1d0
                                          c3t0d0
                                          c3t1d0

               3. Create script named /root/label.sh and update the below script.
                         # bash # vi /root/label.sh
                                          #!/bin/ksh
                                          #label.sh - Script to label multiple disks in Solaris
                                          for i in `cat /root/new_disks` ;    do
                                                format -s -f /root/format $i                                          
                                                echo "Disk Label Done - $i "
                                          done

               4. Change the permission and execute the script.
                         # bash # chmod 755 /root/label.sh  
                         # bash # ./label.sh
                         Disk Label Done - c0t0d0
                         Disk Label Done - c0t1d0
                         Disk Label Done - c1t0d0
                         Disk Label Done - c1t1d0
                         Disk Label Done - c2t0d0
                         Disk Label Done - c2t1d0
                         Disk Label Done - c3t0d0
                         Disk Label Done - c3t1d0

~Judi~

1 comment:

Popular Posts