ETERNUS SF AdvancedCopy Manager 運用手引書 13.2 -Linux-
目次 索引 前ページ次ページ

付録C レプリケーションの前後処理> C.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-2007
  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/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:          # /dev/sfdsk/class/dsk/volume:sd? -> class_volume_sd?
 44:          dev="`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`"
 45:          dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`"
 46:          dev="`echo $dev | /bin/sed "s/:/_/"`"
 47:          device="`echo $device | /bin/cut -d: -f1`"
 48:      else
 49:          # /dev/sfdsk/class/dsk/volume -> _gds_class_volume
 50:          dev="_gds_`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`"
 51:          dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`"
 52:      fi
 53:  elif [ "`echo $device | /bin/grep "/dev/disk/by-id/"`" != "" ]
 54:  then
 55:      # "/dev/disk/by-id/<device>" -> "_by-id_<device>"
 56:      dev="_by-id_`echo $device | /bin/sed "s/\/dev\/disk\/by-id\///"`"
 57:  elif [ "`echo $device | /bin/grep "/dev/disk/by-path/"`" != "" ]
 58:  then
 59:      # "/dev/disk/by-path/<device>" -> "_by-path_<device>"
 60:      dev="_by-path_`echo $device | /bin/sed "s/\/dev\/disk\/by-path\///"`"
 61:  else
 62:      exit 0
 63:  fi
 64:  post_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".spre"
 65:  fstype_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".sfstype"
 66:  
 67:  err_log_path="/var/opt/FJSVswsrp/"$SWSTGNODE"/log"
 68:  
 69:  if [ "$mount_point" != "" ]
 70:  # When device was mounted
 71:  #
 72:  then
 73:  
 74:          if [ `/bin/cat /proc/mounts |/bin/cut -d' ' -f 2|/bin/grep "^$mount_point\$"|/usr/bin/wc -w` != 1 ]; then
 75:                  # stack mount (multi device on $mount_point)
 76:                  /bin/mount  > $err_log_path/$dev.umount 2>&1
 77:                  exit 13
 78:          fi
 79:          if [ `/bin/cat /proc/mounts |/bin/cut -d' ' -f 1|/bin/grep "^$device\$"|/usr/bin/wc -w` != 1 ]; then
 80:                  # bind mount (device has multi mount point)
 81:                  /bin/mount  > $err_log_path/$dev.umount 2>&1
 82:                  exit 13
 83:          fi
 84:  
 85:      /bin/awk "\$2==\"$mount_point\" {print \$3}" /proc/mounts > $fstype_file
 86:  
 87:      /bin/umount $mount_point 2>/dev/null
 88:  
 89:      if [ $? != 0 ]
 90:      then
 91:              retry_count=3
 92:              sleep_time=1
 93:              result_flag=1
 94:  
 95:              while [ $retry_count -gt 0 ]
 96:              do
 97:                  /bin/umount $mount_point > $err_log_path/$dev.umount 2>&1
 98:                  if [ $? != 0 ]
 99:                  then
100:                     retry_count=`expr $retry_count - 1`
101:                     /bin/sleep $sleep_time
102:                 else
103:                     /bin/rm -f $err_log_path/$dev.umount
104:                     result_flag=0
105:                     break
106:                 fi
107:             done
108: 
109:             if [ $result_flag != 0 ]
110:             then
111:                 /sbin/fuser -vu $mount_point> $err_log_path/$dev.fuser 2>&1 
112:                 /bin/ps -ef > $err_log_path/$dev.ps 2>&1 
113:                 exit 10
114:             fi
115:     fi
116: 
117:     echo "mount,$mount_point" > $post_file
118: 
119: # When device was not mounted
120: #
121: else
122:     echo "none" > $post_file
123: fi
124: 
125: exit 0

 

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

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

■複写元ボリュームをアンマウントしたくない場合

マウントされているがアンマウントしたくない複写元ボリュームに対しては、「バックアップの前後処理」を参考にしてスクリプトをカスタマイズしてください。

この操作は、ファイルシステムが以下の場合のみ可能です。


目次 索引 前ページ次ページ

All Rights Reserved, Copyright(C) 富士通株式会社 2000-2008