ETERNUS SF AdvancedCopy Manager 運用手引書 13.2 -Linux- |
目次
索引
![]() ![]() |
付録A バックアップ/リストアの前後処理 | > A.2 バックアップの前後処理 |
バックアップ実行時の前処理のシェルスクリプト名は、以下のとおりです。
非クラスタ運用の場合
/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, 2002-2007 5: 6: # 7: # Preprocessing of backup processing 8: # 9: # Argument: $1 Device name of transaction disk 10: # $2 Mount point of transaction disk 11: # $3 Device name of backup disk 12: # 13: #Error number 14: # 2: Argument error 15: #10: umount error 16: #13: Illegal mount type (bind/stack mount) 17: 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="`echo $1`" 33: mount_point="`echo $2`" 34: bk_device="`echo $3`" 35: 36: # Determination postprocessing file name 37: 38: if [ "$SWSTGNODE" != "" ] 39: then 40: swstg_node="/`echo $SWSTGNODE`" 41: else 42: swstg_node="" 43: fi 44: 45: err_log_path="/var/opt/FJSVswsts"$swstg_node"/log" 46: 47: if [ "`echo $device | /bin/grep "/dev/sd"`" != "" ] 48: then 49: # /dev/sd? -> sd? 50: dev="`echo $device | /bin/sed "s/\/dev\///"`" 51: elif [ "`echo $device | /bin/grep "/dev/FJSV"`" != "" ] 52: then 53: # /dev/FJSVmphd/dsk/mplb?s? -> mplb?s? 54: # /dev/FJSVmphd/dsk/mphd?s? -> mphd?s? 55: dev="`echo $device | /bin/cut -d/ -f5`" 56: elif [ "`echo $device | /bin/grep "/dev/sfdsk/"`" != "" ] 57: then 58: if [ "`echo $device | /bin/grep ":"`" != "" ] 59: then 60: # /dev/sfdsk/class/dsk/volume:sd? -> class_volume_sd? 61: dev="`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`" 62: dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`" 63: dev="`echo $dev | /bin/sed "s/:/_/"`" 64: device="`echo $device | /bin/cut -d: -f1`" 65: else 66: # /dev/sfdsk/class/dsk/volume -> _gds_class_volume 67: dev="_gds_`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`" 68: dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`" 69: fi 70: elif [ "`echo $device | /bin/grep "/dev/disk/by-id/"`" != "" ] 71: then 72: # "/dev/disk/by-id/<device>" -> "_by-id_<device>" 73: dev="_by-id_`echo $device | /bin/sed "s/\/dev\/disk\/by-id\///"`" 74: elif [ "`echo $device | /bin/grep "/dev/disk/by-path/"`" != "" ] 75: then 76: # "/dev/disk/by-path/<device>" -> "_by-path_<device>" 77: dev="_by-path_`echo $device | /bin/sed "s/\/dev\/disk\/by-path\///"`" 78: else 79: exit 0 80: fi 81: post_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".pre" 82: fstype_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".fstype" 83: bd_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".bd" 84: 85: if [ "$mount_point" != "" ] 86: then 87: 88: # When device cannot be unmounted 89: # 90: #if [ "$device" = "/dev/sdX" -o "$device" = "/dev/sdY" ] 91: #then 92: #if [ "$bk_device" != "" ] 93: #then 94: #echo $bk_device > $bd_file 95: #fi 96: #/bin/awk "\$2==\"$mount_point\" {print \$3}" /proc/mounts > $fstype_file 97: #/bin/sync 98: #/bin/sync 99: #/bin/sync 100: #echo "fsck" > $post_file 101: 102: # When device can be unmounted 103: # 104: #else 105: if [ `/bin/cat /proc/mounts |/bin/cut -d' ' -f 2|/bin/grep "^$mount_point\$"|/usr/bin/wc -w` != 1 ]; then 106: # stack mount (multi device on $mount_point) 107: /bin/mount > $err_log_path/$dev.umount 2>&1 108: exit 13 109: fi 110: if [ `/bin/cat /proc/mounts |/bin/cut -d' ' -f 1|/bin/grep "^$device\$"|/usr/bin/wc -w` != 1 ]; then 111: # bind mount (device has multi mount point) 112: /bin/mount > $err_log_path/$dev.umount 2>&1 113: exit 13 114: fi 115: 116: /bin/awk "\$2==\"$mount_point\" {print \$3}" /proc/mounts > $fstype_file 117: /bin/umount $mount_point 2>/dev/null 118: if [ $? != 0 ] 119: then 120: retry_count=3 121: sleep_time=1 122: result_flag=1 123: 124: while [ $retry_count -gt 0 ] 125: do 126: /bin/umount $mount_point > $err_log_path/$dev.umount 2>&1 127: if [ $? != 0 ] 128: then 129: retry_count=`expr $retry_count - 1` 130: /bin/sleep $sleep_time 131: else 132: /bin/rm -f $err_log_path/$dev.umount 133: result_flag=0 134: break 135: fi 136: done 137: 138: if [ $result_flag != 0 ] 139: then 140: /sbin/fuser -vu $mount_point> $err_log_path/$dev.fuser 2>&1 141: /bin/ps -ef > $err_log_path/$dev.ps 2>&1 142: 143: exit 10 144: fi 145: fi 146: echo "mount" > $post_file 147: 148: #fi 149: 150: # When device was not mounted 151: # 152: else 153: echo "none" > $post_file 154: fi 155: 156: exit 0 |
マウントされているがアンマウントしたくない業務ボリュームに対しては、90〜100、104、148行目のコメント(“#”)をエディタ等で消去し、90行目のif文で対象となるデバイスを指示してください。なお、97行目のsyncコマンドを実施してからバックアップ後処理を実施するまでの間は、業務ボリュームのファイルシステム更新操作を行わないようにしてください。もし、この間にファイルシステム更新操作が行われると、ファイルシステムが不完全な状態でバックアップが採取されるか、またはバックアップ後処理で実施するfsckコマンドがエラーとなる可能性があります。
この操作は、ファイルシステムが以下の場合のみ可能です。
ext2
ext3
カスタマイズしたスクリプトによる前処理の動作は、以下のようになります。
業務ボリュームの状態 |
前処理 |
---|---|
マウントされている |
業務ボリュームへの更新を抑止します |
カスタマイズしたスクリプトによる後処理の動作は、以下のようになります。
前処理 |
後処理 |
---|---|
業務ボリュームへの更新を抑止した |
業務ボリュームへの更新抑止を解除します バックアップボリュームの整合性を確認します |
SDXオブジェクトをスライス単位で運用する場合は、90行目にはスライス名(/dev/sfdsk/(クラス名)/dsk/(ボリューム名):(sdxinfoのDEVNAMの値))ではなく、論理ボリューム名(/dev/sfdsk/(クラス名)/dsk/(ボリューム名))を指定してください。
目次
索引
![]() ![]() |