2 ################################################################################
4 # File: config_disk_array
5 # RCS: $Header: config_disk_array,v 1.2 97/04/21 13:27:19 defaria Exp $
6 # Description: A script to configure a NIKE Model 20 Disk Array
7 # Author: Andrew DeFaria, California Language Labs
8 # Created: Tue Jan 28 15:59:11 PST 1997
10 # Language: Korn Shell
12 # (c) Copyright 2001, Andrew@DeFaria.com, all rights reserved
14 ################################################################################
17 if [ $(id -u) -ne 0 ]; then
18 print -u2 "$me: Error: Must be root to execute this command!"
25 while [ $# -ge 1 ]; do
29 print -u2 "$me: Error: Primary disk not specified"
37 print -u2 "$me: Error: Mirror disk not specified"
48 print -u2 "$me: Error: Unknown parameter found ($1)"
55 print "This script will configure the NIKE Model 20 Disk Array"
57 if [ "_$primary_disk" != "_" ]; then
58 print "The primary disk is at: /dev/dsk/$primary_disk"
61 if [ "_$mirror_disk" != "_" ]; then
62 print "The mirror disk is at: /dev/dsk/$mirror_disk"
67 if [ "_$primary_disk" = "_" -a "_$mirror_disk" = "_" ]; then
68 print -u2 "Nothing to do!"
73 print "Are these settings correct (Y/n)?\c"
76 if [ "$answer" != "y" -a "$answer" != "Y" ]; then
77 print -u2 "Nothing done"
81 # First create the mirror disk
82 if [ "_$mirror_disk" != "_" ]; then
83 print "Creating the mirror disk"
84 /sbin/pvcreate -f /dev/rdsk/$mirror_disk
87 if [ $status -eq 0 ]; then
88 print "Mirror disk created"
90 print "Unable to create mirror disk (Status: $status)"
95 # Create Physical Volume Groups
96 if [ "_$primary_disk" != "_" ]; then
97 print "Creating Physical Volume Groups"
98 /sbin/vgextend -g primary /dev/vgvobs /dev/dsk/$primary_disk
101 # Ignore the warning about the volume already being created (Status: 2)
102 if [ $status -eq 0 -o $status -eq 2 ]; then
103 print "Physical Volume Group \"primary\" created"
105 print "Unable to create Physical Volume Group \"primary\" (Status: $status)"
110 if [ "_$mirror_disk" != "_" ]; then
111 /sbin/vgextend -g mirror /dev/vgvobs /dev/dsk/$mirror_disk
114 if [ $status -eq 0 ]; then
115 print "Physical Volume Group \"mirror\" created"
117 print "Unable to create Physical Volume Group \"mirror\" (Status: $status)"
122 if [ "_$primary_disk" = "_" ]; then
126 # Create CLO logical volume
127 print "Creating CLO Logical Volume"
129 if [ "_$mirror_disk" = "_" ]; then
130 /sbin/lvcreate -l 3004 -n CLO -r y -C n -s y -p w -d p vgvobs
132 /sbin/lvcreate -l 3004 -n CLO -m 1 -r y -C n -M y -s g -p w -d p vgvobs
137 if [ $status -eq 0 ]; then
138 print "CLO Logical Volume created"
140 print "Unable to create CLO Logical Volume (Status: $status)"
144 # Create the file system
145 print "Creating file system on CLO Logical Volume"
146 /usr/sbin/newfs -F hfs -L -i 6144 -m 5 /dev/vgvobs/rCLO
149 if [ $status -eq 0 ]; then
150 print "File system for CLO Logical Volume created"
152 print "Unable to create file system for CLO Logical Volume (Status: $status)"
156 # Mount the new CLO logical volume
157 print "Mounting CLO Logical Volume"
159 /usr/sbin/mount -o rw,suid, -F hfs /dev/vgvobs/CLO /CLO
162 if [ $status -eq 0 ]; then
163 print "CLO Logical Volume mounted"
165 print "Unable to mount CLO Logical Volume (Status: $status)"
169 # Add the /etc/fstab entry
170 print "/dev/vgvobs/CLO /CLO hfs rw,suid 0 2" >> /etc/fstab
171 print "Added CLO Logical Volume to /etc/fstab"
173 # Add the /etc/exports entry
174 print "/CLO -async" >> /etc/exports
175 print "Added CLO Logical Volume to /etc/exports as -async"
178 print "Exporting CLO Logical Volume"
179 /usr/sbin/exportfs -a
182 if [ $status -eq 0 ]; then
183 print "CLO Logical Volume exported"
185 print "Unable to export CLO Logical Volume (Status: $status)"