#!/bin/sh
#@(#)vx.info	1.6 03/02/99 23:29:17
 
if [ ! -x /usr/sbin/vxprint ]
then
    # veritas is not installed
    exit 0
fi

mkdir disks/vxvm
vxprint -th  1>disks/vxvm/vxprint-th.out 2>disks/vxvm/vxprint-th.err
vxprint -h   1>disks/vxvm/vxprint-h.out 2>disks/vxvm/vxprint-h.err
vxdisk list  1>disks/vxvm/vxdisk-list.out 2>disks/vxvm/vxdisk-list.err
vxdg -q list    1>disks/vxvm/vxdg-q-list.out 2>disks/vxvm/vxdg-q-list.err

mkdir disks/vxvm/disk_groups

# list the disk groups
for i in `vxdg -q list|awk '{print $1}'`
do
    # list free space that can be used  for  allocating subdisks
    vxdg -g $i free > disks/vxvm/disk_groups/vxdg-g_free=$i.out

    # List the contents of disk group and its configuration
    vxdg list $i > disks/vxvm/disk_groups/vxdg_list=$i.out

    # list the volumes
    vxprint -vng $i > disks/vxvm/disk_groups/vxprint-vng=$i.out

    # store volume list in VOL_LIST, I need this so all volumes
    # are listed on a single line
    VOL_LIST=`cat disks/vxvm/disk_groups/vxprint-vng=$i.out`

    # this output will eliminate the dg and dm definitions, this is
    # the format vxmake expects when recreating the private area for a
    # lost disk group.
    vxprint -hmQqg $i $VOL_LIST  1>disks/vxvm/disk_groups/vxprint-hmQqg_4vxmk=$i.out 2>disks/vxvm/disk_groups/vxprint-hmQqg_4vxmk=$i.err

    # this output lists also teh dg and dm definitions, this is the
    # format vxprint expects when playing back the output later.
    vxprint -hmQqg $i 1>disks/vxvm/disk_groups/vxprint-hmQqg=$i.out 2>disks/vxvm/disk_groups/vxprint-hmQqg=$i.err

done
