ETERNUS SF AdvancedCopy Manager 運用手引書 13.0 -HP-UX- |
目次
索引
![]() ![]() |
本章では、AdvancedCopy Managerのレプリケーションの前後処理を行うシェルスクリプトについて説明します。
レプリケーションの前後処理のシェルスクリプトは、レプリケーション(複製)処理の前後で起動されます。
これらのシェルスクリプトには、AdvancedCopy Managerが、複製元ボリュームおよび複製先ボリュームに必要な処理を記述します。
この章では、前後処理の設定について説明します。
AdvancedCopy Managerでのレプリケーションの前後処理は、複製元/複製先ボリュームの双方に対して実施する必要がありますが、その目的は異なります。
複製元ボリュームに対する前後処理
複製元データを一時的に整合性の保証された状態で凍結することを目的としています。前処理で複製元データを一時的に凍結し、複製作成後、後処理で凍結状態を解除します。
複製先ボリュームに対する前後処理
レプリケーション(複製)処理中にアプリケーションが複製先ボリュームにアクセスさせないことを目的としています。前処理で複製先データをアクセス禁止状態とし、複製作成後、後処理でアクセス禁止状態を解除します。
前後処理で行う具体的な処理は、そのボリュームのデータ内容によって異なります。次章では、ファイルシステムとデータベースの前後処理についてそれぞれ説明します。
ファイルシステムの前後処理とは、ファイルシステムのアンマウント/マウント処理です。複製元ボリュームに対する前後処理は、複製元データを保証するためのものです。複製先ボリュームに対する前後処理は、同期処理実行中やスナップショットコピー時に他プロセスからのアクセスを不可能にするためのものです。ボリュームがマウントされていない場合は、前後処理は実施されません。
ファイルシステムの前後処理の実施状況を以下に示します。この表は、前後処理が実行されるかどうかは、コマンド種別によって異なり、さらに、そのコマンドを実行したときのコピー状態によっても異なることを示しています。ただし,論理ボリューム(ボリュームグループ)の場合はカスタマイズしていない状態ではアンマウント/マウント処理動作しません。ボリュームグループの場合は,必ず前後処理スクリプトをカスタマイズしてください。
コマンド |
コピー状態 |
複製元/複製先 |
前処理 |
後処理 |
---|---|---|---|---|
複製開始コマンド (swsrpstartsync) |
未コピー状態または 複製確立状態 |
複製元 |
× |
× |
複製先 |
○--(1) |
× |
||
複製作成コマンド (swsrpmake) |
等価性維持状態 |
複製元 |
○ |
○ |
複製先 |
× |
○--(2) |
||
複製解除コマンド (swsrpcancel) |
等価性維持状態 |
複製元 |
○ |
○ |
複製先 |
× |
○--(2) |
||
複製確立状態 |
複製元 |
× |
× |
|
複製先 |
× |
× |
||
コピー中 |
複製元 |
× |
× |
|
複製先 |
× |
× |
||
スナップショット複製作成コマンド (swsrpmake) |
未コピー状態 |
複製元 |
○ |
○ |
複製先 |
○ |
○ |
(1)で行った前処理に対する後処理は(2)で行われます。(2)の後処理では、(1)の前処理でアンマウントしたマウントポイントに再マウントを行います。
ファイルシステムの前後処理は、カスタマイズ可能なようにスクリプトになっています。レプリケーション管理コマンドを実施した際に、上の表にしたがって起動されます。また、サーバ間レプリケーションの場合、接続されていないボリュームの前後処理は、TCP/IPによるリモート実行でこれらのスクリプトが実行されます。
図 B.1 に前後処理の動作イメージを示します。
前後処理で標準の前後処理以外で必要な処理がある場合はそれぞれのスクリプトをカスタマイズしてください。
スクリプトをカスタマイズする場合、エラーコードは以下の規約に従ってください。
エラーコード |
用途 |
---|---|
0-99 |
使用不可(AdvancedCopy Managerが予約) |
100-255 |
使用可能 |
レプリケーション対象がファイルシステムが構築された論理ボリュームを含むボリュームグループの場合は、本マニュアルの『レプリケーション対象がボリュームグループの場合』を参照し、ファイルシステムが構築された全ての論理ボリュームに対してアンマウント/マウントが実施されるように前後処理スクリプトをカスタマイズする必要があります。
複写元ボリューム後処理スクリプトの150行目、複写先ボリューム後処理スクリプトの127,139,217行目のファイルシステム名は、運用に合わせて適宜修正してください。
運用上の理由によりレプリケーション対象ボリュームをアンマウントできない場合は、本マニュアルの『レプリケーション対象ボリュームをアンマウントしたくない場合』を参照し、前処理スクリプトをカスタマイズしてください。
データベースの前後処理については、AdvancedCopy Managerでは機能を提供しませんので、AdvancedCopy Managerコマンド実行の前後で独自に実施する必要があります。
前処理スクリプトには複写元ボリューム(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-2006 5: 6: # 7: # Preprocessing 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 "/dev/dsk/"`" 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 "s/\/dev\/dsk\///"`" 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/c*t*d*" ] 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/vg**" ] 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/vg**" ] 134: # then 135: # # Unmount all logical volumes of the volume group 136: # mount_point="/**" 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/vg**" ] 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-2006 5: 6: # 7: # Preprocessing 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 "/dev/dsk/"`" 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 "s/\/dev\/dsk\///"`" 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/vg**" ] 118: # then 119: # # Unmount all logical volumes of the volume group 120: # mount_point="/**" 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/vg**" ] 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 |
マウントされているがアンマウントしたくない複写元ボリュームに対しては、複写元ボリューム前処理スクリプト(RepSrc.pre)の68〜72、75、107行目(物理ボリュームの場合)または123〜128行目(ボリュームグループの場合)のコメント(“#”)をエディタ等で消去し、68行目または123行目のif文で対象となる複写元ボリュームを指示してください。なお、70行目または125行目のsyncコマンドを実施してから複写元ボリューム後処理を実施するまでの間は、複写元ボリュームのファイルシステム更新操作は行わないようにしてください。もし、この間にファイルシステム更新操作が行われると、ファイルシステムが不完全な状態で複写が行われるか、または複写先ボリューム後処理スクリプト(RepDst.post)で実施するfsckコマンドがエラーとなる可能性があります。
マウントされている複写先ボリュームに対しては、かならずアンマウントする必要があります。
後処理スクリプトには複写元ボリューム(RepSrc.Post)と複写先ボリューム(RepDst.Post)を用意し、以下のディレクトリ配下に格納されています。処理の必要性に応じてスクリプトをカスタマイズしてください。
非クラスタ運用の場合
/etc/opt/FJSVswsrp/shディレクトリ配下
クラスタ運用の場合
/etc/opt/FJSVswsrp/<論理ノード名>/shディレクトリ配下
RepSrc.post(複写元ボリューム後処理スクリプト)
1: #!/bin/sh 2: 3: # AdvancedCopy Manager 4: # All Rights Reserved, Copyright FUJITSU LIMITED, 2002-2006 5: 6: # 7: # Postprocessing of Replication(Source) processing 8: # 9: # Argument: $1 Device name of Source disk 10: # 11: # Error number 12: # 2: Argument error 13: # 11: mount error 14: 15: # Argument check 16: case $# in 17: 1) 18: ;; 19: *) 20: exit 2 21: ;; 22: esac 23: 24: device=$1 25: 26: # Device type check 27: # Determination postprocessing file name 28: trans="`echo $device | /usr/bin/grep "/dev/dsk/"`" 29: lvmtrans="`echo $device | /usr/bin/grep "/dev/"`" 30: vxpvtrans="`echo $device | /usr/bin/grep "/dev/vx/dmp/"`" 31: if [ "$trans" != "" ] 32: then 33: dev_type="physical" 34: # /dev/dsk/c?t?d? -> c?t?d? 35: dev="`echo $device | /usr/bin/sed "s/\/dev\/dsk\///"`" 36: post_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".spre" 37: fstype_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".sfstype" 38: elif [ "$vxpvtrans" != "" ] 39: then 40: dev_type="vxvm_pv" 41: # /dev/vx/dmp/XXXX -> XXXX 42: dev="`echo $device | /usr/bin/awk -F\/ '{ print $5 }'`" 43: post_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".spre" 44: fstype_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".sfstype" 45: elif [ "$lvmtrans" != "" ] 46: then 47: dev_type="logical" 48: # /dev/vgXX -> vgXX 49: dev="`echo $device | /usr/bin/awk -F\/ '{ print $3 }'`" 50: post_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".spre" 51: fstype_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".sfstype" 52: else 53: exit 0 54: fi 55: 56: err_log_path="/var/opt/FJSVswsrp/"$SWSTGNODE"/log" 57: 58: # Confirmation of postprocessing 59: if [ ! -r $post_file ] 60: then 61: exit 0 62: fi 63: post="`/usr/bin/cat $post_file | /usr/bin/cut -d',' -f1`" 64: mount_point="`/usr/bin/cat $post_file | /usr/bin/cut -d',' -f2`" 65: 66: # Confirmation of FStype 67: if [ ! -r $fstype_file ] 68: then 69: fs="" 70: else 71: fs="`/usr/bin/cat $fstype_file`" 72: fi 73: 74: # No processing 75: # When Src device cannot be unmounted --- 1 76: # When Src device was not mounted --- 3 77: # When Src devices of volume group cannot be unmounted --- 4 78: # When Src devices of volume group was not mounted --- 6 79: # When Src devices is a VxVM physical device --- 7 80: if [ "$post" = "none" ] 81: then 82: /usr/bin/rm -rf $post_file 2> /dev/null 83: /usr/bin/rm -rf $fstype_file 2> /dev/null 84: exit 0 85: fi 86: 87: # mount processing 88: if [ "$post" = "mount" ] 89: then 90: # When Src device can be unmounted --- 2 91: if [ "$dev_type" = "physical" ] 92: then 93: /usr/bin/df -l $device > /dev/null 2>&1 94: if [ $? != 0 ] 95: then 96: if [ ! -r $fstype_file ] 97: then 98: /usr/sbin/mount $device $mount_point 2> /dev/null 99: else 100: if [ "$fs" = "" ] 101: then 102: /usr/sbin/mount $device $mount_point 2> /dev/null 103: else 104: /usr/sbin/mount -F $fs $device $mount_point 2> /dev/null 105: fi 106: fi 107: if [ $? != 0 ] 108: then 109: retry_count=3 110: sleep_time=1 111: result_flag=1 112: 113: while [ $retry_count -gt 0 ] 114: do 115: if [ ! -r $fstype_file ] 116: then 117: /usr/sbin/mount $device $mount_point > $err_log_path/$dev.mount 2>&1 118: else 119: if [ "$fs" = "" ] 120: then 121: /usr/sbin/mount $device $mount_point > $err_log_path/$dev.mount 2>&1 122: else 123: /usr/sbin/mount -F $fs $device $mount_point > $err_log_path/$dev.mount 2>&1 124: fi 125: fi 126: if [ $? != 0 ] 127: then 128: retry_count=`expr $retry_count - 1` 129: /usr/bin/sleep $sleep_time 130: else 131: /usr/bin/rm -f $err_log_path/$dev.mount 132: result_flag=0 133: break 134: fi 135: done 136: 137: if [ $result_flag != 0 ] 138: then 139: exit 11 140: fi 141: fi 142: fi 143: # When devices of volume group can be unmounted --- 5 144: # elif [ "$dev_type" = "logical" ] 145: # then 146: # #Specify the name of volume group to mount 147: # if [ "$device" = "/dev/vg**" ] 148: # then 149: # # Mount all logical volumes of the volume group 150: # fs="hfs" 151: # lvname="/dev/vg**/*****" 152: # lv_mount_point="/**" 153: # 154: # /usr/bin/df -l $lvname > /dev/null 2>&1 155: # if [ $? != 0 ] 156: # then 157: # /usr/sbin/mount -F $fs $lvname $lv_mount_point 2>/dev/null 158: # if [ $? != 0 ] 159: # then 160: # retry_count=3 161: # sleep_time=1 162: # result_flag=1 163: # 164: # while [ $retry_count -gt 0 ] 165: # do 166: # /usr/sbin/mount -F $fs $lvname $lv_mount_point > $err_log_path/$dev.mount 2>&1 167: # if [ $? != 0 ] 168: # then 169: # retry_count=`expr $retry_count - 1` 170: # /usr/bin/sleep $sleep_time 171: # else 172: # rm -f $err_log_path/$dev.mount 173: # result_flag=0 174: # break 175: # fi 176: # done 177: # 178: # if [ $result_flag != 0 ] 179: # then 180: # exit 11 181: # fi 182: # fi 183: # fi 184: # fi 185: fi 186: /usr/bin/rm -rf $post_file 2> /dev/null 187: /usr/bin/rm -rf $fstype_file 2> /dev/null 188: exit 0 189: fi 190: 191: exit 0 |
RepDst.post(複写先ボリューム後処理スクリプト)
1: #!/bin/sh 2: 3: # AdvancedCopy Manager 4: # All Rights Reserved, Copyright FUJITSU LIMITED, 2002-2006 5: 6: # 7: # Postprocessing of Replication(Destination) processing 8: # 9: # Argument: $1 Device name of Destination disk 10: # 11: # Error number 12: # 2: Argument error 13: # 11: mount error 14: # 30: VG configuration file not found error 15: # 31: vgcfgrestore error 16: # 12: fsck error 17: 18: # Argument check 19: case $# in 20: 1) 21: ;; 22: *) 23: exit 2 24: ;; 25: esac 26: 27: device=$1 28: 29: # Device type check 30: # Determination postprocessing file name 31: trans="`echo $device | /usr/bin/grep "/dev/dsk/"`" 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 "s/\/dev\/dsk\///"`" 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: fstype_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".dfstype" 55: else 56: exit 0 57: fi 58: 59: err_log_path="/var/opt/FJSVswsrp/"$SWSTGNODE"/log" 60: 61: # Confirmation of postprocessing 62: if [ ! -r $post_file ] 63: then 64: exit 0 65: fi 66: post="`/usr/bin/cat $post_file | /usr/bin/cut -d',' -f1`" 67: mount_point="`/usr/bin/cat $post_file | /usr/bin/cut -d',' -f2`" 68: 69: # Confirmation of FStype 70: if [ ! -r $fstype_file ] 71: then 72: fs="" 73: else 74: fs="`/usr/bin/cat $fstype_file`" 75: fi 76: 77: # Restore VG Configuration 78: if [ "$dev_type" = "logical" ] 79: then 80: vg_name="`echo $device | /usr/bin/awk -F\/ '{ print $3 }'`" 81: cfg_file="/etc/lvmconf/"$vg_name".conf" 82: if [ ! -r $cfg_file ] 83: then 84: exit 30 85: fi 86: pv_rname="`/usr/sbin/vgcfgrestore -n $vg_name -l 2> /dev/null | /usr/bin/awk '{print $1}' | /usr/bin/grep \"/dev/rdsk\"`" 87: if [ "$pv_rname" = "" ] 88: then 89: echo "/usr/sbin/vgcfgrestore -n $vg_name -l 2> /dev/null | /usr/bin/awk '{print $1}' | /usr/bin/grep \"/dev/rdsk\"" > $err_log_path/$dev.vgcfgrestore 2>&1 90: exit 31 91: fi 92: /usr/sbin/vgchange -a n $vg_name > /dev/null 2>&1 93: reststatus=0 94: for pv_rname1 in $pv_rname 95: do 96: /usr/sbin/vgcfgrestore -n $vg_name $pv_rname1 > /dev/null 2>&1 97: if [ $? = 0 ] 98: then 99: /usr/sbin/vgcfgrestore -n $vg_name $pv_rname1 > $err_log_path/$dev.vgcfgrestore 2>&1 100: if [ $? = 0 ] 101: then 102: reststatus=1 103: break 104: fi 105: fi 106: done 107: if [ "$SWSTGNODE" != "" ] 108: then 109: /usr/sbin/vgchange -c y $vg_name > /dev/null 2>&1 110: /usr/sbin/vgchange -a e $vg_name > /dev/null 2>&1 111: else 112: /usr/sbin/vgchange -a y $vg_name > /dev/null 2>&1 113: fi 114: if [ $reststatus = 0 ] 115: then 116: exit 31 117: fi 118: fi 119: 120: # No processing 121: if [ "$post" = "none" ] 122: then 123: # When Src device cannot be unmounted --- 1 124: # if [ "$device" = "/dev/dsk/c*t*d*" ] 125: # then 126: # rdevice="`echo $device | sed "s/\/dsk\//\/rdsk\//"`" 127: # src_fs=hfs 128: # fsck -F $src_fs -y $rdevice > /dev/null 2>&1 129: # if [ $? != 0 ] 130: # then 131: # exit 12 132: # fi 133: # fi 134: # 135: # When Src devices of volume group cannot be unmounted --- 4 136: # if [ "$device" = "/dev/vg**" ] 137: # then 138: # rdevice="/dev/vg**/*****" 139: # src_fs=hfs 140: # fsck -F $src_fs -y $rdevice > /dev/null 2>&1 141: # if [ $? != 0 ] 142: # then 143: # exit 12 144: # fi 145: # fi 146: # When Src/Dst device was not mounted --- 3 147: # When Src/Dst devices of volume group was not mounted --- 6 148: # When Src/Dst devices is a VxVM physical volume --- 7 149: /usr/bin/rm -rf $post_file 2> /dev/null 150: /usr/bin/rm -rf $fstype_file 2> /dev/null 151: exit 0 152: fi 153: 154: # mount processing 155: if [ "$post" = "mount" ] 156: then 157: if [ "$dev_type" = "physical" ] 158: then 159: # When Dst device can be unmounted --- 2 160: /usr/bin/df -l $device > /dev/null 2>&1 161: if [ $? != 0 ] 162: then 163: if [ ! -r $fstype_file ] 164: then 165: /usr/sbin/mount $device $mount_point 2> /dev/null 166: else 167: if [ "$fs" = "" ] 168: then 169: /usr/sbin/mount $device $mount_point 2> /dev/null 170: else 171: /usr/sbin/mount -F $fs $device $mount_point 2> /dev/null 172: fi 173: fi 174: if [ $? != 0 ] 175: then 176: retry_count=3 177: sleep_time=1 178: result_flag=1 179: 180: while [ $retry_count -gt 0 ] 181: do 182: if [ ! -r $fstype_file ] 183: then 184: /usr/sbin/mount $device $mount_point > $err_log_path/$dev.mount 2>&1 185: else 186: if [ "$fs" = "" ] 187: then 188: /usr/sbin/mount $device $mount_point > $err_log_path/$dev.mount 2>&1 189: else 190: /usr/sbin/mount -F $fs $device $mount_point > $err_log_path/$dev.mount 2>&1 191: fi 192: fi 193: if [ $? != 0 ] 194: then 195: retry_count=`expr $retry_count - 1` 196: /usr/bin/sleep $sleep_time 197: else 198: /usr/bin/rm -f $err_log_path/$dev.mount 199: result_flag=0 200: break 201: fi 202: done 203: 204: if [ $result_flag != 0 ] 205: then 206: exit 11 207: fi 208: fi 209: fi 210: # elif [ "$dev_type" = "logical" ] 211: # then 212: # When Dst devices of volume group can be unmounted --- 5 213: # # Specify the name of volume group to mount 214: # if [ "$device" = "/dev/vg**" ] 215: # then 216: # # Mount all logical volumes of the volume group 217: # fs="hfs" 218: # lvname="/dev/vg**/*****" 219: # lv_mount_point="/**" 220: # 221: # /usr/bin/df -l $lvname > /dev/null 2>&1 222: # if [ $? != 0 ] 223: # then 224: # /usr/sbin/mount -F $fs $lvname $lv_mount_point 2>/dev/null 225: # if [ $? != 0 ] 226: # then 227: # retry_count=3 228: # sleep_time=1 229: # result_flag=1 230: # 231: # while [ $retry_count -gt 0 ] 232: # do 233: # /usr/sbin/mount -F $fs $lvname $lv_mount_point > $err_log_path/$dev.mount 2>&1 234: # if [ $? != 0 ] 235: # then 236: # retry_count=`expr $retry_count - 1` 237: # /usr/bin/sleep $sleep_time 238: # else 239: # rm -f $err_log_path/$dev.mount 240: # result_flag=0 241: # break 242: # fi 243: # done 244: # 245: # if [ $result_flag != 0 ] 246: # then 247: # exit 11 248: # fi 249: # fi 250: # fi 251: # fi 252: fi 253: /usr/bin/rm -rf $post_file 2> /dev/null 254: /usr/bin/rm -rf $fstype_file 2> /dev/null 255: exit 0 256: fi 257: 258: exit 0 |
ファイルシステムが構築された論理ボリュームを含むボリュームグループがレプリケーション対象の場合は、前後処理スクリプトを修正する必要があります。
複写元ボリューム前処理スクリプトの133〜166行目のコメント("#")および複写元ボリューム後処理スクリプトの144〜184行目のコメント("#")をエディタ等で消去し、ファイルシステムが構築された全ての論理ボリュームに対して、アンマウント/マウント処理が行われるようにコメント内の記述を適宜修正してください。("*"で示す箇所は実際の環境に合わせて変更してください。また、複写元ボリューム前処理スクリプトの136〜164行目の処理および、複写元ボリューム後処理スクリプトの151〜183行目の処理をボリューム数分記述してください。)
複写先ボリューム前処理スクリプトの117〜150行目のコメント("#")および複写先ボリューム後処理スクリプトの210、211、214〜251行目のコメント("#")をエディタ等で消去し、ファイルシステムが構築された全ての論理ボリュームに対して、アンマウント/マウント処理が行われるようにコメント内の記述を適宜修正してください。("*"で示す箇所は実際の環境に合わせて変更してください。また、複写先ボリューム前処理スクリプトの120〜150行目の処理および、複写先ボリューム後処理スクリプトの218〜250行目の処理をボリューム数分記述してください。)
複写元ボリュームをアンマウントしない場合は,複写先ボリュームの後処理スクリプトで複写先ボリューム内のファイルシステムが構築された全ての論理ボリュームに対してfsckを実施する必要があります。
スクリプトに対して必要な修正を実施後,複写元ボリューム前処理スクリプトの118行目及び複写先ボリューム前処理スクリプトの112行目のexit文をコメント("#")化してください。
カスタマイズをしていない状態では、ボリュームグループに対する前処理はエラーとなります。
複写先ボリュームがボリュームグループの場合は、後処理スクリプトにおいて、複写先ボリュームをLVMとして使用可能にするためにvgcfgrestoreコマンドによってボリュームグループ構成情報のリストアを実施しています。上記のスクリプトでは、標準のバックアップファイル「/etc/lvmconf/"ボリュームグループ名".conf」からボリューム構成情報のリストアを行っています。ボリュームグループ構成情報が別ファイルにバックアップされている場合は、スクリプトをカスタマイズしてください。
クラスタ運用している場合は、クラスタを構成する各ノードにボリュームグループ構成情報が存在している必要があります。
mountコマンドやfsckコマンドなどのOSコマンドのパラメーターやオプションなどは運用に合わせて,適宜修正してください。
共有モードのボリュームグループの場合
共有モードのボリュームグループの再構成は、複写先ボリューム後処理スクリプト(RepDst.post)の78-118,121,122および152をコメント化して、複写先ボリューム後処理スクリプトではボリュームグループの再構成を実施しないようにしてください。
レプリケーション実行後に手動で以下の操作を行い、ボリュームグループの再構成を行ってください。
ボリュームグループの停止(業務を構成している全ノードで実行します)
# /usr/sbin/vgchange -a n <vg_name> # |
ボリュームグループ構成情報のリストア(ボリュームグループを作成したノードで実行します)
# /usr/sbin/vgcfgrestore -n <vg_name> <pv_path> # |
共有可能なボリュームグループのマーク(ボリュームグループを作成したノードで実行します)
# /usr/sbin/vgchange -S y -c y <vg_name> # |
ボリュームグループの起動(業務を構成している全ノードで実行します)
# /usr/sbin/vgchange -a s <vg_name> # |
VERITAS Cluster Serverでクラスタ運用を行う場合で、複写先,複写元ボリュームのマウントポイントがクラスタ業務に登録されている場合は前後処理スクリプトのカスタマイズが必要となります。
前後処理スクリプト内のアンマウント/マウント処理を、マウントポイントリソースのオフライン/オンライン処理に変更してください。
また、マウントポイントリソースのオフライン/オンラインを行ってから、実際にボリュームがアンマウント/マウントされるまでに時間差があります。そのため実際にアンマウント/マウントされるまで待ち合わせる処理(sleepやdfコマンドの結果を監視するなど)をオフライン/オンラインの成否を判定する個所の後に追加してください。
以下に前後処理スクリプトのカスタマイズ例を示します。
[例] 複写元ボリューム前処理スクリプト(RepSrc.pre)のアンマウント処理変更
[77,87,137,146行目]
(変更前) |
/usr/sbin/umount $mount_point |
(変更後) |
/opt/VRTSvcs/bin/hares -offline リソース名 -sys システム名 |
[例] 複写元ボリューム前処理スクリプト(RepSrc.pre)のアンマウント待ち処理の追加
[106,165行目]
(追加) |
while /usr/bin/df -l "$device">/dev/null 2>&1; do :; done |
[例] 複写先ボリューム前処理スクリプト(RepDst.pre)のアンマウント処理変更
[71,81,121,130行目]
(変更前) |
/usr/sbin/umount $mount_point |
(変更後) |
/opt/VRTSvcs/bin/hares -offline リソース名 -sys システム名 |
[例] 複写先ボリューム前処理スクリプト(RepDst.pre)のアンマウント待ち処理追加
[100,149行目]
(追加) |
while /usr/bin/df -l "$device">/dev/null 2>&1; do :; done |
[例] 複写元ボリューム後処理スクリプト(RepSrc.post)のマウント処理変更
[98,102,104,117,121,123,157,166行目]
(変更前) |
/usr/sbin/mount $device $mount_point |
(変更後) |
/opt/VRTSvcs/bin/hares -online リソース名 -sys システム名 |
[例] 複写元ボリューム後処理スクリプト(RepSrc.post)のマウント待ち処理追加
[143,185行目]
(追加) |
while ! /usr/bin/df -l "$device">/dev/null 2>&1; do :; done |
[例] 複写先ボリューム後処理スクリプト(RepDst.post)のマウント処理変更
[165,169,171,188,190,224,233行目]
(変更前) |
/usr/sbin/mount $device $mount_point |
(変更後) |
/opt/VRTSvcs/bin/hares -online リソース名 -sys システム名 |
[例] 複写先ボリューム後処理スクリプト(RepDst.post)のマウント待ち処理追加
[210,252行目]
(追加) |
while ! /usr/bin/df -l "$device">/dev/null 2>&1; do :; done |
目次
索引
![]() ![]() |