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

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

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

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

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

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