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

C.2.2 レプリケーション実行時の前処理

前処理のシェルスクリプトには複写元ボリューム(RepSrc.Pre)と複写先ボリューム(RepDst.Pre)を用意し、以下のディレクトリ配下に格納されています。処理の必要性に応じてシェルスクリプトをカスタマイズしてください。

RepSrc.pre(複写元ボリューム前処理のシェルスクリプト)

  1: #!/bin/sh
  2: 
  3: # AdvancedCopy Manager
  4: # All Rights Reserved, Copyright FUJITSU LIMITED, 2002-2009
  5: 
  6: #
  7: #   Pre-processing 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/FJSV"`" != "" ]
 35: then
 36:     # /dev/FJSVmphd/dsk/mplb?s? -> mplb?s?
 37:     # /dev/FJSVmphd/dsk/mphd?s? -> mphd?s?
 38:     dev="`echo $device | /bin/cut -d/ -f5`"
 39: elif [ "`echo $device | /bin/grep "/dev/sfdsk/"`" != "" ]
 40: then
 41:     if [ "`echo $device | /bin/grep ":"`" != ""   ]
 42:     then
 43:         devnam="`echo $device | /bin/cut -d: -f2-`"
 44:         # /dev/sfdsk/class/dsk/volume:sd? -> class_volume_sd?
 45:         dev="`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`"
 46:         dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`"
 47:         dev="`echo $dev | /bin/sed "s/:/_/"`"
 48:         device="`echo $device | /bin/cut -d: -f1`"
 49:         if [ "`echo $devnam | /bin/grep "/dev/disk/by-id/"`" != "" ]
 50:         then
 51:             # /dev/sfdsk/class/dsk/volume:/dev/disk/by-id/<device> -> class_volume__by_id_<device>
 52:             dev="`echo $dev | /bin/sed "s/\/dev\/disk\/by-id\//_by-id_/"`"
 53:         elif [ "`echo $devnam | /bin/grep "/dev/disk/by-path/"`" != "" ]
 54:         then
 55:             # /dev/sfdsk/class/dsk/volume:/dev/disk/by-path/<device> -> class_volume__by_path_<device>
 56:             dev="`echo $dev | /bin/sed "s/\/dev\/disk\/by-path\//_by-path_/"`"
 57:         fi
 58:     else
 59:         # /dev/sfdsk/class/dsk/volume -> _gds_class_volume
 60:         dev="_gds_`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`"
 61:         dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`"
 62:     fi
 63: elif [ "`echo $device | /bin/grep "/dev/disk/by-id/"`" != "" ]
 64: then
 65:     # "/dev/disk/by-id/<device>" -> "_by-id_<device>"
 66:     dev="_by-id_`echo $device | /bin/sed "s/\/dev\/disk\/by-id\///"`"
 67: elif [ "`echo $device | /bin/grep "/dev/disk/by-path/"`" != "" ]
 68: then
 69:     # "/dev/disk/by-path/<device>" -> "_by-path_<device>"
 70:     dev="_by-path_`echo $device | /bin/sed "s/\/dev\/disk\/by-path\///"`"
 71: else
 72:     exit 0
 73: fi
 74: post_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".spre"
 75: fstype_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".sfstype"
 76: 
 77: err_log_path="/var/opt/FJSVswsrp/"$SWSTGNODE"/log"
 78: 
 79: if [ "$mount_point" != "" ]
 80: # When device was mounted
 81: #
 82: then
 83: 
 84:         if [ `/bin/cat /proc/mounts |/bin/cut -d' ' -f 2|/bin/grep "^$mount_point\$"|/usr/bin/wc -w` != 1 ]; then
 85:                 # stack mount (multi device on $mount_point)
 86:                 /bin/mount  > $err_log_path/$dev.umount 2>&1
 87:                 exit 13
 88:         fi
 89:         if [ `/bin/cat /proc/mounts |/bin/cut -d' ' -f 1|/bin/grep "^$device\$"|/usr/bin/wc -w` != 1 ]; then
 90:                 # bind mount (device has multi mount point)
 91:                 /bin/mount  > $err_log_path/$dev.umount 2>&1
 92:                 exit 13
 93:         fi
 94: 
 95:     /bin/awk "\$2==\"$mount_point\" {print \$3}" /proc/mounts > $fstype_file
 96: 
 97:     /bin/umount $mount_point 2>/dev/null
 98: 
 99:     if [ $? != 0 ]
100:     then
101:             retry_count=3
102:             sleep_time=1
103:             result_flag=1
104: 
105:             while [ $retry_count -gt 0 ]
106:             do
107:                 /bin/umount $mount_point > $err_log_path/$dev.umount 2>&1
108:                 if [ $? != 0 ]
109:                 then
110:                     retry_count=`expr $retry_count - 1`
111:                     /bin/sleep $sleep_time
112:                 else
113:                     /bin/rm -f $err_log_path/$dev.umount
114:                     result_flag=0
115:                     break
116:                 fi
117:             done
118: 
119:             if [ $result_flag != 0 ]
120:             then
121:                 /sbin/fuser -vum $mount_point> $err_log_path/$dev.fuser 2>&1 
122:                 /bin/ps -ef > $err_log_path/$dev.ps 2>&1 
123:                 exit 10
124:             fi
125:     fi
126: 
127:     echo "mount,$mount_point" > $post_file
128: 
129: # When device was not mounted
130: #
131: else
132:     echo "none" > $post_file
133: fi
134: 
135: exit 0

RepDst.pre(複写先ボリューム前処理のシェルスクリプト)

  1: #!/bin/sh
  2:
  3: # AdvancedCopy Manager
  4: # All Rights Reserved, Copyright FUJITSU LIMITED, 2002-2009
  5:
  6: #
  7: #   Pre-processing 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/FJSV"`" != "" ]
 35: then
 36:     # /dev/FJSVmphd/dsk/mplb?s? -> mplb?s?
 37:     # /dev/FJSVmphd/dsk/mphd?s? -> mphd?s?
 38:     dev="`echo $device | /bin/cut -d/ -f5`"
 39: elif [ "`echo $device | /bin/grep "/dev/sfdsk/"`" != "" ]
 40: then
 41:     if [ "`echo $device | /bin/grep ":"`" != ""   ]
 42:     then
 43:         devnam="`echo $device | /bin/cut -d: -f2-`"
 44:        # /dev/sfdsk/class/dsk/volume:sd? -> class_volume_sd?
 45:         dev="`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`"
 46:         dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`"
 47:         dev="`echo $dev | /bin/sed "s/:/_/"`"
 48:         device="`echo $device | /bin/cut -d: -f1`"
 49:         if [ "`echo $devnam | /bin/grep "/dev/disk/by-id/"`" != "" ]
 50:         then
 51:             # /dev/sfdsk/class/dsk/volume:/dev/disk/by-id/<device> -> class_volume__by_id_<device>
 52:             dev="`echo $dev | /bin/sed "s/\/dev\/disk\/by-id\//_by-id_/"`"
 53:         elif [ "`echo $devnam | /bin/grep "/dev/disk/by-path/"`" != "" ]
 54:         then
 55:             # /dev/sfdsk/class/dsk/volume:/dev/disk/by-path/<device> -> class_volume__by_path_<device>
 56:             dev="`echo $dev | /bin/sed "s/\/dev\/disk\/by-path\//_by-path_/"`"
 57:         fi
 58:     else
 59:         # /dev/sfdsk/class/dsk/volume -> _gds_class_volume
 60:         dev="_gds_`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`"
 61:         dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`"
 62:     fi
 63: elif [ "`echo $device | /bin/grep "/dev/disk/by-id/"`" != "" ]
 64: then
 65:     # "/dev/disk/by-id/<device>" -> "_by-id_<device>"
 66:     dev="_by-id_`echo $device | /bin/sed "s/\/dev\/disk\/by-id\///"`"
 67: elif [ "`echo $device | /bin/grep "/dev/disk/by-path/"`" != "" ]
 68: then
 69:     # "/dev/disk/by-path/<device>" -> "_by-path_<device>"
 70:     dev="_by-path_`echo $device | /bin/sed "s/\/dev\/disk\/by-path\///"`"
 71: else
 72:     exit 0
 73: fi
 74: post_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".dpre"
 75: fstype_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".dfstype"
 76:
 77: err_log_path="/var/opt/FJSVswsrp/"$SWSTGNODE"/log"
 78:
 79: if [ "$mount_point" != "" ]
 80: # When device was mounted
 81: #
 82: then
 83:
 84:         if [ `/bin/cat /proc/mounts |/bin/cut -d' ' -f 2|/bin/grep "^$mount_point\$"|/usr/bin/wc -w` != 1 ]; then
 85:                 # stack mount (multi device on $mount_point)
 86:                 /bin/mount  > $err_log_path/$dev.umount 2>&1
 87:                 exit 13
 88:         fi
 89:         if [ `/bin/cat /proc/mounts |/bin/cut -d' ' -f 1|/bin/grep "^$device\$"|/usr/bin/wc -w` != 1 ]; then
 90:                 # bind mount (device has multi mount point)
 91:                 /bin/mount  > $err_log_path/$dev.umount 2>&1
 92:                 exit 13
 93:         fi
 94:
 95:     /bin/awk "\$2==\"$mount_point\" {print \$3}" /proc/mounts > $fstype_file
 96:
 97:     /bin/umount $mount_point 2>/dev/null
 98:
 99:     if [ $? != 0 ]
100:     then
101:             retry_count=3
102:             sleep_time=1
103:             result_flag=1
104:
105:             while [ $retry_count -gt 0 ]
106:             do
107:                 /bin/umount $mount_point > $err_log_path/$dev.umount 2>&1
108:                 if [ $? != 0 ]
109:                 then
110:                     retry_count=`expr $retry_count - 1`
111:                     /bin/sleep $sleep_time
112:                 else
113:                     /bin/rm -f $err_log_path/$dev.umount
114:                     result_flag=0
115:                     break
116:                 fi
117:             done
118:
119:             if [ $result_flag != 0 ]
120:             then
121:                 /sbin/fuser -vum $mount_point> $err_log_path/$dev.fuser 2>&1
122:                 /bin/ps -ef > $err_log_path/$dev.ps 2>&1
123:                 exit 10
124:             fi
125:     fi
126:
127:     echo "mount,$mount_point" > $post_file
128:
129: # When device was not mounted
130: #
131: else
132:     echo "none" > $post_file
133: fi
134:
135: exit 0