リストア実行時の前処理のシェルスクリプト名は、以下のとおりです。
クラスタ運用でない場合
/etc/opt/FJSVswsts/sh/OpcRestore.pre |
クラスタ運用の場合
/etc/opt/FJSVswsts/logicalNodeName/sh/OpcRestore.pre |
リストア時の前処理シェルスクリプト(OpcRestore.pre)
Red Hat Enterprise Linux 8、Red Hat Enterprise Linux 7、またはRed Hat Enterprise Linux 6の場合
1: #!/bin/sh
2:
3: # AdvancedCopy Manager
4: # Copyright FUJITSU LIMITED, 2002-2021
5:
6: #
7: # Preprocessing of restoration processing
8: #
9: # Argument: $1 Device name of transaction disk
10: # $2 Mount point of transaction disk
11: #
12: # Error number
13: # 2: Argument error
14: # 10: umount error
15: # 13: Illegal mount type (bind/stack mount)
16:
17:
18: # Argument check
19: case $# in
20: 1)
21: ;;
22: 2)
23: ;;
24: *)
25: exit 2
26: ;;
27: esac
28:
29: device="`echo $1`"
30: mount_point="`echo $2`"
31: cyclemax=3
32: bindstack_cyclenumfile="bindstack.cyclenum"
33: unmount_cyclenumfile="unmount.cyclenum"
34:
35: # Determination of postprocessing file name
36:
37: if [ "$SWSTGNODE" != "" ]
38: then
39: swstg_node="/`echo $SWSTGNODE`"
40: else
41: swstg_node=""
42: fi
43:
44: err_log_path="/var/opt/FJSVswsts"$swstg_node"/log"
45:
46: if [ "`echo $device | /bin/grep "/dev/sd"`" != "" ]
47: then
48: # /dev/sd? -> sd?
49: dev="`echo $device | /bin/sed "s/\/dev\///"`"
50: elif [ "`echo $device | /bin/grep "/dev/vd"`" != "" ]
51: then
52: # /dev/vd? -> vd?
53: dev="`echo $device | /bin/sed "s/\/dev\///"`"
54: elif [ "`echo $device | /bin/grep "/dev/FJSV"`" != "" ]
55: then
56: # /dev/FJSVmphd/dsk/mplb?s? -> mplb?s?
57: # /dev/FJSVmphd/dsk/mphd?s? -> mphd?s?
58: dev="`echo $device | /bin/cut -d/ -f5`"
59: elif [ "`echo $device | /bin/grep "/dev/sfdsk/"`" != "" ]
60: then
61: if [ "`echo $device | /bin/grep ":"`" != "" ]
62: then
63: devnam="`echo $device | /bin/cut -d: -f2-`"
64: # /dev/sfdsk/class/dsk/volume:sd? -> class_volume_sd?
65: dev="`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`"
66: dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`"
67: dev="`echo $dev | /bin/sed "s/:/_/"`"
68: device="`echo $device | /bin/cut -d: -f1`"
69: if [ "`echo $devnam | /bin/grep "/dev/disk/by-id/"`" != "" ]
70: then
71: # /dev/sfdsk/class/dsk/volume:/dev/disk/by-id/<device> -> class_volume__by_id_<device>
72: dev="`echo $dev | /bin/sed "s/\/dev\/disk\/by-id\//_by-id_/"`"
73: elif [ "`echo $devnam | /bin/grep "/dev/disk/by-path/"`" != "" ]
74: then
75: # /dev/sfdsk/class/dsk/volume:/dev/disk/by-path/<device> -> class_volume__by_path_<device>
76: dev="`echo $dev | /bin/sed "s/\/dev\/disk\/by-path\//_by-path_/"`"
77: fi
78: else
79: # /dev/sfdsk/class/dsk/volume -> _gds_class_volume
80: dev="_gds_`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`"
81: dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`"
82: fi
83: elif [ "`echo $device | /bin/grep "/dev/vx/dmp/"`" != "" ]
84: then
85: # /dev/vx/dmp/device -> _vx_pv_device
86: dev="_vx_pv_`echo $device | /bin/sed "s/\/dev\/vx\/dmp\///"`"
87: elif [ "`echo $device | /bin/grep "/dev/mapper/"`" != "" ]
88: then
89: # "/dev/mapper/<device>" -> "_mapper_<device>"
90: dev="_mapper_`echo $device | /bin/sed "s/\/dev\/mapper\///"`"
91: elif [ "`echo $device | /bin/grep "/dev/disk/by-id/"`" != "" ]
92: then
93: # "/dev/disk/by-id/<device>" -> "_by-id_<device>"
94: dev="_by-id_`echo $device | /bin/sed "s/\/dev\/disk\/by-id\///"`"
95: elif [ "`echo $device | /bin/grep "/dev/disk/by-path/"`" != "" ]
96: then
97: # "/dev/disk/by-path/<device>" -> "_by-path_<device>"
98: dev="_by-path_`echo $device | /bin/sed "s/\/dev\/disk\/by-path\///"`"
99: else
100: exit 0
101: fi
102: post_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".pre"
103: fstype_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".fstype"
104:
105: if [ "$mount_point" != "" ]
106: then
107: if [ `/bin/cat /proc/mounts |/bin/cut -d' ' -f 2|/bin/grep "^$mount_point\$"|/usr/bin/wc -w` != 1 ]; then
108: # stack mount (multi device on $mount_point)
109: if [ -f $err_log_path/$bindstack_cyclenumfile ]
110: then
111: cyclenum=`/bin/cut -c 1 $err_log_path/$bindstack_cyclenumfile`
112: cyclenum=`expr $cyclenum + 1 2>/dev/null`
113: if [ $? != 0 ]; then
114: cyclenum='1'
115: fi
116: if [ $cyclenum -gt $cyclemax ]; then
117: cyclenum='1'
118: fi
119: else
120: cyclenum='1'
121: fi
122: echo $cyclenum > $err_log_path/$bindstack_cyclenumfile
123:
124: echo `date '+%Y-%m-%d %T'` > $err_log_path/"$dev"_$cyclenum.mounts
125: echo "" >> $err_log_path/"$dev"_$cyclenum.mounts
126: echo mount_point = $mount_point >> $err_log_path/"$dev"_$cyclenum.mounts
127: echo "" >> $err_log_path/"$dev"_$cyclenum.mounts
128: /bin/cat /proc/mounts >> $err_log_path/"$dev"_$cyclenum.mounts 2>&1
129: echo "" >> $err_log_path/"$dev"_$cyclenum.mounts
130: /bin/mount >> $err_log_path/"$dev"_$cyclenum.mounts 2>&1
131: exit 13
132: fi
133: if [ `/bin/cat /proc/mounts |/bin/cut -d' ' -f 1|/bin/grep "^$device\$"|/usr/bin/wc -w` != 1 ]; then
134: cdevice="/dev/`/usr/bin/readlink $device | /bin/sed "s/..\/..\///"`"
135: if [ `/bin/cat /proc/mounts |/bin/cut -d' ' -f 1|/bin/grep "^$cdevice\$"|/usr/bin/wc -w` != 1 ]; then
136: # bind mount (device has multi mount point)
137: if [ -f $err_log_path/$bindstack_cyclenumfile ]
138: then
139: cyclenum=`/bin/cut -c 1 $err_log_path/$bindstack_cyclenumfile`
140: cyclenum=`expr $cyclenum + 1 2>/dev/null`
141: if [ $? != 0 ]; then
142: cyclenum='1'
143: fi
144: if [ $cyclenum -gt $cyclemax ]; then
145: cyclenum='1'
146: fi
147: else
148: cyclenum='1'
149: fi
150: echo $cyclenum > $err_log_path/$bindstack_cyclenumfile
151:
152: echo `date '+%Y-%m-%d %T'` > $err_log_path/"$dev"_$cyclenum.mounts
153: echo "" >> $err_log_path/"$dev"_$cyclenum.mounts
154: echo mount_point = $mount_point >> $err_log_path/"$dev"_$cyclenum.mounts
155: echo cdevice = $cdevice >> $err_log_path/"$dev"_$cyclenum.mounts
156: echo "" >> $err_log_path/"$dev"_$cyclenum.mounts
157: /bin/cat /proc/mounts >> $err_log_path/"$dev"_$cyclenum.mounts 2>&1
158: echo "" >> $err_log_path/"$dev"_$cyclenum.mounts
159: /bin/mount >> $err_log_path/"$dev"_$cyclenum.mounts 2>&1
160: exit 13
161: fi
162: fi
163:
164:
165: # When device can be unmounted
166: #
167: # df -ln $mount_point | cut -f2 -d: | cut -f2 -d' ' > $fstype_file
168: /bin/awk "\$2==\"$mount_point\" {print \$3}" /proc/mounts > $fstype_file
169: /bin/umount $mount_point 2> /dev/null
170: if [ $? != 0 ]
171: then
172: retry_count=3
173: retry_def=$retry_count
174: sleep_time=1
175: result_flag=1
176:
177: while [ $retry_count -gt 0 ]
178: do
179: /bin/umount $mount_point > $err_log_path/$dev.umount 2>&1
180: if [ $? != 0 ]
181: then
182: if [ $retry_count -eq $retry_def ]
183: then
184: if [ -f $err_log_path/$unmount_cyclenumfile ]
185: then
186: cyclenum=`/bin/cut -c 1 $err_log_path/$unmount_cyclenumfile`
187: cyclenum=`expr $cyclenum + 1 2>/dev/null`
188: if [ $? != 0 ]; then
189: cyclenum='1'
190: fi
191: if [ $cyclenum -gt $cyclemax ]; then
192: cyclenum='1'
193: fi
194: else
195: cyclenum='1'
196: fi
197: echo $cyclenum > $err_log_path/$unmount_cyclenumfile
198: : > $err_log_path/"$dev"_$cyclenum.umount
199: : > $err_log_path/"$dev"_$cyclenum.fuser
200: : > $err_log_path/"$dev"_$cyclenum.ps
201: fi
202:
203: echo `date '+%Y-%m-%d %T'` >> $err_log_path/"$dev"_$cyclenum.umount
204: echo `date '+%Y-%m-%d %T'` >> $err_log_path/"$dev"_$cyclenum.fuser
205: echo `date '+%Y-%m-%d %T'` >> $err_log_path/"$dev"_$cyclenum.ps
206: /bin/cat $err_log_path/$dev.umount >> $err_log_path/"$dev"_$cyclenum.umount 2>&1
207: /sbin/fuser -vum $mount_point >> $err_log_path/"$dev"_$cyclenum.fuser 2>&1
208: /bin/ps -ef >> $err_log_path/"$dev"_$cyclenum.ps 2>&1
209: echo "" >> $err_log_path/"$dev"_$cyclenum.umount
210: echo "" >> $err_log_path/"$dev"_$cyclenum.fuser
211: echo "" >> $err_log_path/"$dev"_$cyclenum.ps
212:
213: retry_count=`expr $retry_count - 1`
214: /bin/sleep $sleep_time
215: else
216: /bin/rm -f $err_log_path/$dev.umount
217: result_flag=0
218: break
219: fi
220: done
221:
222: if [ $result_flag != 0 ]
223: then
224: exit 10
225: fi
226: fi
227: echo "mount" > $post_file
228:
229: # When device was not mounted
230: #
231: else
232: echo "none" > $post_file
233: fi
234:
235: exit 0SUSE Linux Enterprise Server 15またはSUSE Linux Enterprise Server 12の場合
1: #!/bin/sh
2:
3: # AdvancedCopy Manager
4: # All Rights Reserved, Copyright FUJITSU LIMITED, 2002-2021
5:
6: #
7: # Preprocessing of restoration processing
8: #
9: # Argument: $1 Device name of transaction disk
10: # $2 Mount point of transaction disk
11: #
12: # Error number
13: # 2: Argument error
14: # 10: umount error
15: # 13: Illegal mount type (bind/stack mount)
16:
17:
18: # Argument check
19: case $# in
20: 1)
21: ;;
22: 2)
23: ;;
24: *)
25: exit 2
26: ;;
27: esac
28:
29: device="`echo $1`"
30: mount_point="`echo $2`"
31: cyclemax=3
32: bindstack_cyclenumfile="bindstack.cyclenum"
33: unmount_cyclenumfile="unmount.cyclenum"
34:
35: # Determination of postprocessing file name
36:
37: if [ "$SWSTGNODE" != "" ]
38: then
39: swstg_node="/`echo $SWSTGNODE`"
40: else
41: swstg_node=""
42: fi
43:
44: err_log_path="/var/opt/FJSVswsts"$swstg_node"/log"
45:
46: if [ "`echo $device | /bin/grep "/dev/sd"`" != "" ]
47: then
48: # /dev/sd? -> sd?
49: dev="`echo $device | /bin/sed "s/\/dev\///"`"
50: elif [ "`echo $device | /bin/grep "/dev/FJSV"`" != "" ]
51: then
52: # /dev/FJSVmphd/dsk/mplb?s? -> mplb?s?
53: # /dev/FJSVmphd/dsk/mphd?s? -> mphd?s?
54: dev="`echo $device | /usr/bin/cut -d/ -f5`"
55: elif [ "`echo $device | /bin/grep "/dev/sfdsk/"`" != "" ]
56: then
57: if [ "`echo $device | /bin/grep ":"`" != "" ]
58: then
59: devnam="`echo $device | /usr/bin/cut -d: -f2-`"
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 | /usr/bin/cut -d: -f1`"
65: if [ "`echo $devnam | /bin/grep "/dev/disk/by-id/"`" != "" ]
66: then
67: # /dev/sfdsk/class/dsk/volume:/dev/disk/by-id/<device> -> class_volume__by_id_<device>
68: dev="`echo $dev | /bin/sed "s/\/dev\/disk\/by-id\//_by-id_/"`"
69: elif [ "`echo $devnam | /bin/grep "/dev/disk/by-path/"`" != "" ]
70: then
71: # /dev/sfdsk/class/dsk/volume:/dev/disk/by-path/<device> -> class_volume__by_path_<device>
72: dev="`echo $dev | /bin/sed "s/\/dev\/disk\/by-path\//_by-path_/"`"
73: fi
74: else
75: # /dev/sfdsk/class/dsk/volume -> _gds_class_volume
76: dev="_gds_`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`"
77: dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`"
78: fi
79: elif [ "`echo $device | /bin/grep "/dev/vx/dmp/"`" != "" ]
80: then
81: # /dev/vx/dmp/device -> _vx_pv_device
82: dev="_vx_pv_`echo $device | /bin/sed "s/\/dev\/vx\/dmp\///"`"
83: elif [ "`echo $device | /bin/grep "/dev/mapper/"`" != "" ]
84: then
85: # "/dev/mapper/<device>" -> "_mapper_<device>"
86: dev="_mapper_`echo $device | /bin/sed "s/\/dev\/mapper\///"`"
87: elif [ "`echo $device | /bin/grep "/dev/disk/by-id/"`" != "" ]
88: then
89: # "/dev/disk/by-id/<device>" -> "_by-id_<device>"
90: dev="_by-id_`echo $device | /bin/sed "s/\/dev\/disk\/by-id\///"`"
91: elif [ "`echo $device | /bin/grep "/dev/disk/by-path/"`" != "" ]
92: then
93: # "/dev/disk/by-path/<device>" -> "_by-path_<device>"
94: dev="_by-path_`echo $device | /bin/sed "s/\/dev\/disk\/by-path\///"`"
95: else
96: exit 0
97: fi
98: post_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".pre"
99: fstype_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".fstype"
100:
101: if [ "$mount_point" != "" ]
102: then
103: if [ `/bin/cat /proc/mounts | /usr/bin/cut -d' ' -f 2| /bin/grep "^$mount_point\$"| /usr/bin/wc -w` != 1 ]; then
104: if [ -f $err_log_path/$bindstack_cyclenumfile ]
105: then
106: cyclenum=`/usr/bin/cut -c 1 $err_log_path/$bindstack_cyclenumfile`
107: cyclenum=`expr $cyclenum + 1 2>/dev/null`
108: if [ $? != 0 ]; then
109: cyclenum='1'
110: fi
111: if [ $cyclenum -gt $cyclemax ]; then
112: cyclenum='1'
113: fi
114: else
115: cyclenum='1'
116: fi
117: echo $cyclenum > $err_log_path/$bindstack_cyclenumfile
118:
119: echo `date '+%Y-%m-%d %T'` > $err_log_path/"$dev"_$cyclenum.mounts
120: echo "" >> $err_log_path/"$dev"_$cyclenum.mounts
121: echo mount_point = $mount_point >> $err_log_path/"$dev"_$cyclenum.mounts
122: echo "" >> $err_log_path/"$dev"_$cyclenum.mounts
123: /bin/cat /proc/mounts >> $err_log_path/"$dev"_$cyclenum.mounts 2>&1
124: echo "" >> $err_log_path/"$dev"_$cyclenum.mounts
125: /bin/mount >> $err_log_path/"$dev"_$cyclenum.mounts 2>&1
126: exit 13
127: fi
128:
129: if [ `/bin/cat /proc/mounts | /usr/bin/cut -d' ' -f 1| /bin/grep "^$device\$"| /usr/bin/wc -w` != 1 ]; then
130: cdevice="/dev/`/usr/bin/readlink $device | /bin/sed "s/..\/..\///"`"
131: if [ `/bin/cat /proc/mounts | /usr/bin/cut -d' ' -f 1|/bin/grep "^$cdevice\$"|/usr/bin/wc -w` != 1 ]; then
132: if [ -f $err_log_path/$bindstack_cyclenumfile ]
133: then
134: cyclenum=`/usr/bin/cut -c 1 $err_log_path/$bindstack_cyclenumfile`
135: cyclenum=`expr $cyclenum + 1 2>/dev/null`
136: if [ $? != 0 ]; then
137: cyclenum='1'
138: fi
139: if [ $cyclenum -gt $cyclemax ]; then
140: cyclenum='1'
141: fi
142: else
143: cyclenum='1'
144: fi
145: echo $cyclenum > $err_log_path/$bindstack_cyclenumfile
146:
147: echo `date '+%Y-%m-%d %T'` > $err_log_path/"$dev"_$cyclenum.mounts
148: echo "" >> $err_log_path/"$dev"_$cyclenum.mounts
149: echo mount_point = $mount_point >> $err_log_path/"$dev"_$cyclenum.mounts
150: echo cdevice = $cdevice >> $err_log_path/"$dev"_$cyclenum.mounts
151: echo "" >> $err_log_path/"$dev"_$cyclenum.mounts
152: /bin/cat /proc/mounts >> $err_log_path/"$dev"_$cyclenum.mounts 2>&1
153: echo "" >> $err_log_path/"$dev"_$cyclenum.mounts
154: /bin/mount >> $err_log_path/"$dev"_$cyclenum.mounts 2>&1
155: exit 13
156: fi
157: fi
158:
159:
160: # When device can be unmounted
161: #
162: # df -ln $mount_point | cut -f2 -d: | cut -f2 -d' ' > $fstype_file
163: /bin/awk "\$2==\"$mount_point\" {print \$3}" /proc/mounts > $fstype_file
164: /bin/umount $mount_point 2> /dev/null
165: if [ $? != 0 ]
166: then
167: retry_count=3
168: retry_def=$retry_count
169: sleep_time=1
170: result_flag=1
171:
172: while [ $retry_count -gt 0 ]
173: do
174: /bin/umount $mount_point > $err_log_path/$dev.umount 2>&1
175: if [ $? != 0 ]
176: then
177: if [ $retry_count -eq $retry_def ]
178: then
179: if [ -f $err_log_path/$unmount_cyclenumfile ]
180: then
181: cyclenum=`/usr/bin/cut -c 1 $err_log_path/$unmount_cyclenumfile`
182: cyclenum=`expr $cyclenum + 1 2>/dev/null`
183: if [ $? != 0 ]; then
184: cyclenum='1'
185: fi
186: if [ $cyclenum -gt $cyclemax ]; then
187: cyclenum='1'
188: fi
189: else
190: cyclenum='1'
191: fi
192: echo $cyclenum > $err_log_path/$unmount_cyclenumfile
193: : > $err_log_path/"$dev"_$cyclenum.umount
194: : > $err_log_path/"$dev"_$cyclenum.fuser
195: : > $err_log_path/"$dev"_$cyclenum.ps
196: fi
197:
198: echo `date '+%Y-%m-%d %T'` >> $err_log_path/"$dev"_$cyclenum.umount
199: echo `date '+%Y-%m-%d %T'` >> $err_log_path/"$dev"_$cyclenum.fuser
200: echo `date '+%Y-%m-%d %T'` >> $err_log_path/"$dev"_$cyclenum.ps
201: /bin/cat $err_log_path/$dev.umount >> $err_log_path/"$dev"_$cyclenum.umount 2>&1
202: /bin/fuser -vum $mount_point >> $err_log_path/"$dev"_$cyclenum.fuser 2>&1
203: /bin/ps -ef >> $err_log_path/"$dev"_$cyclenum.ps 2>&1
204: echo "" >> $err_log_path/"$dev"_$cyclenum.umount
205: echo "" >> $err_log_path/"$dev"_$cyclenum.fuser
206: echo "" >> $err_log_path/"$dev"_$cyclenum.ps
207:
208: retry_count=`expr $retry_count - 1`
209: /bin/sleep $sleep_time
210: else
211: /bin/rm -f $err_log_path/$dev.umount
212: result_flag=0
213: break
214: fi
215: done
216:
217: if [ $result_flag != 0 ]
218: then
219: exit 10
220: fi
221: fi
222: echo "mount" > $post_file
223:
224: # When device was not mounted
225: #
226: else
227: echo "none" > $post_file
228: fi
229:
230: exit 0マウントされているがアンマウントできない業務ボリュームに対しては、リストアできません。リストア先のデバイスを指示してください。