Occassionally I have been asked to conduct a proof of concept for Symantec Cluster Server for SAP on AIX. These environments frequently include a large number of file systems, volumes, and volume groups. While it is certainly possible to construct a main.cf by hand, I usually ended up making a fair number of typographical errors. Instead I found it more useful to write a script to gather as much of this data as possible, format it as a portion of a main.cf file, and then allow me to edit the file as needed to complete the first draft of the configuration. This is that script.
# Gen-lvm-vcs for AIX
#
# Syntax
#
# gen-lvm-vcs [ vg ]
#
# purpose: generate VERITAS Cluster Server main.cf pragma for LVMVG
# and Mount resources.
#
# input: none
#
# output: LVMVG and Mount resources, plus resource dependencies
# between them.
#
# Description:
#
# Gen-lvm-vcs examines the current system for available (varied on)
# logical volume groups (LVM), and their volumes and corresponding
# file systems. It then generates a fragment of VCS's main.cf, that
# includes
#
# - an LVMVG resource for each volume group,
# - a Mount resource for each file system,
# - and a resource dependency between each file system and its volume
# group, as well as between file systems.
#
# Normally gen-lvm-vcs considers all volume groups besides swap and
# rootvg. However you can also run gen-lvm-vcs on a specified volume
# group, e.g., rootvg. Normally rootvg is not a candidate for VCS
# control, since it is local to the host. However there are some
# circumstances where it is useful to put some local filesystems (not
# the volumes or volume groups) under VCS control, for example, on a
# host running an SAP application server, where the AS and its file
# systems are meant to be shut down and 'replaced' by shared file
# systems and a database/central instance upon failover. In this
# case, the local filesystems are brought up and down by VCS but never
# failed over.
#
# assumptions and limitations:
#
# AIX environment. Tested on 5.X. Might work on 4.X.
#
# Volume groups are assumed to be varied on, otherwise they are
# ignored.
#
# Volume groups are installed on shared disks, otherwise VCS will
# not succeed in failing over them.
#
# Filesystems are mounted. This is needed to identify mount
# options. I suppose /etc/filesystems could be used instead, but
# this captures the current dynamic state.
#
# We consider all volume groups other than swap and rootvg. This
# can be over-ridden by specifying a volume group.
#
# We use the existing major number for the volume group as is. This
# may not be correct, and thus require further work. See the VCS AIX
# manual.
#
# File system dependencies do not handle symbolic links. Sorry.
# Just too hard. Maybe another day.
#
# NFS filesystems are ignored. This is not handled by the Mount
# resource anyway.