リストア実行時の前処理のシェルスクリプト名は、以下のとおりです。
クラスタ運用でない場合
/etc/opt/FJSVswsts/sh/OpcRestore.pre |
クラスタ運用の場合
/etc/opt/FJSVswsts/logicalNodeName/sh/OpcRestore.pre |
リストア時の前処理シェルスクリプト(OpcRestore.pre)
RHEL5/RHEL6/RHEL7の場合
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
SUSE Linux Enterprise Server 12の場合
1: #!/bin/sh 2: 3: # AdvancedCopy Manager 4: # All Rights Reserved, Copyright FUJITSU LIMITED, 2002-2011 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 | /usr/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 | /usr/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 | /usr/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/vx/dmp/"`" != "" ] 77: then 78: # /dev/vx/dmp/device -> _vx_pv_device 79: dev="_vx_pv_`echo $device | /bin/sed "s/\/dev\/vx\/dmp\///"`" 80: elif [ "`echo $device | /bin/grep "/dev/mapper/"`" != "" ] 81: then 82: # "/dev/mapper/<device>" -> "_mapper_<device>" 83: dev="_mapper_`echo $device | /bin/sed "s/\/dev\/mapper\///"`" 84: elif [ "`echo $device | /bin/grep "/dev/disk/by-id/"`" != "" ] 85: then 86: # "/dev/disk/by-id/<device>" -> "_by-id_<device>" 87: dev="_by-id_`echo $device | /bin/sed "s/\/dev\/disk\/by-id\///"`" 88: elif [ "`echo $device | /bin/grep "/dev/disk/by-path/"`" != "" ] 89: then 90: # "/dev/disk/by-path/<device>" -> "_by-path_<device>" 91: dev="_by-path_`echo $device | /bin/sed "s/\/dev\/disk\/by-path\///"`" 92: else 93: exit 0 94: fi 95: post_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".pre" 96: fstype_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".fstype" 97: 98: if [ "$mount_point" != "" ] 99: then 100: if [ `/bin/cat /proc/mounts | /usr/bin/cut -d' ' -f 2| /bin/grep "^$mount_point\$"| /usr/bin/wc -w` != 1 ]; then 101: /bin/mount > $err_log_path/$dev.umount 2>&1 102: exit 13 103: fi 104: 105: if [ `/bin/cat /proc/mounts | /usr/bin/cut -d' ' -f 1| /bin/grep "^$device\$"| /usr/bin/wc -w` != 1 ]; then 106: cdevice="/dev/`/usr/bin/readlink $device | /bin/sed "s/..\/..\///"`" 107: if [ `/bin/cat /proc/mounts | /usr/bin/cut -d' ' -f 1|/bin/grep "^$cdevice\$"|/usr/bin/wc -w` != 1 ]; then 108: /bin/mount > $err_log_path/$dev.umount 2>&1 109: exit 13 110: fi 111: fi 112: 113: 114: # When device can be unmounted 115: # 116: # df -ln $mount_point | cut -f2 -d: | cut -f2 -d' ' > $fstype_file 117: /bin/awk "\$2==\"$mount_point\" {print \$3}" /proc/mounts > $fstype_file 118: /bin/umount $mount_point 2> /dev/null 119: if [ $? != 0 ] 120: then 121: retry_count=3 122: sleep_time=1 123: result_flag=1 124: 125: while [ $retry_count -gt 0 ] 126: do 127: /bin/umount $mount_point > $err_log_path/$dev.umount 2>&1 128: if [ $? != 0 ] 129: then 130: retry_count=`expr $retry_count - 1` 131: /bin/sleep $sleep_time 132: else 133: /bin/rm -f $err_log_path/$dev.umount 134: result_flag=0 135: break 136: fi 137: done 138: 139: if [ $result_flag != 0 ] 140: then 141: /bin/fuser -vum $mount_point> $err_log_path/$dev.fuser 2>&1 142: /bin/ps -ef > $err_log_path/$dev.ps 2>&1 143: 144: exit 10 145: fi 146: fi 147: echo "mount" > $post_file 148: 149: # When device was not mounted 150: # 151: else 152: echo "none" > $post_file 153: fi 154: 155: exit 0
マウントされているがアンマウントできない業務ボリュームに対しては、リストアできません。リストア先のデバイスを指示してください。