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

付録A バックアップ/リストアの前後処理> A.3 リストアの前後処理

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

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

リストア時の前処理シェルスクリプト

  1:   #!/bin/sh
  2:   
  3:   # AdvancedCopy Manager
  4:   # All Rights Reserved, Copyright FUJITSU LIMITED, 2002-2007
  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:  
 32:  # Determination of postprocessing file name
 33:  
 34:  if [ "$SWSTGNODE" != "" ]
 35:  then
 36:  swstg_node="/`echo $SWSTGNODE`"
 37:  else
 38:  swstg_node=""
 39:  fi
 40:  
 41:  err_log_path="/var/opt/FJSVswsts"$swstg_node"/log"
 42:  
 43:  if [ "`echo $device | /bin/grep "/dev/sd"`" != "" ]
 44:  then
 45:  # /dev/sd? -> sd?
 46:  dev="`echo $device | /bin/sed "s/\/dev\///"`"
 47:  elif [ "`echo $device | /bin/grep "/dev/FJSV"`" != "" ]
 48:  then
 49:  # /dev/FJSVmphd/dsk/mplb?s? -> mplb?s?
 50:  # /dev/FJSVmphd/dsk/mphd?s? -> mphd?s?
 51:  dev="`echo $device | /bin/cut -d/ -f5`"
 52:  elif [ "`echo $device | /bin/grep "/dev/sfdsk/"`" != "" ]
 53:  then
 54:  if [ "`echo $device | /bin/grep ":"`" != ""   ]
 55:  then
 56:  # /dev/sfdsk/class/dsk/volume:sd? -> class_volume_sd?
 57:  dev="`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`"
 58:  dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`"
 59:  dev="`echo $dev | /bin/sed "s/:/_/"`"
 60:  device="`echo $device | /bin/cut -d: -f1`"
 61:  else
 62:  # /dev/sfdsk/class/dsk/volume -> _gds_class_volume
 63:  dev="_gds_`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`"
 64:  dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`"
 65:  fi
 66:  elif [ "`echo $device | /bin/grep "/dev/disk/by-id/"`" != "" ]
 67:  then
 68:  # "/dev/disk/by-id/<device>" -> "_by-id_<device>"
 69:  dev="_by-id_`echo $device | /bin/sed "s/\/dev\/disk\/by-id\///"`"
 70:  elif [ "`echo $device | /bin/grep "/dev/disk/by-path/"`" != "" ]
 71:  then
 72:  # "/dev/disk/by-path/<device>" -> "_by-path_<device>"
 73:  dev="_by-path_`echo $device | /bin/sed "s/\/dev\/disk\/by-path\///"`"
 74:  else
 75:  exit 0
 76:  fi
 77:  post_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".pre"
 78:  fstype_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".fstype"
 79:  
 80:  if [ "$mount_point" != "" ]
 81:  then
 82:          if [ `/bin/cat /proc/mounts |/bin/cut -d' ' -f 2|/bin/grep "^$mount_point\$"|/usr/bin/wc -w` != 1 ]; then
 83:  # stack mount (multi device on $mount_point)
 84:  /bin/mount  > $err_log_path/$dev.umount 2>&1
 85:                  exit 13
 86:          fi
 87:          if [ `/bin/cat /proc/mounts |/bin/cut -d' ' -f 1|/bin/grep "^$device\$"|/usr/bin/wc -w` != 1 ]; then
 88:  # bind mount (device has multi mount point)
 89:  /bin/mount  > $err_log_path/$dev.umount 2>&1
 90:                  exit 13
 91:          fi
 92:  
 93:  
 94:  # When device can be unmounted
 95:  #
 96:  #df -ln $mount_point | cut -f2 -d: | cut -f2 -d' ' > $fstype_file
 97:  /bin/awk "\$2==\"$mount_point\" {print \$3}" /proc/mounts > $fstype_file
 98:  /bin/umount $mount_point 2> /dev/null
 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 -vu $mount_point> $err_log_path/$dev.fuser 2>&1 
122: /bin/ps -ef > $err_log_path/$dev.ps 2>&1 
123: 
124: exit 10
125: fi
126: fi
127: echo "mount" > $post_file
128: 
129: # When device was not mounted
130: #
131: else
132: echo "none" > $post_file
133: fi
134: 
135: exit 0

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


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

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