ETERNUS SF AdvancedCopy Manager Operator's Guide 13.0 -AIX-
Contents Index PreviousNext

Appendix A Preprocessing and Postprocessing of Backup and Restoration

This appendix describes shell scripts used for preprocessing and postprocessing of backup and restoration in AIX AdvancedCopy Manager.

A.1 Overview 

Shell scripts used for preprocessing and postprocessing of backup or restoration are started before and after backup or restoration when a backup or restore execution command is executed.

These shell scripts describe processing required by AdvancedCopy Manager to back up or restore a transaction volume.

This chapter describes the setup of preprocessing and postprocessing.

A.2 Preprocessing and Postprocessing of Backup 

Backup on AdvancedCopy Manager must be performed basically while access to a transaction volume from other processes is inhibited.

For this reason, the transaction volume is unmounted during pre-processing.

Post-processing is determined according to the operations performed during pre-processing.

Preprocessing

Postprocessing

A transaction volume was unmounted.

Remount the transaction volume.

Take no action.

Take no action.

If special preprocessing or postprocessing is required, you need to add the concerned processing to a shell script.

When customizing a script, strictly observe the following rules regarding error code:

Error code

Usage

0-99

Unusable (reserved for AdvancedCopy Manager)

100-255

Usable

For backing up the volume group that includes logical volume in which the file system has been built, see "Backup a volume group" and the script of preprocessing and postprocessing has to be customized to execute unmount/mount processing for all logical volume in which the file system has been built.

If post-processing was failed, execute the Resource match command (swstsrsemtch) because the consistency of resource information may be incomplete.

A.2.1 Preprocessing of backup

The name of the shell script for pre-processing before backup processing is as follows.

In the case of non-cluster operation

/etc/opt/FJSVswsts/sh/OpcBackup.pre

In the case of cluster operation

/etc/opt/FJSVswsts/<logic node name>/sh/OpcBackup.pre

   1: #!/bin/sh
   2: 
   3: # AdvancedCopy Manager
   4: # All Rights Reserved, Copyright FUJITSU LIMITED, 2004-2006
   5: 
   6: #
   7: #   Preprocessing of backup processing
   8: #
   9: #       Argument: $1 Device or VG name of transaction disk
  10: #                 $2 Reserve
  11: #                 $3 Device or VG name of backup disk
  12: #
  13: #       Error number
  14: #               2: Argument error
  15: #              10: umount error
  16: #              50: varyoff error
  17: #              99: Script not customize
  18: 
  19: # Argument check
  20: case $# in
  21: 1)
  22:         ;;
  23: 2)
  24:         ;;
  25: 3)
  26:         ;;
  27: *)
  28:         exit 2
  29:         ;;
  30: esac
  31: 
  32: device=$1
  33: bk_device=$3
  34: 
  35: if [ "$SWSTGNODE" != "" ]
  36: then
  37:         swstg_node="/`echo $SWSTGNODE`"
  38: else
  39:         swstg_node=""
  40: fi
  41: 
  42: err_log_path="/var/opt/FJSVswsts"$swstg_node"/log"
  43: 
  44: # Determination of postprocessing file name
  45: if [ "`echo $device | /usr/bin/grep "/dev/hdisk"`" != "" ]
  46: then
  47:     dev_type="lvm_pv"
  48:     # /dev/hdisk? -> hdisk?
  49:     dev="`echo $device | /usr/bin/awk -F\/ '{ print $3 }'`"
  50: 
  51: elif [ "`echo $device | /usr/bin/grep "/dev/vx/dmp/"`" != "" ]
  52: then
  53:     dev_type="vxvm_pv"
  54:     # /dev/vx/dmp/device -> device
  55:     dev="`echo $device | /usr/bin/awk -F\/ '{ print $5 }'`"
  56: 
  57: elif [ "`echo $device | /usr/bin/grep "/dev/"`" != "" ]
  58: then
  59:     dev_type="lvm_vg"
  60:     # /dev/VG_Name -> VG_Name
  61:     dev="`echo $device | /usr/bin/awk -F\/ '{ print $3 }'`"
  62: 
  63: else
  64:     # Other Volume
  65:     exit 0
  66: fi
  67: 
  68: post_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".pre"
  69: 
  70: # When the transaction disk is a volume group #############################
  71: if [ "$dev_type" = "lvm_vg" ]
  72: then
  73: 
  74:         # Devices are volume group and script not customize
  75:         exit 99
  76: 
  77:         # When devices of volume group can be unmounted
  78:         # Specify the name of volume group to unmount
  79:         if [ "$device" = "/dev/vg**" ]
  80:         then
  81:                 echo "mount" > $post_file
  82: 
  83:                 # Unmount all logical volumes of the volume group
  84:                 mount_point="/**"
  85:                 /usr/sbin/umount $mount_point 2>/dev/null
  86:                 if [ $? != 0 ]
  87:                 then
  88:                     retry_count=3
  89:                     sleep_time=1
  90:                     result_flag=1
  91: 
  92:                     while [ $retry_count -gt 0 ]
  93:                     do
  94:                         /usr/sbin/umount $mount_point > $err_log_path/$dev.umount 2>&1
  95:                         if [ $? != 0 ]
  96:                         then
  97:                             retry_count=`expr $retry_count - 1`
  98:                             /usr/bin/sleep $sleep_time
  99:                         else
 100:                             /usr/bin/rm -f $err_log_path/$dev.umount
 101:                             result_flag=0
 102:                             break
 103:                         fi
 104:                     done
 105: 
 106:                     if [ $result_flag != 0 ]
 107:                     then
 108:                         /usr/sbin/fuser -cu $mount_point> $err_log_path/$dev.fuser 2>&1 
 109:                         /usr/bin/ps -ef > $err_log_path/$dev.ps 2>&1 
 110: 
 111:                         exit 10
 112:                     fi
 113:                 fi
 114: 
 115: #                mount_point="/**"
 116: #                /usr/sbin/umount $mount_point 2>/dev/null
 117: #                if [ $? != 0 ]
 118: #                then
 119: #                    /usr/sbin/umount $mount_point > $err_log_path/$dev.umount 2>&1
 120: #                    if [ $? != 0 ]
 121: #                        retry_count=3
 122: #                        sleep_time=1
 123: #                        result_flag=1
 124: #
 125: #                        while [ $retry_count -gt 0 ]
 126: #                        do
 127: #                            /usr/sbin/umount $mount_point > $err_log_path/$dev.umount 2>&1
 128: #                            if [ $? != 0 ]
 129: #                            then
 130: #                                retry_count=`expr $retry_count - 1`
 131: #                                sleep $sleep_time
 132: #                            else
 133: #                                rm -f $err_log_path/$dev.umount
 134: #                                result_flag=0
 135: #                                break
 136: #                            fi
 137: #                        done
 138: #
 139: #                        if [ $result_flag != 0 ]
 140: #                        then
 141: #                            /usr/sbin/fuser -cu $mount_point> $err_log_path/$dev.fuser 2>&1 
 142: #                            /usr/bin/ps -ef > $err_log_path/$dev.ps 2>&1 
 143: #
 144: #                            exit 10
 145: #                        fi
 146: #                    fi
 147: #                fi
 148:         fi
 149: 
 150:         # varyoff the backup volume.
 151:         BKVOL=`/usr/bin/basename $bk_device`
 152:         ACTIVE_VGS=`/usr/sbin/lsvg -o`
 153:         for i in $ACTIVE_VGS
 154:         do
 155:                 if [ "$BKVOL" = "$i" ]
 156:                 then
 157:                         /usr/sbin/varyoffvg $i 2> /dev/null
 158:                         if [ $? != 0 ]
 159:                         then
 160:                             /usr/sbin/varyoffvg $i > $err_log_path/$dev.varyoffvg 2>&1
 161:                             if [ $? != 0 ]
 162:                             then
 163:                                 exit 50
 164:                             else
 165:                                 /usr/bin/rm -f $err_log_path/$dev.varyoffvg
 166:                             fi
 167:                         fi
 168:                         break
 169:                 fi
 170:         done
 171: 
 172: # When the transaction disk is a VxVM physical volume #########################
 173: elif [ "$dev_type" = "vxvm_pv" ]
 174: then
 175:         # Nothing is done to VxVM physical volume. 
 176:         echo "none" > $post_file
 177: 
 178: # When the transaction disk is a LVM physical volume ##########################
 179: elif [ "$dev_type" = "lvm_pv" ]
 180: then
 181:         # Nothing is done to LVM physical volume. 
 182:         echo "none" > $post_file
 183: 
 184: fi
 185: exit 0

A.2.2 Postprocessing of backup 

The name of the shell script for post-processing before backup processing is as follows.

In the case of non-cluster operation

/etc/opt/FJSVswsts/sh/OpcBackup.post

In the case of cluster operation

/etc/opt/FJSVswsts/<logic node name>/sh/OpcBackup.post

   1: #!/bin/sh
   2: 
   3: # AdvancedCopy Manager
   4: # All Rights Reserved, Copyright FUJITSU LIMITED, 2004-2006
   5: 
   6: #
   7: #   Postprocessing of backup processing
   8: #
   9: #               Argument: $1 Device or VG name of transaction disk
  10: #                         $2 Reserve
  11: #
  12: #       Error number
  13: #                2: Argument error
  14: #               11: mount error
  15: 
  16: # Argument check
  17: case $# in
  18: 1)
  19:         ;;
  20: 2)
  21:         ;;
  22: *)
  23:         exit 2
  24:         ;;
  25: esac
  26: 
  27: device=$1
  28: 
  29: if [ "$SWSTGNODE" != "" ]
  30: then
  31:         swstg_node="/`echo $SWSTGNODE`"
  32: else
  33:         swstg_node=""
  34: fi
  35: 
  36: err_log_path="/var/opt/FJSVswsts"$swstg_node"/log"
  37: 
  38: # Determination of postprocessing file name
  39: if [ "`echo $device | /usr/bin/grep "/dev/hdisk"`" != "" ]
  40: then
  41:     dev_type="lvm_pv"
  42:     # /dev/hdisk? -> hdisk?
  43:     dev="`echo $device | /usr/bin/awk -F\/ '{ print $3 }'`"
  44: 
  45: elif [ "`echo $device | /usr/bin/grep "/dev/vx/dmp/"`" != "" ]
  46: then
  47:     dev_type="vxvm_pv"
  48:     # /dev/vx/dmp/device -> device
  49:     dev="`echo $device | /usr/bin/awk -F\/ '{ print $5 }'`"
  50: 
  51: elif [ "`echo $device | /usr/bin/grep "/dev/"`" != "" ]
  52: then
  53:     dev_type="lvm_vg"
  54:     # /dev/VG_Name -> VG_Name
  55:     dev="`echo $device | /usr/bin/awk -F\/ '{ print $3 }'`"
  56: 
  57: else
  58:     # Other Volume
  59:     exit 0
  60: fi
  61: 
  62: post_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".pre"
  63: 
  64: # Confirmation of postprocessing
  65: if [ ! -r $post_file ]
  66: then
  67:         exit 0
  68: fi
  69: post="`/usr/bin/cat $post_file`"
  70: 
  71: # mount processing
  72: if [ "$post" = "mount" ]
  73: then
  74: 
  75: # When devices of volume group can be unmounted
  76: # Specify the name of volume group to mount
  77: 
  78:         if [ "$device" = "/dev/vg**" ]
  79:         then
  80:                 mount_error=0
  81: 
  82:                 # Mount all logical volumes of the volume group
  83:                 lvname="/dev/*****"
  84:                 lv_mount_point="/**"
  85:                 mount_status=`/usr/sbin/mount | /usr/bin/nawk -v lv=${lvname} 'lv==$1{flag=1; exit;} END{if(flag==1) print "mounted"; else print "not_mounted";}'`
  86:                 if [ $mount_status = "not_mounted" ]
  87:                 then
  88:                         /usr/sbin/mount $lvname $lv_mount_point 2> /dev/null
  89:                         if [ $? != 0 ]
  90:                         then
  91:                                 retry_count=3
  92:                                 sleep_time=1
  93:                                 result_flag=1
  94: 
  95:                                 while [ $retry_count -gt 0 ]
  96:                                 do
  97:                                     /usr/sbin/mount $lvname $lv_mount_point > $err_log_path/$dev.mount 2>&1
  98:                                     if [ $? != 0 ]
  99:                                     then
 100:                                         retry_count=`expr $retry_count - 1`
 101:                                         /usr/bin/sleep $sleep_time
 102:                                     else
 103:                                         /usr/bin/rm -f $err_log_path/$dev.mount
 104:                                         result_flag=0
 105:                                         break
 106:                                     fi
 107:                                 done
 108: 
 109:                                 if [ $result_flag != 0 ]
 110:                                 then
 111:                                     mount_error=1
 112:                                 fi
 113:                         fi
 114:                 fi
 115:                 
 116: #                lvname="/dev/*****"
 117: #                lv_mount_point="/**"
 118: #                mount_status=`/usr/sbin/mount | /usr/bin/nawk -v lv=${lvname} 'lv==$1{flag=1; exit;} END{if(flag==1) print "mounted"; else print "not_mounted";}'`
 119: #                if [ $mount_status = "not_mounted" ]
 120: #                then
 121: #                        /usr/sbin/mount $lvname $lv_mount_point 2> /dev/null
 122: #                        if [ $? != 0 ]
 123: #                        then
 124: #                                retry_count=3
 125: #                                sleep_time=1
 126: #                                result_flag=1
 127: #
 128: #                                while [ $retry_count -gt 0 ]
 129: #                                do
 130: #                                    /usr/sbin/mount $lvname $lv_mount_point > $err_log_path/$dev.mount 2>&1
 131: #                                    if [ $? != 0 ]
 132: #                                    then
 133: #                                        retry_count=`expr $retry_count - 1`
 134: #                                        /usr/bin/sleep $sleep_time
 135: #                                    else
 136: #                                        rm -f $err_log_path/$dev.mount
 137: #                                        result_flag=0
 138: #                                        break
 139: #                                    fi
 140: #                                done
 141: #
 142: #                                if [ $result_flag != 0 ]
 143: #                                then
 144: #                                    mount_error=1
 145: #                                fi
 146: #                        fi
 147: #                fi
 148: 
 149:                 if [ $mount_error != 0 ]
 150:                 then
 151:                         exit 11
 152:                 fi
 153:         fi
 154: fi
 155: 
 156: /usr/bin/rm -rf $post_file 2> /dev/null
 157: exit 0

+Backup a volume group

When the volume group containing the logic volume by which the file system was built is a candidate for backup, it is necessary to correct an order processing script.

Please comment ("#")-turn the exit sentence of the 75th line of a pretreatment script (OpcBackup.pre) after correcting a script.

Note that unmount/mount processing to a volume group is not carried out in the state where not customized.

If the backup volume is a volume group, deactivate the backup volume during backup pre-processing.

Please correct suitably parameters, options, etc. of the OS command, such as the mount command and the fsck command, according to employment.

+When cluster operation by VERITAS Cluster Server

Customize of a preprocessing and postprocessing script is needed, when performing cluster oprating by VERITAS Cluster Server, and when mount point of transaction volume is registered into cluster transaction.

Please change unmount/mount processing in preprocessing and postprocessing script into offline/online processing of mount point resource.

Moreover, the Volume is actually after doing offline/online of mount point resource and there will be a time difference by the time mount/unmount is done.

Therefore, please add the processing (The Result of sleep and the df Command is observed) meets until mount/unmount is actually done after the location where the success or failure of offline/online is judged.

The examples below show how the preprocessing and postprocessing scripts are modified.

[Example] unmount processing change of backup preprocessing script (OpcBackup.pre)
[lines 85,94,116,119,127th]

(Before change)

/usr/sbin/umount $mount_point

(after change)

/opt/VRTSvcs/bin/hares -offline resource-name -sys system-name


[Example] unmount wait processing addition of backup preprocessing script (OpcBackup.pre)
[line 114,148th]

(addition)

mount_status="mounted"
while [ $mount_status = "mounted" ]
do
mount_status=`/usr/sbin/mount | /usr/bin/nawk -v lv=/dev/***** 'lv==$1{flag=1; exit;} END{if(flag==1) print "mounted"; else print "not_mounted";}'`
done

[Example] mount processing change of backup postprocessing script (OpcBackup.post)
[lines 88,97,121,130th]

(Before change)

/usr/sbin/mount $lvname $lv_mount_point

(after change)

/opt/VRTSvcs/bin/hares -online resource-name -sys system-name

[Example] mount wait processing addition of backup postprocessing script (OpcBackup.post)
[lines 115,148th]

(addition)

mount_status="not_mounted"
while [ $mount_status = "not_mounted" ]
do
mount_status=`/usr/sbin/mount | /usr/bin/nawk -v lv=$lvname 'lv==$1{flag=1; exit;} END{if(flag==1) print "mounted"; else print "not_mounted";}'`
done

A.3 Preprocessing and Postprocessing of Restoration 

In AdvancedCopy Manager, restore processing must be performed while transaction volumes are unmounted.

Therefore, transaction volume is unmounted in pre-processing.

What to do in the postprocessing must be determined depending on what has been done in the preprocessing.

Preprocessing

Postprocessing

A transaction volume was unmounted.

Remount the transaction volume.

Take no action.

Take no action.

If special preprocessing or postprocessing is required, you need to add the concerned processing to a shell script.

When customizing a script, strictly observe the following rules regarding error code:

Error code

Usage

0-99

Unusable (reserved for AdvancedCopy Manager)

100-255

Usable

When restoring a volume group that includes the logical volumes in which a file system is constructed, see "Restore a volume group", and customize the script of preprocessing and postprocessing so that the unmount/mount processing is carried out for all logical volumes in which a file system is constructed.

If pos-tprocessing was failed, execute the Resource match command (swstsrsemtch) because the consistency of resource information may be incomplete.

A.3.1 Preprocessing of restoration 

The name of the shell script for pre-processing before restore processing is as follows.

In the case of non-cluster operation

/etc/opt/FJSVswsts/sh/OpcRestore.pre

In the case of cluster operation

/etc/opt/FJSVswsts/<logic node name>/sh/OpcRestore.pre

   1: #!/bin/sh
   2: 
   3: # AdvancedCopy Manager
   4: # All Rights Reserved, Copyright FUJITSU LIMITED, 2004-2006
   5: 
   6: #
   7: #   Preprocessing of restoration processing
   8: #
   9: #               Argument: $1 Device or VG name of transaction disk
  10: #                         $2 Reserve
  11: #
  12: #       Error number
  13: #               2: Argument error
  14: #              10: umount error
  15: #              50: varyoff error
  16: #              99: Script not customize
  17: 
  18: # Argument check
  19: case $# in
  20: 1)
  21:         ;;
  22: 2)
  23:         ;;
  24: *)
  25:         exit 2
  26:         ;;
  27: esac
  28: 
  29: device=$1
  30: 
  31: if [ "$SWSTGNODE" != "" ]
  32: then
  33:         swstg_node="/`echo $SWSTGNODE`"
  34: else
  35:         swstg_node=""
  36: fi
  37: 
  38: err_log_path="/var/opt/FJSVswsts"$swstg_node"/log"
  39: 
  40: # Determination of postprocessing file name
  41: if [ "`echo $device | /usr/bin/grep "/dev/hdisk"`" != "" ]
  42: then
  43:     dev_type="lvm_pv"
  44:     # /dev/hdisk? -> hdisk?
  45:     dev="`echo $device | /usr/bin/awk -F\/ '{ print $3 }'`"
  46: 
  47: elif [ "`echo $device | /usr/bin/grep "/dev/vx/dmp/"`" != "" ]
  48: then
  49:     dev_type="vxvm_pv"
  50:     # /dev/vx/dmp/device -> device
  51:     dev="`echo $device | /usr/bin/awk -F\/ '{ print $5 }'`"
  52: 
  53: elif [ "`echo $device | /usr/bin/grep "/dev/"`" != "" ]
  54: then
  55:     dev_type="lvm_vg"
  56:     # /dev/VG_Name -> VG_Name
  57:     dev="`echo $device | /usr/bin/awk -F\/ '{ print $3 }'`"
  58: 
  59: else
  60:     # Other Volume
  61:     exit 0
  62: fi
  63: 
  64: post_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".pre"
  65: 
  66: # When the transaction disk is a volume group #############################
  67: if [ "$dev_type" = "lvm_vg" ]
  68: then
  69: 
  70:         # Devices are volume group and script not customize
  71:         exit 99
  72: 
  73:         # When devices of volume group was mounted
  74:         # Specify the name of volume group to unmount
  75:         if [ "$device" = "/dev/vg**" ]
  76:         then
  77:                 echo "mount" > $post_file
  78: 
  79:                 # Unmount all logical volumes of the volume group
  80:                 mount_point="/**"
  81:                 /usr/sbin/umount $mount_point 2>/dev/null
  82:                 if [ $? != 0 ]
  83:                 then
  84:                     retry_count=3
  85:                     sleep_time=1
  86:                     result_flag=1
  87: 
  88:                     while [ $retry_count -gt 0 ]
  89:                     do
  90:                         /usr/sbin/umount $mount_point > $err_log_path/$dev.umount 2>&1
  91:                         if [ $? != 0 ]
  92:                         then
  93:                             retry_count=`expr $retry_count - 1`
  94:                             /usr/bin/sleep $sleep_time
  95:                         else
  96:                             /usr/bin/rm -f $err_log_path/$dev.umount
  97:                             result_flag=0
  98:                             break
  99:                         fi
 100:                     done
 101: 
 102:                     if [ $result_flag != 0 ]
 103:                     then
 104:                         /usr/sbin/fuser -cu $mount_point> $err_log_path/$dev.fuser 2>&1 
 105:                         /usr/bin/ps -ef > $err_log_path/$dev.ps 2>&1 
 106: 
 107:                         exit 10
 108:                     fi
 109:                 fi
 110: 
 111: #                mount_point="/**"
 112: #                /usr/sbin/umount $mount_point 2>/dev/null
 113: #                if [ $? != 0 ]
 114: #                then
 115: #                    retry_count=3
 116: #                    sleep_time=1
 117: #                    result_flag=1
 118: #
 119: #                    while [ $retry_count -gt 0 ]
 120: #                    do
 121: #                        /usr/sbin/umount $mount_point > $err_log_path/$dev.umount 2>&1
 122: #                        if [ $? != 0 ]
 123: #                        then
 124: #                            retry_count=`expr $retry_count - 1`
 125: #                            sleep $sleep_time
 126: #                        else
 127: #                            rm -f $err_log_path/$dev.umount
 128: #                            result_flag=0
 129: #                            break
 130: #                        fi
 131: #                    done
 132: #
 133: #                    if [ $result_flag != 0 ]
 134: #                    then
 135: #                        /usr/sbin/fuser -cu $mount_point> $err_log_path/$dev.fuser 2>&1 
 136: #                        /usr/bin/ps -ef > $err_log_path/$dev.ps 2>&1 
 137: #
 138: #                        exit 10
 139: #                    fi
 140: #                fi
 141:         fi
 142: 
 143:         # varyoff the transaction volume.
 144:         ACTIVE_VGS=`/usr/sbin/lsvg -o`
 145:         for i in $ACTIVE_VGS
 146:         do
 147:                 if [ "$dev" = "$i" ]
 148:                 then
 149:                         /usr/sbin/varyoffvg $i 2> /dev/null
 150:                         if [ $? != 0 ]
 151:                         then
 152:                             /usr/sbin/varyoffvg $i > $err_log_path/$dev.varyoffvg 2>&1
 153:                             if [ $? != 0 ]
 154:                             then
 155:                                 exit 50
 156:                             else
 157:                                 /usr/bin/rm -f $err_log_path/$dev.varyoffvg 2>&1
 158:                             fi
 159:                         fi
 160:                         break
 161:                 fi
 162:         done
 163: 
 164: # When the transaction disk is a VxVM physical volume #########################
 165: elif [ "$dev_type" = "vxvm_pv" ]
 166: then
 167:         # Nothing is done to VxVM physical volume. 
 168:         echo "none" > $post_file
 169: 
 170: # When the transaction disk is a LVM physical volume ##########################
 171: elif [ "$dev_type" = "lvm_pv" ]
 172: then
 173:         # Nothing is done to LVM physical volume. 
 174:         echo "none" > $post_file
 175: 
 176: fi
 177: 
 178: exit 0

Restore processing is not possible on a mounted transaction volume that cannot be unmounted. Specify a device at the restore destination.

A.3.2 Postprocessing of restoration 

The name of the shell script for post-processing after restore processing is as follows.

In the case of non-cluster operation

/etc/opt/FJSVswsts/sh/OpcRestore.post

In the case of cluster operation

/etc/opt/FJSVswsts/<logic node name>/sh/OpcRestore.post

   1: #!/bin/sh
   2: 
   3: # AdvancedCopy Manager
   4: # All Rights Reserved, Copyright FUJITSU LIMITED, 2004-2006
   5: 
   6: #
   7: #   Postprocessing of restoration processing
   8: #
   9: #               Argument: $1 Device or VG name of transaction disk
  10: #                         $2 Reserve
  11: #
  12: #       Error number
  13: #               2: Argument error
  14: #              11: mount error
  15: #              51: varyon error
  16: 
  17: # Argument check
  18: case $# in
  19: 1)
  20:         ;;
  21: 2)
  22:         ;;
  23: *)
  24:         exit 2
  25:         ;;
  26: esac
  27: 
  28: device=$1
  29: 
  30: if [ "$SWSTGNODE" != "" ]
  31: then
  32:         swstg_node="/`echo $SWSTGNODE`"
  33: else
  34:         swstg_node=""
  35: fi
  36: 
  37: err_log_path="/var/opt/FJSVswsts"$swstg_node"/log"
  38: 
  39: # Determination of postprocessing file name
  40: if [ "`echo $device | /usr/bin/grep "/dev/hdisk"`" != "" ]
  41: then
  42:     dev_type="lvm_pv"
  43:     # /dev/hdisk? -> hdisk?
  44:     dev="`echo $device | /usr/bin/awk -F\/ '{ print $3 }'`"
  45: 
  46: elif [ "`echo $device | /usr/bin/grep "/dev/vx/dmp/"`" != "" ]
  47: then
  48:     dev_type="vxvm_pv"
  49:     # /dev/vx/dmp/device -> device
  50:     dev="`echo $device | /usr/bin/awk -F\/ '{ print $5 }'`"
  51: 
  52: elif [ "`echo $device | /usr/bin/grep "/dev/"`" != "" ]
  53: then
  54:     dev_type="lvm_vg"
  55:     # /dev/VG_Name -> VG_Name
  56:     dev="`echo $device | /usr/bin/awk -F\/ '{ print $3 }'`"
  57: 
  58: else
  59:     # Other Volume
  60:     exit 0
  61: fi
  62: 
  63: post_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".pre"
  64: 
  65: if [ "$dev_type" = "lvm_vg" ]
  66: then
  67:     # varyon the transaction volume
  68:     /usr/sbin/varyonvg $dev 2> /dev/null
  69:     if [ $? != 0 ]
  70:     then
  71:         /usr/sbin/varyonvg $dev > $err_log_path/$dev.varyonvg 2>&1
  72:         if [ $? != 0 ]
  73:         then
  74:             exit 51
  75:         else
  76:             /usr/bin/rm -f $err_log_path/$dev.varyonvg
  77:         fi
  78:     fi
  79: fi
  80: 
  81: # Confirmation of postprocessing
  82: if [ ! -r $post_file ]
  83: then
  84:         exit 0
  85: fi
  86: post="`/usr/bin/cat $post_file`"
  87: 
  88: # mount processing
  89: if [ "$post" = "mount" ]
  90: then
  91: 
  92: # When devices of volume group was mounted
  93: # Specify the name of volume group to mount
  94: 
  95:         if [ "$device" = "/dev/vg**" ]
  96:         then
  97:                 mount_error=0
  98: 
  99:                 # Mount all logical volumes of the volume group
 100:                 lvname="/dev/*****"
 101:                 lv_mount_point="/**"
 102:                 mount_status=`/usr/sbin/mount | /usr/bin/nawk -v lv=${lvname} 'lv==$1{flag=1; exit;} END{if(flag==1) print "mounted"; else print "not_mounted";}'`
 103:                 if [ $mount_status = "not_mounted" ]
 104:                 then
 105:                         /usr/sbin/mount $lvname $lv_mount_point 2> /dev/null
 106:                         if [ $? != 0 ]
 107:                         then
 108:                                 retry_count=3
 109:                                 sleep_time=1
 110:                                 result_flag=1
 111: 
 112:                                 while [ $retry_count -gt 0 ]
 113:                                 do
 114:                                     /usr/sbin/mount $lvname $lv_mount_point > $err_log_path/$dev.mount 2>&1
 115:                                     if [ $? != 0 ]
 116:                                     then
 117:                                         retry_count=`expr $retry_count - 1`
 118:                                         /usr/bin/sleep $sleep_time
 119:                                     else
 120:                                         /usr/bin/rm -f $err_log_path/$dev.mount
 121:                                         result_flag=0
 122:                                         break
 123:                                     fi
 124:                                 done
 125: 
 126:                                 if [ $result_flag != 0 ]
 127:                                 then
 128:                                     mount_error=1
 129:                                 fi
 130:                         fi
 131:                 fi
 132: 
 133: #                lvname="/dev/*****"
 134: #                lv_mount_point="/**"
 135: #                mount_status=`/usr/sbin/mount | /usr/bin/nawk -v lv=${lvname} 'lv==$1{flag=1; exit;} END{if(flag==1) print "mounted"; else print "not_mounted";}'`
 136: #                if [ $mount_status = "not_mounted" ]
 137: #                then
 138: #                        /usr/sbin/mount $lvname $lv_mount_point 2> /dev/null
 139: #                        if [ $? != 0 ]
 140: #                        then
 141: #                                retry_count=3
 142: #                                sleep_time=1
 143: #                                result_flag=1
 144: #
 145: #                                while [ $retry_count -gt 0 ]
 146: #                                do
 147: #                                    /usr/sbin/mount $lvname $lv_mount_point > $err_log_path/$dev.mount 2>&1
 148: #                                    if [ $? != 0 ]
 149: #                                    then
 150: #                                        retry_count=`expr $retry_count - 1`
 151: #                                        /usr/bin/sleep $sleep_time
 152: #                                    else
 153: #                                        rm -f $err_log_path/$dev.mount
 154: #                                        result_flag=0
 155: #                                        break
 156: #                                    fi
 157: #                                done
 158: #
 159: #                                if [ $result_flag != 0 ]
 160: #                                then
 161: #                                    mount_error=1
 162: #                                fi
 163: #                        fi
 164: #                fi
 165: 
 166:                 if [ $mount_error != 0 ]
 167:                 then
 168:                         exit 11
 169:                 fi
 170:         fi
 171: fi
 172: 
 173: /usr/bin/rm -rf $post_file 2> /dev/null
 174: exit 0

+Restore a volume group

When the volume group containing the logic volume by which the file system was built is a candidate for restoration, it is necessary to correct an order processing script.

Please comment ("#")-turn the exit sentence of the 71th line of a pretreatment script (OpcRestore.pre) after correcting a script.

Note that unmount/mount processing to a volume group is not carried out in the state where not customized.

Please correct suitably parameters, options, etc. of the OS command, such as the mount command and the fsck command, according to employment.

+When cluster operation by VERITAS Cluster Server

Customize of a preprocessing and postprocessing script is needed, when performing cluster oprating by VERITAS Cluster Server, and when mount point of transaction volume is registered into cluster transaction.

Please change unmount/mount processing in preprocessing and postprocessing script into offline/online processing of mount point resource.

Moreover, the Volume is actually after doing offline/online of mount point resource and there will be a time difference by the time mount/unmount is done.

Therefore, please add the processing (The Result of sleep and the df Command is observed) meets until mount/unmount is actually done after the location where the success or failure of offline/online is judged.

The examples below show how the preprocessing and postprocessing scripts are modified.

[Example] unmount processing change of restoration preprocessing script (OpcRestore.pre)
[lines 81,90,112,121st]

(Before change)

/usr/sbin/umount $mount_point

(after change)

/opt/VRTSvcs/bin/hares -offline resource-name -sys system-name


[Example] unmount wait processing addition of restoration preprocessing script (OpcRestore.pre)
[line 110,141st]

(addition)

mount_status="mounted"
while [ $mount_status = "mounted" ]
do
mount_status=`/usr/sbin/mount | /usr/bin/nawk -v lv=$lvname 'lv==$1{flag=1; exit;} END{if(flag==1) print "mounted"; else print "not_mounted";}'`
done

[Example] mount processing change of restoration postprocessing script (OpcRestore.post)
[lines 105,114,138,147th]

(Before change)

/usr/sbin/mount $lvname $lv_mount_point

(after change)

/opt/VRTSvcs/bin/hares -online resource-name -sys system-name

[Example] mount wait processing addition of restoration postprocessing script (OpcRestore.post)
[line 132,165th]

(addition)

mount_status="not_mounted"
while [ $mount_status = "not_mounted" ]
do
mount_status=`/usr/sbin/mount | /usr/bin/nawk -v lv=$lvname 'lv==$1{flag=1; exit;} END{if(flag==1) print "mounted"; else print "not_mounted";}'`
done


Contents Index PreviousNext

All Rights Reserved, Copyright (C) FUJITSU LIMITED 2002-2006