ETERNUS SF AdvancedCopy Manager 運用手引書 13.0 -AIX- |
目次
索引
![]() ![]() |
本章では、AIX版AdvancedCopy Managerのバックアップおよびリストアの前後処理を行うシェルスクリプトについて説明します。
バックアップ・リストアの前後処理のシェルスクリプトは、バックアップ実行コマンドまたはリストア実行コマンドを実施した際に、バックアップ・リストア処理の前後で起動されます。
これらのシェルスクリプトには、AdvancedCopy Managerが、業務ボリュームのバックアップおよびリストアを行う際に必要な処理を記述します。
この章では、前後処理の設定について説明します。
AdvancedCopy Managerでのバックアップは、基本的に業務ボリュームがアンマウントされた状態で処理を行う必要があります。
そのため、前処理では業務ボリュームをアンマウントします。
後処理は、前処理で行った処理によって何をするのかを判断します。
前処理 |
後処理 |
---|---|
業務ボリュームをアンマウントした。 |
業務ボリュームをマウントし直します。 |
何も処理しなかった。 |
何も処理しません。 |
この他にも、特殊な前後処理が必要な場合は、シェルスクリプトに処理を追加する必要があります。
スクリプトをカスタマイズする場合、エラーコードは以下の規約に従ってください。
エラーコード |
用途 |
---|---|
0-99 |
使用不可(AdvancedCopy Managerが予約) |
100-255 |
使用可能 |
ファイルシステムが構築された論理ボリュームを含むボリュームグループをバックアップする場合は、本マニュアルの『ボリュームグループをバックアップする場合』を参照し、ファイルシステムが構築された全ての論理ボリュームに対してアンマウント/マウントが実施されるように前後処理スクリプトをカスタマイズする必要があります。
後処理に失敗した場合は、資源情報の整合性が不完全になっている可能性がありますので、資源整合コマンド(swstsrsemtch)を実施してください。
バックアップ実行時の前処理のシェルスクリプト名は、以下の通りです。
非クラスタ運用の場合
/etc/opt/FJSVswsts/sh/OpcBackup.pre
クラスタ運用の場合
/etc/opt/FJSVswsts/<論理ノード名>/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 |
バックアップ実行時の後処理のシェルスクリプト名は、以下の通りです。
非クラスタ運用の場合
/etc/opt/FJSVswsts/sh/OpcBackup.post
クラスタ運用の場合
/etc/opt/FJSVswsts/<論理ノード名>/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 |
ファイルシステムが構築された論理ボリュームを含むボリュームグループがバックアップ対象の場合は、前後処理スクリプトを修正する必要があります。
スクリプトを修正後,前処理スクリプト(OpcBackup.pre)の75行目のexit文をコメント("#")化してください。
前処理スクリプト(OpcBackup.pre)の79〜148行目、および後処理スクリプト(OpcBackup.post)の78〜153行目について、ファイルシステムが構築された全ての論理ボリュームに対してアンマウント/マウント処理が実施されるように記述を適宜修正してください。("*"で示す箇所は実際の環境に合わせて変更してください。また、複数の論理ボリュームが対象となる場合は、前処理スクリプト(OpcBackup.pre)の115〜147行目および、後処理スクリプト(OpcBackup.post)の116〜147行目のコメントをはずし、これらの処理をボリューム数分記述してください。
カスタマイズをしていない状態では、ボリュームグループに対する前処理はエラーとなります。
バックアップボリュームがボリュームグループの場合は、バックアップ前処理において、バックアップボリュームを非活性にします。
mountコマンドなどのOSコマンドのパラメーターやオプションなどは運用に合わせて,適宜修正してください。
VERITAS Cluster Serverでクラスタ運用を行う場合で、業務ボリュームのマウントポイントがクラスタ業務に登録されている場合は、前後処理スクリプトのカスタマイズが必要となります。
前後処理スクリプト内のマウント/アンマウント処理を、マウントポイントリソースのオフライン/オンライン処理に変更してください。
また、マウントポイントリソースのオフライン/オンラインを行ってから、実際にボリュームがアンマウント/マウントされるまでに時間差があります。そのため実際にアンマウント/マウントされるまで待ち合わせる処理(sleepやdfコマンドの結果を監視するなど)をオフライン/オンラインの成否を判定する個所の後に追加してください。
以下に前後処理スクリプトのカスタマイズ例を示します。
[例] バックアップ前処理スクリプト(OpcBackup.pre)のアンマウント処理変更
[85,94,119,127行目]
(変更前) |
/usr/sbin/umount $mount_point |
(変更後) |
/opt/VRTSvcs/bin/hares -offline リソース名 -sys システム名 |
[例] バックアップ前処理スクリプト(OpcBackup.pre)のアンマウント待ち処理追加
[114,148行目]
(追加) |
mount_status="mounted" |
[例] バックアップ後処理スクリプト(OpcBackup.post)のマウント処理変更
[88,97,121,130行目]
(変更前) |
/usr/sbin/mount $lvname $lv_mount_point |
(変更後) |
/opt/VRTSvcs/bin/hares -online リソース名 -sys システム名 |
[例] バックアップ後処理スクリプト(OpcBackup.post)のマウント待ち処理追加
[115,148行目]
(追加) |
mount_status="not_mounted" |
AdvancedCopy Managerでのリストアは、業務ボリュームがアンマウントされた状態で処理を行う必要があります。
そのため前処理では、業務ボリュームをアンマウントします。
後処理は、前処理で行った処理によって何をするのかを判断します。
前処理 |
後処理 |
---|---|
業務ボリュームをアンマウントした。 |
業務ボリュームをマウントし直します。 |
何も処理しなかった。 |
何も処理しません。 |
この他にも、特殊な前後処理が必要な場合は、シェルスクリプトに処理を追加する必要があります。
スクリプトをカスタマイズする場合、エラーコードは以下の規約に従ってください。
エラーコード |
用途 |
---|---|
0-99 |
使用不可(AdvancedCopy Managerが予約) |
100-255 |
使用可能 |
ファイルシステムが構築された論理ボリュームを含むボリュームグループをリストアする場合は、本マニュアルの『ボリュームグループをリストアする場合』を参照し、ファイルシステムが構築された全ての論理ボリュームに対してアンマウント/マウント処理を実施するように前後処理スクリプトをカスタマイズする必要があります。
後処理に失敗した場合は、資源情報の整合性が不完全になっている可能性がありますので、資源整合コマンド(swstsrsemtch)を実施してください。
リストア実行時の前処理のシェルスクリプト名は、以下の通りです。
非クラスタ運用の場合
/etc/opt/FJSVswsts/sh/OpcBackup.post
クラスタ運用の場合
/etc/opt/FJSVswsts/<論理ノード名>/sh/OpcBackup.post
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 |
マウントされているがアンマウントできない業務ボリュームに対しては、リストアはできません。リストア先のデバイスを指示してください。
リストア実行時の後処理のシェルスクリプト名は、以下の通りです。
非クラスタ運用の場合
/etc/opt/FJSVswsts/sh/OpcRestore.post
クラスタ運用の場合
/etc/opt/FJSVswsts/<論理ノード名>/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 |
ファイルシステムが構築された論理ボリュームを含むボリュームグループがリストア対象の場合は、前後処理スクリプトを修正する必要があります。
スクリプトを修正後,前処理スクリプト(OpcRestore.pre)の71行目のexit文をコメント("#")化してください。
◆前処理スクリプト(OpcRestore.pre)の75〜141行目、および後処理スクリプト(OpcRestore.post)の95〜170行目について、ファイルシステムが構築された全ての論理ボリュームに対してアンマウント/マウント処理が実施されるように記述を適宜修正してください。("*"で示す箇所は実際の環境に合わせて変更してください。また、複数の論理ボリュームが対象となる場合は、前処理スクリプト(OpcRestore.pre)の111〜140行目の処理および、後処理スクリプト(OpcRestore.post)の133〜164行目のコメントをはずし、これらの処理をボリューム数分記述してください。)
◆バックアップボリュームをマウントする運用を行う場合は、バックアップボリュームのLVM管理情報が書き換わるため、通常の手順でリストアできなくなります。その場合、後処理スクリプト(OpcRestore.post)の65〜79行目と95〜170行目をコメント(“#”)化してください。またリストア処理完了後にも追加手順が必要となります。本マニュアルの『リストアの注意事項』を参照してください。
カスタマイズをしていない状態では、ボリュームグループに対する前処理はエラーとなります。
mountコマンドなどのOSコマンドのパラメーターやオプションなどは運用に合わせて,適宜修正してください。
VERITAS Cluster Serverでクラスタ運用を行う場合で、業務ボリュームのマウントポイントがクラスタ業務に登録されている場合は、前後処理のカスタマイズが必要となります。
前後処理スクリプト内のマウント/アンマウント処理を、マウントポイントリソースのオフライン/オンライン処理に変更してください。
また、マウントポイントリソースのオフライン/オンラインを行ってから、実際にボリュームがアンマウント/マウントされるまでに時間差があります。そのため実際にアンマウント/マウントされるまで待ち合わせる処理(sleepやdfコマンドの結果を監視するなど)をオフライン/オンラインの成否を判定する個所の後に追加してください。
以下に前後処理スクリプトの変更例を示します
[例] リストア前処理スクリプト(OpcRestore.pre)のアンマウント処理変更
[81,90,112,121行目]
(変更前) |
/usr/sbin/umount $mount_point |
(変更後) |
/opt/VRTSvcs/bin/hares -offline リソース名 -sys システム名 |
[例] リストア前処理スクリプト(OpcRestore.pre)のアンマウント待ち処理追加
[110,141行目]
(追加) |
mount_status="mounted" |
[例] リストア後処理スクリプト(OpcRestore.post)のマウント処理変更
[105,114,138,147行目]
(変更前) |
/usr/sbin/mount $lvname $lv_mount_point |
(変更後) |
/opt/VRTSvcs/bin/hares -online リソース名 -sys システム名 |
[例] リストア後処理スクリプト(OpcRestore.post)のマウント待ち処理追加
[132,165行目]
(追加) |
mount_status="not_mounted" |
目次
索引
![]() ![]() |