前処理のシェルスクリプトには複写元ボリューム(RepSrc.Pre)と複写先ボリューム(RepDst.Pre)を用意し、以下のディレクトリ配下に格納されています。処理の必要性に応じてシェルスクリプトをカスタマイズしてください。
非クラスタ運用の場合
/etc/opt/FJSVswsrp/shディレクトリ配下 |
クラスタ運用の場合
/etc/opt/FJSVswsrp/<論理ノード名>/shディレクトリ配下 |
RepSrc.pre(複写元ボリューム前処理のシェルスクリプト)
1: #!/bin/sh 2: 3: # AdvancedCopy Manager 4: # All Rights Reserved, Copyright FUJITSU LIMITED, 2002-2008 5: 6: # 7: # Pre-processing of Replication(Source) processing 8: # 9: # Argument: $1 Device name of Source disk 10: # $2 Mount point of Source disk 11: # 12: # Error number 13: # 2: Argument 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: mount_point=$2 28: 29: # Device type check 30: # Determination postprocessing file name 31: trans="`echo $device | /usr/bin/grep -e "/dev/dsk/" -e "/dev/disk/"`" 32: lvmtrans="`echo $device | /usr/bin/grep "/dev/"`" 33: vxpvtrans="`echo $device | /usr/bin/grep "/dev/vx/dmp/"`" 34: if [ "$trans" != "" ] 35: then 36: dev_type="physical" 37: # /dev/dsk/c?t?d? -> c?t?d? 38: dev="`echo $device | /usr/bin/sed -e "s/\/dev\/dsk\///" -e "s/\/dev\/disk\//_hppv_/"`" 39: post_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".spre" 40: fstype_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".sfstype" 41: elif [ "$vxpvtrans" != "" ] 42: then 43: dev_type="vxvm_pv" 44: # /dev/vx/dmp/XXXX -> XXXX 45: dev="`echo $device | /usr/bin/awk -F\/ '{ print $5 }'`" 46: post_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".spre" 47: fstype_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".sfstype" 48: elif [ "$lvmtrans" != "" ] 49: then 50: dev_type="logical" 51: # /dev/vgXX -> vgXX 52: dev="`echo $device | /usr/bin/awk -F\/ '{ print $3 }'`" 53: post_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".spre" 54: else 55: exit 0 56: fi 57: 58: err_log_path="/var/opt/FJSVswsrp/"$SWSTGNODE"/log" 59: 60: # When the disk is a physical device ############################# 61: if [ "$dev_type" = "physical" ] 62: then 63: 64: if [ "$mount_point" != "" ] 65: then 66: # When device cannot be unmounted --- 1 67: # # Specify the name of volume group not to unmount 68: # if [ "$device" = "/dev/dsk/cXtXdX" ] 69: # then 70: # sync 71: # sync 72: # echo "none" > $post_file 73: # 74: # When device can be unmounted --- 2 75: # else 76: /usr/bin/df -ln $mount_point 2>/dev/null | /usr/bin/awk -F: '{ print $2 }' | /usr/bin/awk '{ print $1 }' > $fstype_file 77: /usr/sbin/umount $mount_point 2>/dev/null 78: 79: if [ $? != 0 ] 80: then 81: retry_count=3 82: sleep_time=1 83: result_flag=1 84: 85: while [ $retry_count -gt 0 ] 86: do 87: /usr/sbin/umount $mount_point > $err_log_path/$dev.umount 2>&1 88: if [ $? != 0 ] 89: then 90: retry_count=`expr $retry_count - 1` 91: /usr/bin/sleep $sleep_time 92: else 93: /usr/bin/rm -f $err_log_path/$dev.umount 94: result_flag=0 95: break 96: fi 97: done 98: 99: if [ $result_flag != 0 ] 100: then 101: /usr/sbin/fuser -cu $mount_point> $err_log_path/$dev.fuser 2>&1 102: /usr/bin/ps -ef > $err_log_path/$dev.ps 2>&1 103: exit 10 104: fi 105: fi 106: echo "mount,$mount_point" > $post_file 107: # fi 108: # When device was not mounted --- 3 109: else 110: echo "none" > $post_file 111: fi 112: 113: # When the disk is a volume group ################################ 114: elif [ "$dev_type" = "logical" ] 115: then 116: 117: # Devices is volume group and script not customize 118: exit 99 119: 120: # When devices of volume group cannot be unmounted --- 4 121: # 122: # # Specify the name of volume group not to unmount 123: # if [ "$device" = "/dev/vgXX" ] 124: # then 125: # sync 126: # sync 127: # echo "none" > $post_file 128: # fi 129: # 130: # When devices of volume group can be unmounted --- 5 131: # 132: # # Specify the name of volume group to unmount 133: # if [ "$device" = "/dev/vgXX" ] 134: # then 135: # # Unmount all logical volumes of the volume group 136: # mount_point="/XX" 137: # /usr/sbin/umount $mount_point 2>/dev/null 138: # if [ $? != 0 ] 139: # then 140: # retry_count=3 141: # sleep_time=1 142: # result_flag=1 143: # 144: # while [ $retry_count -gt 0 ] 145: # do 146: # /usr/sbin/umount $mount_point > $err_log_path/$dev.umount 2>&1 147: # if [ $? != 0 ] 148: # then 149: # retry_count=`expr $retry_count - 1` 150: # sleep $sleep_time 151: # else 152: # rm -f $err_log_path/$dev.umount 153: # result_flag=0 154: # break 155: # fi 156: # done 157: # 158: # if [ $result_flag != 0 ] 159: # then 160: # /usr/sbin/fuser -cu $mount_point> $err_log_path/$dev.fuser 2>&1 161: # /usr/bin/ps -ef > $err_log_path/$dev.ps 2>&1 162: # exit 10 163: # fi 164: # fi 165: # echo "mount" > $post_file 166: # fi 167: # 168: # When devices of volume group was not mounted --- 6 169: # 170: # # Specify the name of volume group to do nothing 171: # if [ "$device" = "/dev/vgXX" ] 172: # then 173: # echo "none" > $post_file 174: # fi 175: # 176: # When Src devices is a VxVM physical device --- 7 ########################### 177: elif [ "$dev_type" = "vxvm_pv" ] 178: then 179: # Nothing is done to VxVM PV. 180: # 181: echo "none" > $post_file 182: 183: fi 184: 185: exit 0 |
RepDst.pre(複写先ボリューム前処理のシェルスクリプト)
1: #!/bin/sh 2: 3: # AdvancedCopy Manager 4: # All Rights Reserved, Copyright FUJITSU LIMITED, 2002-2008 5: 6: # 7: # Pre-processing of Replication(Destination) processing 8: # 9: # Argument: $1 Device name of Destination disk 10: # $2 Mount point of Destination disk 11: # 12: # Error number 13: # 2: Argument 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: mount_point=$2 28: 29: # Device type check 30: # Determination postprocessing file name 31: trans="`echo $device | /usr/bin/grep -e "/dev/dsk/" -e "/dev/disk/"`" 32: lvmtrans="`echo $device | /usr/bin/grep "/dev/"`" 33: vxpvtrans="`echo $device | /usr/bin/grep "/dev/vx/dmp/"`" 34: if [ "$trans" != "" ] 35: then 36: dev_type="physical" 37: # /dev/dsk/c?t?d? -> c?t?d? 38: dev="`echo $device | /usr/bin/sed -e "s/\/dev\/dsk\///" -e "s/\/dev\/disk\//_hppv_/"`" 39: post_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".dpre" 40: fstype_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".dfstype" 41: elif [ "$vxpvtrans" != "" ] 42: then 43: dev_type="vxvm_pv" 44: # /dev/vx/dmp/XXXX -> XXXX 45: dev="`echo $device | /usr/bin/awk -F\/ '{ print $5 }'`" 46: post_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".dpre" 47: fstype_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".dfstype" 48: elif [ "$lvmtrans" != "" ] 49: then 50: dev_type="logical" 51: # /dev/vgXX -> vgXX 52: dev="`echo $device | /usr/bin/awk -F\/ '{ print $3 }'`" 53: post_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".dpre" 54: conf_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".conf" 55: else 56: exit 0 57: fi 58: 59: 60: err_log_path="/var/opt/FJSVswsrp/"$SWSTGNODE"/log" 61: 62: 63: # When the disk is a physical device ############################# 64: if [ "$dev_type" = "physical" ] 65: then 66: 67: if [ "$mount_point" != "" ] 68: then 69: # When device can be unmounted --- 2 70: /usr/bin/df -ln $mount_point 2>/dev/null | /usr/bin/awk -F: '{ print $2 }' | /usr/bin/awk '{ print $1 }' > $fstype_file 71: /usr/sbin/umount $mount_point 2>/dev/null 72: 73: if [ $? != 0 ] 74: then 75: retry_count=3 76: sleep_time=1 77: result_flag=1 78: 79: while [ $retry_count -gt 0 ] 80: do 81: /usr/sbin/umount $mount_point > $err_log_path/$dev.umount 2>&1 82: if [ $? != 0 ] 83: then 84: retry_count=`expr $retry_count - 1` 85: /usr/bin/sleep $sleep_time 86: else 87: /usr/bin/rm -f $err_log_path/$dev.umount 88: result_flag=0 89: break 90: fi 91: done 92: 93: if [ $result_flag != 0 ] 94: then 95: /usr/sbin/fuser -cu $mount_point> $err_log_path/$dev.fuser 2>&1 96: /usr/bin/ps -ef > $err_log_path/$dev.ps 2>&1 97: exit 10 98: fi 99: fi 100: echo "mount,$mount_point" > $post_file 101: # fi 102: # When device was not mounted --- 3 103: else 104: echo "none" > $post_file 105: fi 106: 107: # When the disk is a volume group ################################ 108: elif [ "$dev_type" = "logical" ] 109: then 110: 111: # Devices is volume group and script not customize 112: exit 99 113: 114: # When devices of volume group can be unmounted --- 5 115: # 116: # # Specify the name of volume group to unmount 117: # if [ "$device" = "/dev/vgXX" ] 118: # then 119: # # Unmount all logical volumes of the volume group 120: # mount_point="/XX" 121: # /usr/sbin/umount $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/umount $mount_point > $err_log_path/$dev.umount 2>&1 131: # if [ $? != 0 ] 132: # then 133: # retry_count=`expr $retry_count - 1` 134: # sleep $sleep_time 135: # else 136: # rm -f $err_log_path/$dev.umount 137: # result_flag=0 138: # break 139: # fi 140: # done 141: # 142: # if [ $result_flag != 0 ] 143: # then 144: # /usr/sbin/fuser -cu $mount_point> $err_log_path/$dev.fuser 2>&1 145: # /usr/bin/ps -ef > $err_log_path/$dev.ps 2>&1 146: # exit 10 147: # fi 148: # fi 149: # echo "mount" > $post_file 150: # fi 151: # 152: # When devices of volume group was not mounted --- 6 153: # 154: # # Specify the name of volume group to do nothing 155: # if [ "$device" = "/dev/vgXX" ] 156: # then 157: # echo "none" > $post_file 158: # fi 159: # 160: # When Src/Dst devices is a VxVM physical volume --- 7 ####################### 161: elif [ "$dev_type" = "vxvm_pv" ] 162: then 163: # Nothing is done to VxVM PV. 164: # 165: echo "none" > $post_file 166: 167: fi 168: 169: exit 0 |