Top
ETERNUS SF AdvancedCopy Manager V16.9A Operation Guide
FUJITSU Storage

C.2.2 Pre-processing When Replication Is Executed

The replication source volume script (RepSrc.pre) and the replication destination volume script (RepDst.pre) are prepared for a pre-processing script, and it is stored in the following directory. Customize these scripts according to the processing requirements.

/etc/opt/FJSVswsrp/sh

Replication Source Volume Pre-processing Sample Script (RepSrc.pre)

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

Replication Destination Volume Pre-processing Sample Script (RepDst.pre)

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