#!/usr/bin/ksh # The shell will save the volume group descriptions for the # non-rootvg volume groups using the savevg command. This # output can be used by the restore vg command to recreate # the volume groups. For example: # restvg -qf /vg_images/savevg.$VGNAME rm -f /vg_images/savevg.* rm -f /tmp/savevg integer total_error=0 # 1) get the non-rootvg volume groups (vg) # 2) get the logical volumes (lv) by vg's, remove the header # line, remove the unmounted & raw lv's, remove the nfs # mounted files and print the mount point. # 3) save the mount point in /etc/exclude.$VGNAME # 4) save the volume group information for each volume group, # while excluding the actual files, in /vg_images/savevg.$VGNAME lsvg -o |grep -v rootvg |while read VGNAME do lsvg -l $VGNAME |grep -v LV | grep -v "N/A" | grep / | awk '{print $7 "/"} ' \ > /etc/exclude.$VGNAME savevg -eif/vg_images/savevg.$VGNAME $VGNAME >> /tmp/savevg 2>&1 (( total_error = total_error + $? )) done if (( total_error > 0 )) then /bin/mail -s "`hostname`: savevg had errors" admin < /tmp/savevg exit 1 fi exit 0