ページの先頭行へ戻る
ETERNUS SF AdvancedCopy Manager 14.1 運用手引書

A.3.1 リストア実行時の前処理

リストア実行時の前処理のシェルスクリプト名は、以下のとおりです。

シェルスクリプトの内容は、以下のとおりです。

  1: #!/bin/sh
  2: 
  3: # AdvancedCopy Manager
  4: # All Rights Reserved, Copyright FUJITSU LIMITED, 2002-2008
  5: 
  6: #
  7: #   Pre-processing of restoration processing
  8: #
  9: #               Argument: $1 Device or VG name of transaction disk
 10: #                             $2 Mount point of transaction disk
 11: #
 12: #       Error number
 13: #               2: Argument error (system error)
 14: #              10: umount error
 15: #              30: VG configuration file not found error
 16: #              99: Script not customize
 17: 
 18: 
 19: # Argument check
 20: case $# in
 21: 1)
 22:         ;;
 23: 2)
 24:         ;;
 25: *)
 26:         exit 2
 27:         ;;
 28: esac
 29: 
 30: device=$1
 31: mount_point=$2
 32: 
 33: # Determination of postprocessing file name
 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: # Device type check
 45: trans="`echo $device | /usr/bin/grep -e "/dev/dsk/" -e "/dev/disk/"`"
 46: lvmtrans="`echo $device | /usr/bin/grep "/dev/"`"
 47: vxpvtrans="`echo $device | /usr/bin/grep "/dev/vx/dmp/"`"
 48: if [ "$trans" != "" ]
 49: then
 50:         dev_type="physical"
 51:         dev="`echo $device | /usr/bin/sed -e "s/\/dev\/dsk\///" -e "s/\/dev\/disk\//_hppv_/"`"
 52:         post_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".pre"
 53:         fstype_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".fstype"
 54: elif [ "$vxpvtrans" != "" ]
 55: then
 56:         dev_type="vxvm_pv"
 57:         # /dev/vx/dmp/XXXX -> XXXX
 58:         dev="`echo $device | /usr/bin/awk -F\/ '{ print $5 }'`"
 59:         post_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".pre"
 60:         fstype_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".fstype"
 61: elif [ "$lvmtrans" != "" ]
 62: then
 63:         dev_type="logical"
 64:         # /dev/vgXX -> vgXX
 65:         dev="`echo $device | /usr/bin/awk -F\/ '{ print $3 }'`"
 66:         post_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".pre"
 67:         fstype_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".fstype"
 68: else
 69:         exit 0
 70: fi
 71: 
 72: # When the transaction disk is a physical device #############################
 73: if [ "$dev_type" = "physical" ]
 74: then
 75: 
 76: # When device was mounted --- 1
 77:         if [ "$mount_point" != "" ]
 78:         then
 79:                 /usr/bin/df -ln $mount_point 2>/dev/null | /usr/bin/awk -F: '{ print $2 }' | /usr/bin/awk '{ print $1 }' > $fstype_file
 80:                 /usr/sbin/umount $mount_point 2> /dev/null
 81:                 if [ $? != 0 ]
 82:                 then
 83:                     retry_count=3
 84:                     sleep_time=1
 85:                     result_flag=1
 86:             
 87:                     while [ $retry_count -gt 0 ]
 88:                     do
 89:                         /usr/sbin/umount $mount_point > $err_log_path/$dev.umount 2>&1
 90:                         if [ $? != 0 ]
 91:                         then
 92:                             retry_count=`expr $retry_count - 1`
 93:                             /usr/bin/sleep $sleep_time
 94:                         else
 95:                             /usr/bin/rm -f $err_log_path/$dev.umount
 96:                             result_flag=0
 97:                             break
 98:                         fi
 99:                     done
100:             
101:                     if [ $result_flag != 0 ]
102: 
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:                 echo "mount" > $post_file
111: 
112: # When device was not mounted --- 2
113:         else
114:                 echo "none" > $post_file
115:         fi
116: 
117: # When the transaction disk is a volume group ################################
118: elif [ "$dev_type" = "logical" ]
119: then
120: 
121:         # Check VG configuration file exists
122:         vg_name="`echo $device | /usr/bin/awk -F\/ '{ print $3 }'`"
123:         cfg_file="/etc/lvmconf/"$vg_name".conf"
124:         if [ ! -r $cfg_file ]
125:         then
126:                 exit 30
127:         fi
128: 
129: # Devices is volume group and script not customize
130:         exit 99
131: 
132: # When devices of volume group was mounted --- 3
133: #       # Specify the name of volume group to unmount
134: #       if [ "$device" = "/dev/vgXX" ]
135: #       then
136: #
137: #               # Unmount all logical volumes of the volume group
138: #               mount_point="/XX"
139: #               /usr/sbin/umount $mount_point 2>/dev/null
140: #               if [ $? != 0 ]
141: #               then
142: #                    retry_count=3
143: #                    sleep_time=1
144: #                    result_flag=1
145: #            
146: #                    while [ $retry_count -gt 0 ]
147: #                    do
148: #                        /usr/sbin/umount $mount_point > $err_log_path/$dev.umount 2>&1
149: #                        if [ $? != 0 ]
150: #                        then
151: #                            retry_count=`expr $retry_count - 1`
152: #                            sleep $sleep_time
153: #                        else
154: #                            rm -f $err_log_path/$dev.umount
155: #                            result_flag=0
156: #                            break
157: #                        fi
158: #                    done
159: #            
160: #                    if [ $result_flag != 0 ]
161: #
162: #                    then
163: #                        /usr/sbin/fuser -cu $mount_point> $err_log_path/$dev.fuser 2>&1 
164: #                        /usr/bin/ps -ef > $err_log_path/$dev.ps 2>&1 
165: #
166: #                        exit 10
167: #                    fi
168: #               fi
169: #               echo "mount" > $post_file
170: #       fi
171: 
172: # When devices of volume group was not mounted --- 4
173: #       # Specify the name of volume group to do nothing
174: #       if [ "$device" = "/dev/vgXX" ]
175: #       then
176: #                echo "none" > $post_file
177: #       fi
178: #
179: # When the transaction disk is a VxVM physical volume --- 5 ##################
180: elif [ "$dev_type" = "vxvm_pv" ]
181: then
182:         # Nothing is done to VxVM PV. 
183:         #
184:         echo "none" > $post_file
185: fi
186: exit 0

マウントされているがアンマウントできない業務ボリュームに対しては、リストアはできません。リストア先のデバイスを指示してください。