ページの先頭行へ戻る
ETERNUS SF AdvancedCopy Manager 15.3 運用ガイド
ETERNUS

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

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

リストア時の前処理シェルスクリプト(OpcRestore.pre)

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

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