The replication source volume script (RepSrc.pre) and the replication destination volume script (RepDst.pre) are prepared for a pre-processing script, and it is stored in the following directory. Please customize these scripts according to the processing requirements.
/etc/opt/FJSVswsrp/sh
/etc/opt/FJSVswsrp/<logical node name>/sh
1: #!/bin/sh
2:
3: # AdvancedCopy Manager
4: # Copyright FUJITSU LIMITED, 2002-2012
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: # 13: Illegal mount type (stack/bind mount)
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: # Determination postprocessing file name
30: if [ "`echo $device | /bin/grep "/dev/sd"`" != "" ]
31: then
32: # /dev/sd? -> sd?
33: dev="`echo $device | /bin/sed "s/\/dev\///"`"
34: elif [ "`echo $device | /bin/grep "/dev/vd"`" != "" ]
35: then
36: # /dev/vd? -> vd?
37: dev="`echo $device | /bin/sed "s/\/dev\///"`"
38: elif [ "`echo $device | /bin/grep "/dev/FJSV"`" != "" ]
39: then
40: # /dev/FJSVmphd/dsk/mplb?s? -> mplb?s?
41: # /dev/FJSVmphd/dsk/mphd?s? -> mphd?s?
42: dev="`echo $device | /bin/cut -d/ -f5`"
43: elif [ "`echo $device | /bin/grep "/dev/sfdsk/"`" != "" ]
44: then
45: if [ "`echo $device | /bin/grep ":"`" != "" ]
46: then
47: devnam="`echo $device | /bin/cut -d: -f2-`"
48: # /dev/sfdsk/class/dsk/volume:sd? -> class_volume_sd?
49: dev="`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`"
50: dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`"
51: dev="`echo $dev | /bin/sed "s/:/_/"`"
52: device="`echo $device | /bin/cut -d: -f1`"
53: if [ "`echo $devnam | /bin/grep "/dev/disk/by-id/"`" != "" ]
54: then
55: # /dev/sfdsk/class/dsk/volume:/dev/disk/by-id/<device> -> class_volume__by_id_<device>
56: dev="`echo $dev | /bin/sed "s/\/dev\/disk\/by-id\//_by-id_/"`"
57: elif [ "`echo $devnam | /bin/grep "/dev/disk/by-path/"`" != "" ]
58: then
59: # /dev/sfdsk/class/dsk/volume:/dev/disk/by-path/<device> -> class_volume__by_path_<device>
60: dev="`echo $dev | /bin/sed "s/\/dev\/disk\/by-path\//_by-path_/"`"
61: fi
62: else
63: # /dev/sfdsk/class/dsk/volume -> _gds_class_volume
64: dev="_gds_`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`"
65: dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`"
66: fi
67: elif [ "`echo $device | /bin/grep "/dev/vx/dmp/"`" != "" ]
68: then
69: # /dev/vx/dmp/device -> _vx_pv_device
70: dev="_vx_pv_`echo $device | /bin/sed "s/\/dev\/vx\/dmp\///"`"
71: elif [ "`echo $device | /bin/grep "/dev/mapper/"`" != "" ]
72: then
73: # "/dev/mapper/<device>" -> "_mapper_<device>"
74: dev="_mapper_`echo $device | /bin/sed "s/\/dev\/mapper\///"`"
75: elif [ "`echo $device | /bin/grep "/dev/disk/by-id/"`" != "" ]
76: then
77: # "/dev/disk/by-id/<device>" -> "_by-id_<device>"
78: dev="_by-id_`echo $device | /bin/sed "s/\/dev\/disk\/by-id\///"`"
79: elif [ "`echo $device | /bin/grep "/dev/disk/by-path/"`" != "" ]
80: then
81: # "/dev/disk/by-path/<device>" -> "_by-path_<device>"
82: dev="_by-path_`echo $device | /bin/sed "s/\/dev\/disk\/by-path\///"`"
83: else
84: exit 0
85: fi
86: post_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".spre"
87: fstype_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".sfstype"
88:
89: err_log_path="/var/opt/FJSVswsrp/"$SWSTGNODE"/log"
90:
91: if [ "$mount_point" != "" ]
92: # When device was mounted
93: #
94: then
95:
96: if [ `/bin/cat /proc/mounts |/bin/cut -d' ' -f 2|/bin/grep "^$mount_point\$"|/usr/bin/wc -w` != 1 ]; then
97: # stack mount (multi device on $mount_point)
98: /bin/mount > $err_log_path/$dev.umount 2>&1
99: exit 13
100: fi
101: if [ `/bin/cat /proc/mounts |/bin/cut -d' ' -f 1|/bin/grep "^$device\$"|/usr/bin/wc -w` != 1 ]; then
102: cdevice="/dev/`/usr/bin/readlink $device | /bin/sed "s/..\/..\///"`"
103: if [ `/bin/cat /proc/mounts |/bin/cut -d' ' -f 1|/bin/grep "^$cdevice\$"|/usr/bin/wc -w` != 1 ]; then
104: # bind mount (device has multi mount point)
105: /bin/mount > $err_log_path/$dev.umount 2>&1
106: exit 13
107: fi
108: fi
109:
110: /bin/awk "\$2==\"$mount_point\" {print \$3}" /proc/mounts > $fstype_file
111:
112: /bin/umount $mount_point 2>/dev/null
113:
114: if [ $? != 0 ]
115: then
116: retry_count=3
117: sleep_time=1
118: result_flag=1
119:
120: while [ $retry_count -gt 0 ]
121: do
122: /bin/umount $mount_point > $err_log_path/$dev.umount 2>&1
123: if [ $? != 0 ]
124: then
125: retry_count=`expr $retry_count - 1`
126: /bin/sleep $sleep_time
127: else
128: /bin/rm -f $err_log_path/$dev.umount
129: result_flag=0
130: break
131: fi
132: done
133:
134: if [ $result_flag != 0 ]
135: then
136: /sbin/fuser -vum $mount_point> $err_log_path/$dev.fuser 2>&1
137: /bin/ps -ef > $err_log_path/$dev.ps 2>&1
138: exit 10
139: fi
140: fi
141:
142: echo "mount,$mount_point" > $post_file
143:
144: # When device was not mounted
145: #
146: else
147: echo "none" > $post_file
148: fi
149:
150: exit 0 1: #!/bin/sh
2:
3: # AdvancedCopy Manager
4: # Copyright FUJITSU LIMITED, 2002-2012
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: # 13: Illegal mount type (bind/stack mount)
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: # Determination postprocessing file name
30: if [ "`echo $device | /bin/grep "/dev/sd"`" != "" ]
31: then
32: # /dev/sd? -> sd?
33: dev="`echo $device | /bin/sed "s/\/dev\///"`"
34: elif [ "`echo $device | /bin/grep "/dev/vd"`" != "" ]
35: then
36: # /dev/vd? -> vd?
37: dev="`echo $device | /bin/sed "s/\/dev\///"`"
38: elif [ "`echo $device | /bin/grep "/dev/FJSV"`" != "" ]
39: then
40: # /dev/FJSVmphd/dsk/mplb?s? -> mplb?s?
41: # /dev/FJSVmphd/dsk/mphd?s? -> mphd?s?
42: dev="`echo $device | /bin/cut -d/ -f5`"
43: elif [ "`echo $device | /bin/grep "/dev/sfdsk/"`" != "" ]
44: then
45: if [ "`echo $device | /bin/grep ":"`" != "" ]
46: then
47: devnam="`echo $device | /bin/cut -d: -f2-`"
48: # /dev/sfdsk/class/dsk/volume:sd? -> class_volume_sd?
49: dev="`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`"
50: dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`"
51: dev="`echo $dev | /bin/sed "s/:/_/"`"
52: device="`echo $device | /bin/cut -d: -f1`"
53: if [ "`echo $devnam | /bin/grep "/dev/disk/by-id/"`" != "" ]
54: then
55: # /dev/sfdsk/class/dsk/volume:/dev/disk/by-id/<device> -> class_volume__by_id_<device>
56: dev="`echo $dev | /bin/sed "s/\/dev\/disk\/by-id\//_by-id_/"`"
57: elif [ "`echo $devnam | /bin/grep "/dev/disk/by-path/"`" != "" ]
58: then
59: # /dev/sfdsk/class/dsk/volume:/dev/disk/by-path/<device> -> class_volume__by_path_<device>
60: dev="`echo $dev | /bin/sed "s/\/dev\/disk\/by-path\//_by-path_/"`"
61: fi
62: else
63: # /dev/sfdsk/class/dsk/volume -> _gds_class_volume
64: dev="_gds_`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`"
65: dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`"
66: fi
67: elif [ "`echo $device | /bin/grep "/dev/vx/dmp/"`" != "" ]
68: then
69: # /dev/vx/dmp/device -> _vx_pv_device
70: dev="_vx_pv_`echo $device | /bin/sed "s/\/dev\/vx\/dmp\///"`"
71: elif [ "`echo $device | /bin/grep "/dev/mapper/"`" != "" ]
72: then
73: # "/dev/mapper/<device>" -> "_mapper_<device>"
74: dev="_mapper_`echo $device | /bin/sed "s/\/dev\/mapper\///"`"
75: elif [ "`echo $device | /bin/grep "/dev/disk/by-id/"`" != "" ]
76: then
77: # "/dev/disk/by-id/<device>" -> "_by-id_<device>"
78: dev="_by-id_`echo $device | /bin/sed "s/\/dev\/disk\/by-id\///"`"
79: elif [ "`echo $device | /bin/grep "/dev/disk/by-path/"`" != "" ]
80: then
81: # "/dev/disk/by-path/<device>" -> "_by-path_<device>"
82: dev="_by-path_`echo $device | /bin/sed "s/\/dev\/disk\/by-path\///"`"
83: else
84: exit 0
85: fi
86: post_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".dpre"
87: fstype_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".dfstype"
88:
89: err_log_path="/var/opt/FJSVswsrp/"$SWSTGNODE"/log"
90:
91: if [ "$mount_point" != "" ]
92: # When device was mounted
93: #
94: then
95:
96: if [ `/bin/cat /proc/mounts |/bin/cut -d' ' -f 2|/bin/grep "^$mount_point\$"|/usr/bin/wc -w` != 1 ]; then
97: # stack mount (multi device on $mount_point)
98: /bin/mount > $err_log_path/$dev.umount 2>&1
99: exit 13
100: fi
101: if [ `/bin/cat /proc/mounts |/bin/cut -d' ' -f 1|/bin/grep "^$device\$"|/usr/bin/wc -w` != 1 ]; then
102: cdevice="/dev/`/usr/bin/readlink $device | /bin/sed "s/..\/..\///"`"
103: if [ `/bin/cat /proc/mounts |/bin/cut -d' ' -f 1|/bin/grep "^$cdevice\$"|/usr/bin/wc -w` != 1 ]; then
104: # bind mount (device has multi mount point)
105: /bin/mount > $err_log_path/$dev.umount 2>&1
106: exit 13
107: fi
108: fi
109:
110: /bin/awk "\$2==\"$mount_point\" {print \$3}" /proc/mounts > $fstype_file
111:
112: /bin/umount $mount_point 2>/dev/null
113:
114: if [ $? != 0 ]
115: then
116: retry_count=3
117: sleep_time=1
118: result_flag=1
119:
120: while [ $retry_count -gt 0 ]
121: do
122: /bin/umount $mount_point > $err_log_path/$dev.umount 2>&1
123: if [ $? != 0 ]
124: then
125: retry_count=`expr $retry_count - 1`
126: /bin/sleep $sleep_time
127: else
128: /bin/rm -f $err_log_path/$dev.umount
129: result_flag=0
130: break
131: fi
132: done
133:
134: if [ $result_flag != 0 ]
135: then
136: /sbin/fuser -vum $mount_point> $err_log_path/$dev.fuser 2>&1
137: /bin/ps -ef > $err_log_path/$dev.ps 2>&1
138: exit 10
139: fi
140: fi
141:
142: echo "mount,$mount_point" > $post_file
143:
144: # When device was not mounted
145: #
146: else
147: echo "none" > $post_file
148: fi
149:
150: exit 0