You are here: Administration > Man Pages > devicehier(1M)

devicehier(1M)

NAME

devicehier(1M) — scripts used to create common resource hierarchies

SYNOPSIS

LKROOT/lkadm/bin/devicehier primach dev secmach

LKROOT/lkadm/bin/filesyshier primach primp pritag secmp sectag secmach priswitchbacktype secswitchbacktype

LKROOT/lkadm/bin/findsec [-m mount-point] | [-d adev] | [-b adev]secmach

DESCRIPTION

The scripts devicehier and filesyshier are used by LifeKeeper to create resource hierarchies for physical disk devices and file systems, respectively. The findsec program can be used to verify the secondary system name and/or the corresponding shared bus name on the secondary system given a device or filesy stem mount point. These scripts can be used by recovery kit designers to simplify and improve the ease of use of their recovery kits to allow them to link to already existing resource hierarchy software.

The basic design of the scripts is first to test if the requested resource hierarchies already exist, and if they do, to return to Unix stdout the resource tag name of the root resources (separated by the ^A character) to the hierarchies on the primary and secondary systems. All other messages, both errors and notices, are redirected to Unix stderr. If the hierarchies do not already exist, they are created on both the primary and secondary systems and their tag names are returned to Unix stdout.

SYNTAX

devicehier primach dev secmach

This script is used to create the resource hierarchies for the physical device dev on the system primach and the system that is also connected on the shared bus to the physical device dev. The tag names of the created hierarchies are returned to Unix stdout separated by the ^A character. If the hierarchies already exist, the tag names of the existing hierarchies are returned. The script expects the dev argument to be the "basename" of the device path to the physical slice; for example, sde1.

filesyshier primach primp pritag secmp sectag secmach priswitchbacktype secswitchbacktype

This script is used to create the resource hierarchies for the file system with mount point primp on system primach with the file system resource instance created with tag pritag. A file system resource hierarchy will also be created using mount point secmp on system secmach with the file systemr esource instance created with tag sectag. The script assumes that the file system primp is already mounted on system primach and that there is no filesystem already mounted on the mount point secmp on system secmach (this mount point must be reserved to mount primp when recovery occurs). The tag names of the created hierarchies are returned to Unix stdout separated by the ^A character. If the hierarchies already exist, the tag names of the existing hierarchies are returned. The pritag and sectag arguments can be set to the "zero length string" of "" in which case tag names will by dynamically generated. The priswitchbacktype and secswitchbacktype are the switchback type for all resources in the hierarchy. The valid value is either "intelligent" or "automatic". Passing a null string (i.e."") will generate the default value of "intelligent".

findsec [-m mount-point] | [-d adev] | [-b adev] secmach

If the mount-point argument of the -m option is specified, this program will determine if the mount-point is the mount-point of a mounted file system, and if so, if it is mounted on a disk that is shared with system secmach. If the file system is shared with secmach the system name will be printed to stdout.

The adev argument is the full path name of the device on the local system. If the adev argument of the -d option is specified, this program will determine if adev is a slice that is shared with secmach. If everything succeeds, it prints to Unix stdout the shared bus name, for example sde, that is connected to the specified shared device adev that is reserved on the secondary system, from the viewpoint of the secondary system.

The -b option is basically the same as the -d option, except that both the secondary system name and the corresponding shared bus name (respectively) are printed to Unix stdout. The system name and shared bus name are separated by the ^A character (ASCII 01).

The secmach argument is a system name. The findsec program audits if secmach is in the cluster and shares the specified resource.

EXAMPLE 1

The following illustrates how to use the findsec program:

#

# Determine if device $DEV is a shared device and return # the name of the secondary system and the host adaptor # number that the shared device file is accessed from.

#

B=$LKROOT/bin LK=$LKROOT/lkadm

SECMACH_HA='$B/lcdremexec -d$PRIMACH &LK/bin/findsec -b"/dev/dsk/$DEB"'

if [ $? != 0 ]

then

echo $CMD: '*ERROR50*' create device hierarchy failure>&2

exit 1

fi

SECMACH='echo "$SECMACH_HA" | cut -d^A -f1'

SECHOSTADP='echo "$SECMACH_HA" | cut -d^a -f2'

EXAMPLE 2

The following illustrates how to use the devicehier script:

#

# All physical disk hierarchies are created using"devicehier".

#

LK=$LKROOT/lkadm

DEV='basename $PRIDEV'

TAGS='$LK/bin/devicehier "$PRIMACH" "$DEV"'

if [ $? != 0 ]

then

echo $CMD: '*ERROR70*' create file system hierarchy failure>&2

exit 1

fi

#

# The following resource tag names are the root resource

# hierarchy tags on the primary and secondary round or just

# created. These tag names are provided to create a new

# application resource type that can depend on these

# hierarchies. The "*devicehier" scripts pass back to the

# calling script in UNIX stdout the tag names separated by

# the ^A character.

#

PRIDEVTAG='echo "$TAGS" | cut -d^A -f1'

SECDEVTAG='echo "$TAGS" | cut -d^A -f2'

EXAMPLE 3

Resource hierarchy creation should be designed as a global operation that must be run atomically, that is, no other global operation should be running when resource creation is being performed. This is done using the "adminlock flags." The following illustrates using the "admin lock flags" [see getlocks(1M) for more details] in the creation of a file system hierarchy:

log "lifekeeper: Creating File System Hierarchy $PRIMP on..."

err=1

trap "rm -f /tmp/FSLOCKS$$; exit $err" 0 1 2 3 4 6 7 8 10

12 13 15 19

echo "CREATING RESOURCE HIERARCHIES" >&2

LK=/usr/sadm/sysadm/add-ons/lk/applmgmt/LifeKeeper

PS=$LK/subsys/gen/filesys

if $LK/bin/getlocks -a "$PRIMACH" -I filesys -1 /tmp /FSLOCKS$$-o $SECMACH

then

$FS/bin/filesyshier $PRIMACH $PRIMP $PRITAG $SECMP $SECTAG $SECMACH$PRISWITCHTYPE $SECSWITCHTYPE

ret=$?

if [ "$ret" = 0 ]

then

RESULT=Successful

else

RESULT=Failed

fi

log "LifeKeeper: Create File Sys Hierarchy $PRIMP on $PRIMACH $RESULT..."

if &LK/bin/rlslocks -a "$PRIMACH" -1 /tmp/FSLOCKS$$

then

err=$ret

exit $ret

fi

fi

exit 1

EXIT CODES

The following exit codes could be returned by these commands:

0

The operation has succeeded.

1

A Unix system call or library call has internally returned failure.

2

A user-specified syntax error occurred.

3

LifeKeeper internal error.

4

A request to perform an operation on an object that already exists.

5

An argument specified is illegal.

6

Index out-of-range.

7

A request has been made on an object that does not exist.

8

A request was made to delete a resource instance on which anothernon-deleted resource instance depends.

9

An attempt to communicate with another system failed.

NOTES

The location of this utility, LKROOT, is defined in the default file /etc/default/LifeKeeper.

FILES

/etc/default/LifeKeeper

© 2012 SIOS Technology Corp., the industry's leading provider of business continuity solutions, data replication for continuous data protection.