前処理シェルスクリプトには、複写元ボリューム用(RepSrc.pre)と複写先ボリューム用(RepDst.pre)の2種類があり、それぞれのスクリプトは以下のディレクトリに格納されています。必要に応じて、カスタマイズしてください。
クラスタ運用でない場合
/etc/opt/FJSVswsrp/shディレクトリ |
クラスタ運用の場合
/etc/opt/FJSVswsrp/logicalNodeName/shディレクトリ |
複写元ボリューム用の前処理シェルスクリプト(RepSrc.pre)
Red Hat Enterprise Linux 8、Red Hat Enterprise Linux 7、またはRed Hat Enterprise Linux 6の場合
1: #!/bin/sh 2: 3: # AdvancedCopy Manager 4: # Copyright FUJITSU LIMITED, 2002-2021 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: # 14: fsfreeze error 17: 18: # Argument check 19: case $# in 20: 2) 21: ;; 22: *) 23: exit 2 24: ;; 25: esac 26: 27: device=$1 28: mount_point=$2 29: cyclemax=3 30: bindstack_cyclenumfile="bindstack.cyclenum" 31: unmount_cyclenumfile="unmount.cyclenum" 32: 33: # Determination postprocessing file name 34: if [ "`echo $device | /bin/grep "/dev/sd"`" != "" ] 35: then 36: # /dev/sd? -> sd? 37: dev="`echo $device | /bin/sed "s/\/dev\///"`" 38: elif [ "`echo $device | /bin/grep "/dev/vd"`" != "" ] 39: then 40: # /dev/vd? -> vd? 41: dev="`echo $device | /bin/sed "s/\/dev\///"`" 42: elif [ "`echo $device | /bin/grep "/dev/FJSV"`" != "" ] 43: then 44: # /dev/FJSVmphd/dsk/mplb?s? -> mplb?s? 45: # /dev/FJSVmphd/dsk/mphd?s? -> mphd?s? 46: dev="`echo $device | /bin/cut -d/ -f5`" 47: elif [ "`echo $device | /bin/grep "/dev/sfdsk/"`" != "" ] 48: then 49: if [ "`echo $device | /bin/grep ":"`" != "" ] 50: then 51: devnam="`echo $device | /bin/cut -d: -f2-`" 52: # /dev/sfdsk/class/dsk/volume:sd? -> class_volume_sd? 53: dev="`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`" 54: dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`" 55: dev="`echo $dev | /bin/sed "s/:/_/"`" 56: device="`echo $device | /bin/cut -d: -f1`" 57: if [ "`echo $devnam | /bin/grep "/dev/disk/by-id/"`" != "" ] 58: then 59: # /dev/sfdsk/class/dsk/volume:/dev/disk/by-id/<device> -> class_volume__by_id_<device> 60: dev="`echo $dev | /bin/sed "s/\/dev\/disk\/by-id\//_by-id_/"`" 61: elif [ "`echo $devnam | /bin/grep "/dev/disk/by-path/"`" != "" ] 62: then 63: # /dev/sfdsk/class/dsk/volume:/dev/disk/by-path/<device> -> class_volume__by_path_<device> 64: dev="`echo $dev | /bin/sed "s/\/dev\/disk\/by-path\//_by-path_/"`" 65: fi 66: else 67: # /dev/sfdsk/class/dsk/volume -> _gds_class_volume 68: dev="_gds_`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`" 69: dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`" 70: fi 71: elif [ "`echo $device | /bin/grep "/dev/vx/dmp/"`" != "" ] 72: then 73: # /dev/vx/dmp/device -> _vx_pv_device 74: dev="_vx_pv_`echo $device | /bin/sed "s/\/dev\/vx\/dmp\///"`" 75: elif [ "`echo $device | /bin/grep "/dev/mapper/"`" != "" ] 76: then 77: # "/dev/mapper/<device>" -> "_mapper_<device>" 78: dev="_mapper_`echo $device | /bin/sed "s/\/dev\/mapper\///"`" 79: elif [ "`echo $device | /bin/grep "/dev/disk/by-id/"`" != "" ] 80: then 81: # "/dev/disk/by-id/<device>" -> "_by-id_<device>" 82: dev="_by-id_`echo $device | /bin/sed "s/\/dev\/disk\/by-id\///"`" 83: elif [ "`echo $device | /bin/grep "/dev/disk/by-path/"`" != "" ] 84: then 85: # "/dev/disk/by-path/<device>" -> "_by-path_<device>" 86: dev="_by-path_`echo $device | /bin/sed "s/\/dev\/disk\/by-path\///"`" 87: else 88: exit 0 89: fi 90: post_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".spre" 91: fstype_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".sfstype" 92: 93: err_log_path="/var/opt/FJSVswsrp/"$SWSTGNODE"/log" 94: 95: if [ "$mount_point" != "" ] 96: # When device was mounted 97: # 98: then 99: 100: proc="" 101: # When device cannot be unmounted(sync) 102: # if [ "$device" = "/dev/sdX" -o "$device" = "/dev/sdY" ] 103: # then 104: # proc="sync" 105: # /bin/sync 106: # /bin/sync 107: # /bin/sync 108: # echo "none" > $post_file 109: # fi 110: 111: # When device cannot be unmounted(fsfreeze) 112: # if [ "$device" = "/dev/sdX" -o "$device" = "/dev/sdY" ] 113: # then 114: # proc="fsfreeze" 115: # result="`/sbin/fsfreeze -f $mount_point 2>&1 `" 116: # if [ $? != 0 ] 117: # then 118: # echo "$result" > $err_log_path/$dev.fsfreeze 119: # exit 14 120: # fi 121: # echo "fsfreeze,$mount_point" > $post_file 122: # fi 123: 124: # When device can be unmounted 125: # 126: # if [ "$proc" = "" ];then 127: if [ `/bin/cat /proc/mounts |/bin/cut -d' ' -f 2|/bin/grep "^$mount_point\$"|/usr/bin/wc -w` != 1 ]; then 128: # stack mount (multi device on $mount_point) 129: if [ -f $err_log_path/$bindstack_cyclenumfile ] 130: then 131: cyclenum=`/bin/cut -c 1 $err_log_path/$bindstack_cyclenumfile` 132: cyclenum=`expr $cyclenum + 1 2>/dev/null` 133: if [ $? != 0 ]; then 134: cyclenum='1' 135: fi 136: if [ $cyclenum -gt $cyclemax ]; then 137: cyclenum='1' 138: fi 139: else 140: cyclenum='1' 141: fi 142: echo $cyclenum > $err_log_path/$bindstack_cyclenumfile 143: 144: echo `date '+%Y-%m-%d %T'` > $err_log_path/"$dev"_$cyclenum.mounts 145: echo "" >> $err_log_path/"$dev"_$cyclenum.mounts 146: echo mount_point = $mount_point >> $err_log_path/"$dev"_$cyclenum.mounts 147: echo "" >> $err_log_path/"$dev"_$cyclenum.mounts 148: /bin/cat /proc/mounts >> $err_log_path/"$dev"_$cyclenum.mounts 2>&1 149: echo "" >> $err_log_path/"$dev"_$cyclenum.mounts 150: /bin/mount >> $err_log_path/"$dev"_$cyclenum.mounts 2>&1 151: exit 13 152: fi 153: if [ `/bin/cat /proc/mounts |/bin/cut -d' ' -f 1|/bin/grep "^$device\$"|/usr/bin/wc -w` != 1 ]; then 154: cdevice="/dev/`/usr/bin/readlink $device | /bin/sed "s/..\/..\///"`" 155: if [ `/bin/cat /proc/mounts |/bin/cut -d' ' -f 1|/bin/grep "^$cdevice\$"|/usr/bin/wc -w` != 1 ]; then 156: # bind mount (device has multi mount point) 157: if [ -f $err_log_path/$bindstack_cyclenumfile ] 158: then 159: cyclenum=`/bin/cut -c 1 $err_log_path/$bindstack_cyclenumfile` 160: cyclenum=`expr $cyclenum + 1 2>/dev/null` 161: if [ $? != 0 ]; then 162: cyclenum='1' 163: fi 164: if [ $cyclenum -gt $cyclemax ]; then 165: cyclenum='1' 166: fi 167: else 168: cyclenum='1' 169: fi 170: echo $cyclenum > $err_log_path/$bindstack_cyclenumfile 171: 172: echo `date '+%Y-%m-%d %T'` > $err_log_path/"$dev"_$cyclenum.mounts 173: echo "" >> $err_log_path/"$dev"_$cyclenum.mounts 174: echo mount_point = $mount_point >> $err_log_path/"$dev"_$cyclenum.mounts 175: echo cdevice = $cdevice >> $err_log_path/"$dev"_$cyclenum.mounts 176: echo "" >> $err_log_path/"$dev"_$cyclenum.mounts 177: /bin/cat /proc/mounts >> $err_log_path/"$dev"_$cyclenum.mounts 2>&1 178: echo "" >> $err_log_path/"$dev"_$cyclenum.mounts 179: /bin/mount >> $err_log_path/"$dev"_$cyclenum.mounts 2>&1 180: exit 13 181: fi 182: fi 183: 184: /bin/awk "\$2==\"$mount_point\" {print \$3}" /proc/mounts > $fstype_file 185: 186: /bin/umount $mount_point 2>/dev/null 187: 188: if [ $? != 0 ] 189: then 190: retry_count=3 191: retry_def=$retry_count 192: sleep_time=1 193: result_flag=1 194: 195: while [ $retry_count -gt 0 ] 196: do 197: /bin/umount $mount_point > $err_log_path/$dev.umount 2>&1 198: if [ $? != 0 ] 199: then 200: if [ $retry_count -eq $retry_def ] 201: then 202: if [ -f $err_log_path/$unmount_cyclenumfile ] 203: then 204: cyclenum=`/bin/cut -c 1 $err_log_path/$unmount_cyclenumfile` 205: cyclenum=`expr $cyclenum + 1 2>/dev/null` 206: if [ $? != 0 ]; then 207: cyclenum='1' 208: fi 209: if [ $cyclenum -gt $cyclemax ]; then 210: cyclenum='1' 211: fi 212: else 213: cyclenum='1' 214: fi 215: echo $cyclenum > $err_log_path/$unmount_cyclenumfile 216: : > $err_log_path/"$dev"_$cyclenum.umount 217: : > $err_log_path/"$dev"_$cyclenum.fuser 218: : > $err_log_path/"$dev"_$cyclenum.ps 219: fi 220: 221: echo `date '+%Y-%m-%d %T'` >> $err_log_path/"$dev"_$cyclenum.umount 222: echo `date '+%Y-%m-%d %T'` >> $err_log_path/"$dev"_$cyclenum.fuser 223: echo `date '+%Y-%m-%d %T'` >> $err_log_path/"$dev"_$cyclenum.ps 224: /bin/cat $err_log_path/$dev.umount >> $err_log_path/"$dev"_$cyclenum.umount 2>&1 225: /sbin/fuser -vum $mount_point >> $err_log_path/"$dev"_$cyclenum.fuser 2>&1 226: /bin/ps -ef >> $err_log_path/"$dev"_$cyclenum.ps 2>&1 227: echo "" >> $err_log_path/"$dev"_$cyclenum.umount 228: echo "" >> $err_log_path/"$dev"_$cyclenum.fuser 229: echo "" >> $err_log_path/"$dev"_$cyclenum.ps 230: 231: retry_count=`expr $retry_count - 1` 232: /bin/sleep $sleep_time 233: else 234: /bin/rm -f $err_log_path/$dev.umount 235: result_flag=0 236: break 237: fi 238: done 239: 240: if [ $result_flag != 0 ] 241: then 242: exit 10 243: fi 244: fi 245: 246: echo "mount,$mount_point" > $post_file 247: 248: # fi 249: 250: # When device was not mounted 251: # 252: else 253: echo "none" > $post_file 254: fi 255: 256: exit 0
SUSE Linux Enterprise Server 15またはSUSE Linux Enterprise Server 12の場合
1: #!/bin/sh 2: 3: # AdvancedCopy Manager 4: # All Rights Reserved, Copyright FUJITSU LIMITED, 2002-2021 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: cyclemax=3 29: bindstack_cyclenumfile="bindstack.cyclenum" 30: unmount_cyclenumfile="unmount.cyclenum" 31: 32: # Determination postprocessing file name 33: if [ "`echo $device | /bin/grep "/dev/sd"`" != "" ] 34: then 35: # /dev/sd? -> sd? 36: dev="`echo $device | /bin/sed "s/\/dev\///"`" 37: elif [ "`echo $device | /bin/grep "/dev/FJSV"`" != "" ] 38: then 39: # /dev/FJSVmphd/dsk/mplb?s? -> mplb?s? 40: # /dev/FJSVmphd/dsk/mphd?s? -> mphd?s? 41: dev="`echo $device | /usr/bin/cut -d/ -f5`" 42: elif [ "`echo $device | /bin/grep "/dev/sfdsk/"`" != "" ] 43: then 44: if [ "`echo $device | /bin/grep ":"`" != "" ] 45: then 46: devnam="`echo $device | /usr/bin/cut -d: -f2-`" 47: # /dev/sfdsk/class/dsk/volume:sd? -> class_volume_sd? 48: dev="`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`" 49: dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`" 50: dev="`echo $dev | /bin/sed "s/:/_/"`" 51: device="`echo $device | /usr/bin/cut -d: -f1`" 52: if [ "`echo $devnam | /bin/grep "/dev/disk/by-id/"`" != "" ] 53: then 54: # /dev/sfdsk/class/dsk/volume:/dev/disk/by-id/<device> -> class_volume__by_id_<device> 55: dev="`echo $dev | /bin/sed "s/\/dev\/disk\/by-id\//_by-id_/"`" 56: elif [ "`echo $devnam | /bin/grep "/dev/disk/by-path/"`" != "" ] 57: then 58: # /dev/sfdsk/class/dsk/volume:/dev/disk/by-path/<device> -> class_volume__by_path_<device> 59: dev="`echo $dev | /bin/sed "s/\/dev\/disk\/by-path\//_by-path_/"`" 60: fi 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/vx/dmp/"`" != "" ] 67: then 68: # /dev/vx/dmp/device -> _vx_pv_device 69: dev="_vx_pv_`echo $device | /bin/sed "s/\/dev\/vx\/dmp\///"`" 70: elif [ "`echo $device | /bin/grep "/dev/mapper/"`" != "" ] 71: then 72: # "/dev/mapper/<device>" -> "_mapper_<device>" 73: dev="_mapper_`echo $device | /bin/sed "s/\/dev\/mapper\///"`" 74: elif [ "`echo $device | /bin/grep "/dev/disk/by-id/"`" != "" ] 75: then 76: # "/dev/disk/by-id/<device>" -> "_by-id_<device>" 77: dev="_by-id_`echo $device | /bin/sed "s/\/dev\/disk\/by-id\///"`" 78: elif [ "`echo $device | /bin/grep "/dev/disk/by-path/"`" != "" ] 79: then 80: # "/dev/disk/by-path/<device>" -> "_by-path_<device>" 81: dev="_by-path_`echo $device | /bin/sed "s/\/dev\/disk\/by-path\///"`" 82: else 83: exit 0 84: fi 85: post_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".spre" 86: fstype_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".sfstype" 87: 88: err_log_path="/var/opt/FJSVswsrp/"$SWSTGNODE"/log" 89: 90: if [ "$mount_point" != "" ] 91: # When device was mounted 92: # 93: then 94: proc="" 95: # When device cannot be unmounted(sync) 96: # if [ "$device" = "/dev/sdX" -o "$device" = "/dev/sdY" ] 97: # then 98: # proc="sync" 99: # /bin/sync 100: # /bin/sync 101: # /bin/sync 102: # echo "none" > $post_file 103: # fi 104: 105: # When device can be unmounted 106: # 107: # if [ "$proc" = "" ];then 108: if [ `/bin/cat /proc/mounts | /usr/bin/cut -d' ' -f 2| /bin/grep "^$mount_point\$"| /usr/bin/wc -w` != 1 ]; then 109: if [ -f $err_log_path/$bindstack_cyclenumfile ] 110: then 111: cyclenum=`/usr/bin/cut -c 1 $err_log_path/$bindstack_cyclenumfile` 112: cyclenum=`expr $cyclenum + 1 2>/dev/null` 113: if [ $? != 0 ]; then 114: cyclenum='1' 115: fi 116: if [ $cyclenum -gt $cyclemax ]; then 117: cyclenum='1' 118: fi 119: else 120: cyclenum='1' 121: fi 122: echo $cyclenum > $err_log_path/$bindstack_cyclenumfile 123: 124: echo `date '+%Y-%m-%d %T'` > $err_log_path/"$dev"_$cyclenum.mounts 125: echo "" >> $err_log_path/"$dev"_$cyclenum.mounts 126: echo mount_point = $mount_point >> $err_log_path/"$dev"_$cyclenum.mounts 127: echo "" >> $err_log_path/"$dev"_$cyclenum.mounts 128: /bin/cat /proc/mounts >> $err_log_path/"$dev"_$cyclenum.mounts 2>&1 129: echo "" >> $err_log_path/"$dev"_$cyclenum.mounts 130: /bin/mount >> $err_log_path/"$dev"_$cyclenum.mounts 2>&1 131: exit 13 132: fi 133: 134: if [ `/bin/cat /proc/mounts | /usr/bin/cut -d' ' -f 1| /bin/grep "^$device\$"| /usr/bin/wc -w` != 1 ]; then 135: cdevice="/dev/`/usr/bin/readlink $device | /bin/sed "s/..\/..\///"`" 136: if [ `/bin/cat /proc/mounts | /usr/bin/cut -d' ' -f 1|/bin/grep "^$cdevice\$"|/usr/bin/wc -w` != 1 ]; then 137: if [ -f $err_log_path/$bindstack_cyclenumfile ] 138: then 139: cyclenum=`/usr/bin/cut -c 1 $err_log_path/$bindstack_cyclenumfile` 140: cyclenum=`expr $cyclenum + 1 2>/dev/null` 141: if [ $? != 0 ]; then 142: cyclenum='1' 143: fi 144: if [ $cyclenum -gt $cyclemax ]; then 145: cyclenum='1' 146: fi 147: else 148: cyclenum='1' 149: fi 150: echo $cyclenum > $err_log_path/$bindstack_cyclenumfile 151: 152: echo `date '+%Y-%m-%d %T'` > $err_log_path/"$dev"_$cyclenum.mounts 153: echo "" >> $err_log_path/"$dev"_$cyclenum.mounts 154: echo mount_point = $mount_point >> $err_log_path/"$dev"_$cyclenum.mounts 155: echo cdevice = $cdevice >> $err_log_path/"$dev"_$cyclenum.mounts 156: echo "" >> $err_log_path/"$dev"_$cyclenum.mounts 157: /bin/cat /proc/mounts >> $err_log_path/"$dev"_$cyclenum.mounts 2>&1 158: echo "" >> $err_log_path/"$dev"_$cyclenum.mounts 159: /bin/mount >> $err_log_path/"$dev"_$cyclenum.mounts 2>&1 160: exit 13 161: fi 162: fi 163: 164: /bin/awk "\$2==\"$mount_point\" {print \$3}" /proc/mounts > $fstype_file 165: 166: /bin/umount $mount_point 2>/dev/null 167: 168: if [ $? != 0 ] 169: then 170: retry_count=3 171: retry_def=$retry_count 172: sleep_time=1 173: result_flag=1 174: 175: while [ $retry_count -gt 0 ] 176: do 177: /bin/umount $mount_point > $err_log_path/$dev.umount 2>&1 178: if [ $? != 0 ] 179: then 180: if [ $retry_count -eq $retry_def ] 181: then 182: if [ -f $err_log_path/$unmount_cyclenumfile ] 183: then 184: cyclenum=`/usr/bin/cut -c 1 $err_log_path/$unmount_cyclenumfile` 185: cyclenum=`expr $cyclenum + 1 2>/dev/null` 186: if [ $? != 0 ]; then 187: cyclenum='1' 188: fi 189: if [ $cyclenum -gt $cyclemax ]; then 190: cyclenum='1' 191: fi 192: else 193: cyclenum='1' 194: fi 195: echo $cyclenum > $err_log_path/$unmount_cyclenumfile 196: : > $err_log_path/"$dev"_$cyclenum.umount 197: : > $err_log_path/"$dev"_$cyclenum.fuser 198: : > $err_log_path/"$dev"_$cyclenum.ps 199: fi 200: 201: echo `date '+%Y-%m-%d %T'` >> $err_log_path/"$dev"_$cyclenum.umount 202: echo `date '+%Y-%m-%d %T'` >> $err_log_path/"$dev"_$cyclenum.fuser 203: echo `date '+%Y-%m-%d %T'` >> $err_log_path/"$dev"_$cyclenum.ps 204: /bin/cat $err_log_path/$dev.umount >> $err_log_path/"$dev"_$cyclenum.umount 2>&1 205: /bin/fuser -vum $mount_point >> $err_log_path/"$dev"_$cyclenum.fuser 2>&1 206: /bin/ps -ef >> $err_log_path/"$dev"_$cyclenum.ps 2>&1 207: echo "" >> $err_log_path/"$dev"_$cyclenum.umount 208: echo "" >> $err_log_path/"$dev"_$cyclenum.fuser 209: echo "" >> $err_log_path/"$dev"_$cyclenum.ps 210: 211: retry_count=`expr $retry_count - 1` 212: /bin/sleep $sleep_time 213: else 214: /bin/rm -f $err_log_path/$dev.umount 215: result_flag=0 216: break 217: fi 218: done 219: 220: if [ $result_flag != 0 ] 221: then 222: exit 10 223: fi 224: fi 225: 226: echo "mount,$mount_point" > $post_file 227: 228: # fi 229: 230: # When device was not mounted 231: # 232: else 233: echo "none" > $post_file 234: fi 235: 236: exit 0
複写先ボリューム用の前処理シェルスクリプト(RepDst.pre)
Red Hat Enterprise Linux 8、Red Hat Enterprise Linux 7、またはRed Hat Enterprise Linux 6の場合
1: #!/bin/sh 2: 3: # AdvancedCopy Manager 4: # Copyright FUJITSU LIMITED, 2002-2021 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: cyclemax=3 29: bindstack_cyclenumfile="bindstack.cyclenum" 30: unmount_cyclenumfile="unmount.cyclenum" 31: 32: # Determination postprocessing file name 33: if [ "`echo $device | /bin/grep "/dev/sd"`" != "" ] 34: then 35: # /dev/sd? -> sd? 36: dev="`echo $device | /bin/sed "s/\/dev\///"`" 37: elif [ "`echo $device | /bin/grep "/dev/vd"`" != "" ] 38: then 39: # /dev/vd? -> vd? 40: dev="`echo $device | /bin/sed "s/\/dev\///"`" 41: elif [ "`echo $device | /bin/grep "/dev/FJSV"`" != "" ] 42: then 43: # /dev/FJSVmphd/dsk/mplb?s? -> mplb?s? 44: # /dev/FJSVmphd/dsk/mphd?s? -> mphd?s? 45: dev="`echo $device | /bin/cut -d/ -f5`" 46: elif [ "`echo $device | /bin/grep "/dev/sfdsk/"`" != "" ] 47: then 48: if [ "`echo $device | /bin/grep ":"`" != "" ] 49: then 50: devnam="`echo $device | /bin/cut -d: -f2-`" 51: # /dev/sfdsk/class/dsk/volume:sd? -> class_volume_sd? 52: dev="`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`" 53: dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`" 54: dev="`echo $dev | /bin/sed "s/:/_/"`" 55: device="`echo $device | /bin/cut -d: -f1`" 56: if [ "`echo $devnam | /bin/grep "/dev/disk/by-id/"`" != "" ] 57: then 58: # /dev/sfdsk/class/dsk/volume:/dev/disk/by-id/<device> -> class_volume__by_id_<device> 59: dev="`echo $dev | /bin/sed "s/\/dev\/disk\/by-id\//_by-id_/"`" 60: elif [ "`echo $devnam | /bin/grep "/dev/disk/by-path/"`" != "" ] 61: then 62: # /dev/sfdsk/class/dsk/volume:/dev/disk/by-path/<device> -> class_volume__by_path_<device> 63: dev="`echo $dev | /bin/sed "s/\/dev\/disk\/by-path\//_by-path_/"`" 64: fi 65: else 66: # /dev/sfdsk/class/dsk/volume -> _gds_class_volume 67: dev="_gds_`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`" 68: dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`" 69: fi 70: elif [ "`echo $device | /bin/grep "/dev/vx/dmp/"`" != "" ] 71: then 72: # /dev/vx/dmp/device -> _vx_pv_device 73: dev="_vx_pv_`echo $device | /bin/sed "s/\/dev\/vx\/dmp\///"`" 74: elif [ "`echo $device | /bin/grep "/dev/mapper/"`" != "" ] 75: then 76: # "/dev/mapper/<device>" -> "_mapper_<device>" 77: dev="_mapper_`echo $device | /bin/sed "s/\/dev\/mapper\///"`" 78: elif [ "`echo $device | /bin/grep "/dev/disk/by-id/"`" != "" ] 79: then 80: # "/dev/disk/by-id/<device>" -> "_by-id_<device>" 81: dev="_by-id_`echo $device | /bin/sed "s/\/dev\/disk\/by-id\///"`" 82: elif [ "`echo $device | /bin/grep "/dev/disk/by-path/"`" != "" ] 83: then 84: # "/dev/disk/by-path/<device>" -> "_by-path_<device>" 85: dev="_by-path_`echo $device | /bin/sed "s/\/dev\/disk\/by-path\///"`" 86: else 87: exit 0 88: fi 89: post_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".dpre" 90: fstype_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".dfstype" 91: 92: err_log_path="/var/opt/FJSVswsrp/"$SWSTGNODE"/log" 93: 94: if [ "$mount_point" != "" ] 95: # When device was mounted 96: # 97: then 98: 99: if [ `/bin/cat /proc/mounts |/bin/cut -d' ' -f 2|/bin/grep "^$mount_point\$"|/usr/bin/wc -w` != 1 ]; then 100: # stack mount (multi device on $mount_point) 101: if [ -f $err_log_path/$bindstack_cyclenumfile ] 102: then 103: cyclenum=`/bin/cut -c 1 $err_log_path/$bindstack_cyclenumfile` 104: cyclenum=`expr $cyclenum + 1 2>/dev/null` 105: if [ $? != 0 ]; then 106: cyclenum='1' 107: fi 108: if [ $cyclenum -gt $cyclemax ]; then 109: cyclenum='1' 110: fi 111: else 112: cyclenum='1' 113: fi 114: echo $cyclenum > $err_log_path/$bindstack_cyclenumfile 115: 116: echo `date '+%Y-%m-%d %T'` > $err_log_path/"$dev"_$cyclenum.mounts 117: echo "" >> $err_log_path/"$dev"_$cyclenum.mounts 118: echo mount_point = $mount_point >> $err_log_path/"$dev"_$cyclenum.mounts 119: echo "" >> $err_log_path/"$dev"_$cyclenum.mounts 120: /bin/cat /proc/mounts >> $err_log_path/"$dev"_$cyclenum.mounts 2>&1 121: echo "" >> $err_log_path/"$dev"_$cyclenum.mounts 122: /bin/mount >> $err_log_path/"$dev"_$cyclenum.mounts 2>&1 123: exit 13 124: fi 125: if [ `/bin/cat /proc/mounts |/bin/cut -d' ' -f 1|/bin/grep "^$device\$"|/usr/bin/wc -w` != 1 ]; then 126: cdevice="/dev/`/usr/bin/readlink $device | /bin/sed "s/..\/..\///"`" 127: if [ `/bin/cat /proc/mounts |/bin/cut -d' ' -f 1|/bin/grep "^$cdevice\$"|/usr/bin/wc -w` != 1 ]; then 128: # bind mount (device has multi mount point) 129: if [ -f $err_log_path/$bindstack_cyclenumfile ] 130: then 131: cyclenum=`/bin/cut -c 1 $err_log_path/$bindstack_cyclenumfile` 132: cyclenum=`expr $cyclenum + 1 2>/dev/null` 133: if [ $? != 0 ]; then 134: cyclenum='1' 135: fi 136: if [ $cyclenum -gt $cyclemax ]; then 137: cyclenum='1' 138: fi 139: else 140: cyclenum='1' 141: fi 142: echo $cyclenum > $err_log_path/$bindstack_cyclenumfile 143: 144: echo `date '+%Y-%m-%d %T'` > $err_log_path/"$dev"_$cyclenum.mounts 145: echo "" >> $err_log_path/"$dev"_$cyclenum.mounts 146: echo mount_point = $mount_point >> $err_log_path/"$dev"_$cyclenum.mounts 147: echo cdevice = $cdevice >> $err_log_path/"$dev"_$cyclenum.mounts 148: echo "" >> $err_log_path/"$dev"_$cyclenum.mounts 149: /bin/cat /proc/mounts >> $err_log_path/"$dev"_$cyclenum.mounts 2>&1 150: echo "" >> $err_log_path/"$dev"_$cyclenum.mounts 151: /bin/mount >> $err_log_path/"$dev"_$cyclenum.mounts 2>&1 152: exit 13 153: fi 154: fi 155: 156: /bin/awk "\$2==\"$mount_point\" {print \$3}" /proc/mounts > $fstype_file 157: 158: /bin/umount $mount_point 2>/dev/null 159: 160: if [ $? != 0 ] 161: then 162: retry_count=3 163: retry_def=$retry_count 164: sleep_time=1 165: result_flag=1 166: 167: while [ $retry_count -gt 0 ] 168: do 169: /bin/umount $mount_point > $err_log_path/$dev.umount 2>&1 170: if [ $? != 0 ] 171: then 172: if [ $retry_count -eq $retry_def ] 173: then 174: if [ -f $err_log_path/$unmount_cyclenumfile ] 175: then 176: cyclenum=`/bin/cut -c 1 $err_log_path/$unmount_cyclenumfile` 177: cyclenum=`expr $cyclenum + 1 2>/dev/null` 178: if [ $? != 0 ]; then 179: cyclenum='1' 180: fi 181: if [ $cyclenum -gt $cyclemax ]; then 182: cyclenum='1' 183: fi 184: else 185: cyclenum='1' 186: fi 187: echo $cyclenum > $err_log_path/$unmount_cyclenumfile 188: : > $err_log_path/"$dev"_$cyclenum.umount 189: : > $err_log_path/"$dev"_$cyclenum.fuser 190: : > $err_log_path/"$dev"_$cyclenum.ps 191: fi 192: 193: echo `date '+%Y-%m-%d %T'` >> $err_log_path/"$dev"_$cyclenum.umount 194: echo `date '+%Y-%m-%d %T'` >> $err_log_path/"$dev"_$cyclenum.fuser 195: echo `date '+%Y-%m-%d %T'` >> $err_log_path/"$dev"_$cyclenum.ps 196: /bin/cat $err_log_path/$dev.umount >> $err_log_path/"$dev"_$cyclenum.umount 2>&1 197: /sbin/fuser -vum $mount_point >> $err_log_path/"$dev"_$cyclenum.fuser 2>&1 198: /bin/ps -ef >> $err_log_path/"$dev"_$cyclenum.ps 2>&1 199: echo "" >> $err_log_path/"$dev"_$cyclenum.umount 200: echo "" >> $err_log_path/"$dev"_$cyclenum.fuser 201: echo "" >> $err_log_path/"$dev"_$cyclenum.ps 202: 203: retry_count=`expr $retry_count - 1` 204: /bin/sleep $sleep_time 205: else 206: /bin/rm -f $err_log_path/$dev.umount 207: result_flag=0 208: break 209: fi 210: done 211: 212: if [ $result_flag != 0 ] 213: then 214: exit 10 215: fi 216: fi 217: 218: echo "mount,$mount_point" > $post_file 219: 220: # When device was not mounted 221: # 222: else 223: echo "none" > $post_file 224: fi 225: 226: exit 0
SUSE Linux Enterprise Server 15またはSUSE Linux Enterprise Server 12の場合
1: #!/bin/sh 2: 3: # AdvancedCopy Manager 4: # All Rights Reserved, Copyright FUJITSU LIMITED, 2002-2021 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: cyclemax=3 29: bindstack_cyclenumfile="bindstack.cyclenum" 30: unmount_cyclenumfile="unmount.cyclenum" 31: 32: # Determination postprocessing file name 33: if [ "`echo $device | /bin/grep "/dev/sd"`" != "" ] 34: then 35: # /dev/sd? -> sd? 36: dev="`echo $device | /bin/sed "s/\/dev\///"`" 37: elif [ "`echo $device | /bin/grep "/dev/FJSV"`" != "" ] 38: then 39: # /dev/FJSVmphd/dsk/mplb?s? -> mplb?s? 40: # /dev/FJSVmphd/dsk/mphd?s? -> mphd?s? 41: dev="`echo $device | /usr/bin/cut -d/ -f5`" 42: elif [ "`echo $device | /bin/grep "/dev/sfdsk/"`" != "" ] 43: then 44: if [ "`echo $device | /bin/grep ":"`" != "" ] 45: then 46: devnam="`echo $device | /usr/bin/cut -d: -f2-`" 47: # /dev/sfdsk/class/dsk/volume:sd? -> class_volume_sd? 48: dev="`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`" 49: dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`" 50: dev="`echo $dev | /bin/sed "s/:/_/"`" 51: device="`echo $device | /usr/bin/cut -d: -f1`" 52: if [ "`echo $devnam | /bin/grep "/dev/disk/by-id/"`" != "" ] 53: then 54: # /dev/sfdsk/class/dsk/volume:/dev/disk/by-id/<device> -> class_volume__by_id_<device> 55: dev="`echo $dev | /bin/sed "s/\/dev\/disk\/by-id\//_by-id_/"`" 56: elif [ "`echo $devnam | /bin/grep "/dev/disk/by-path/"`" != "" ] 57: then 58: # /dev/sfdsk/class/dsk/volume:/dev/disk/by-path/<device> -> class_volume__by_path_<device> 59: dev="`echo $dev | /bin/sed "s/\/dev\/disk\/by-path\//_by-path_/"`" 60: fi 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/vx/dmp/"`" != "" ] 67: then 68: # /dev/vx/dmp/device -> _vx_pv_device 69: dev="_vx_pv_`echo $device | /bin/sed "s/\/dev\/vx\/dmp\///"`" 70: elif [ "`echo $device | /bin/grep "/dev/mapper/"`" != "" ] 71: then 72: # "/dev/mapper/<device>" -> "_mapper_<device>" 73: dev="_mapper_`echo $device | /bin/sed "s/\/dev\/mapper\///"`" 74: elif [ "`echo $device | /bin/grep "/dev/disk/by-id/"`" != "" ] 75: then 76: # "/dev/disk/by-id/<device>" -> "_by-id_<device>" 77: dev="_by-id_`echo $device | /bin/sed "s/\/dev\/disk\/by-id\///"`" 78: elif [ "`echo $device | /bin/grep "/dev/disk/by-path/"`" != "" ] 79: then 80: # "/dev/disk/by-path/<device>" -> "_by-path_<device>" 81: dev="_by-path_`echo $device | /bin/sed "s/\/dev\/disk\/by-path\///"`" 82: else 83: exit 0 84: fi 85: post_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".dpre" 86: fstype_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".dfstype" 87: 88: err_log_path="/var/opt/FJSVswsrp/"$SWSTGNODE"/log" 89: 90: if [ "$mount_point" != "" ] 91: # When device was mounted 92: # 93: then 94: 95: if [ `/bin/cat /proc/mounts | /usr/bin/cut -d' ' -f 2| /bin/grep "^$mount_point\$"| /usr/bin/wc -w` != 1 ]; then 96: if [ -f $err_log_path/$bindstack_cyclenumfile ] 97: then 98: cyclenum=`/usr/bin/cut -c 1 $err_log_path/$bindstack_cyclenumfile` 99: cyclenum=`expr $cyclenum + 1 2>/dev/null` 100: if [ $? != 0 ]; then 101: cyclenum='1' 102: fi 103: if [ $cyclenum -gt $cyclemax ]; then 104: cyclenum='1' 105: fi 106: else 107: cyclenum='1' 108: fi 109: echo $cyclenum > $err_log_path/$bindstack_cyclenumfile 110: 111: echo `date '+%Y-%m-%d %T'` > $err_log_path/"$dev"_$cyclenum.mounts 112: echo "" >> $err_log_path/"$dev"_$cyclenum.mounts 113: echo mount_point = $mount_point >> $err_log_path/"$dev"_$cyclenum.mounts 114: echo "" >> $err_log_path/"$dev"_$cyclenum.mounts 115: /bin/cat /proc/mounts >> $err_log_path/"$dev"_$cyclenum.mounts 2>&1 116: echo "" >> $err_log_path/"$dev"_$cyclenum.mounts 117: /bin/mount >> $err_log_path/"$dev"_$cyclenum.mounts 2>&1 118: exit 13 119: fi 120: 121: if [ `/bin/cat /proc/mounts | /usr/bin/cut -d' ' -f 1| /bin/grep "^$device\$"| /usr/bin/wc -w` != 1 ]; then 122: cdevice="/dev/`/usr/bin/readlink $device | /bin/sed "s/..\/..\///"`" 123: if [ `/bin/cat /proc/mounts | /usr/bin/cut -d' ' -f 1|/bin/grep "^$cdevice\$"|/usr/bin/wc -w` != 1 ]; then 124: if [ -f $err_log_path/$bindstack_cyclenumfile ] 125: then 126: cyclenum=`/usr/bin/cut -c 1 $err_log_path/$bindstack_cyclenumfile` 127: cyclenum=`expr $cyclenum + 1 2>/dev/null` 128: if [ $? != 0 ]; then 129: cyclenum='1' 130: fi 131: if [ $cyclenum -gt $cyclemax ]; then 132: cyclenum='1' 133: fi 134: else 135: cyclenum='1' 136: fi 137: echo $cyclenum > $err_log_path/$bindstack_cyclenumfile 138: 139: echo `date '+%Y-%m-%d %T'` > $err_log_path/"$dev"_$cyclenum.mounts 140: echo "" >> $err_log_path/"$dev"_$cyclenum.mounts 141: echo mount_point = $mount_point >> $err_log_path/"$dev"_$cyclenum.mounts 142: echo cdevice = $cdevice >> $err_log_path/"$dev"_$cyclenum.mounts 143: echo "" >> $err_log_path/"$dev"_$cyclenum.mounts 144: /bin/cat /proc/mounts >> $err_log_path/"$dev"_$cyclenum.mounts 2>&1 145: echo "" >> $err_log_path/"$dev"_$cyclenum.mounts 146: /bin/mount >> $err_log_path/"$dev"_$cyclenum.mounts 2>&1 147: exit 13 148: fi 149: fi 150: 151: /bin/awk "\$2==\"$mount_point\" {print \$3}" /proc/mounts > $fstype_file 152: 153: /bin/umount $mount_point 2>/dev/null 154: 155: if [ $? != 0 ] 156: then 157: retry_count=3 158: retry_def=$retry_count 159: sleep_time=1 160: result_flag=1 161: 162: while [ $retry_count -gt 0 ] 163: do 164: /bin/umount $mount_point > $err_log_path/$dev.umount 2>&1 165: if [ $? != 0 ] 166: then 167: if [ $retry_count -eq $retry_def ] 168: then 169: if [ -f $err_log_path/$unmount_cyclenumfile ] 170: then 171: cyclenum=`/usr/bin/cut -c 1 $err_log_path/$unmount_cyclenumfile` 172: cyclenum=`expr $cyclenum + 1 2>/dev/null` 173: if [ $? != 0 ]; then 174: cyclenum='1' 175: fi 176: if [ $cyclenum -gt $cyclemax ]; then 177: cyclenum='1' 178: fi 179: else 180: cyclenum='1' 181: fi 182: echo $cyclenum > $err_log_path/$unmount_cyclenumfile 183: : > $err_log_path/"$dev"_$cyclenum.umount 184: : > $err_log_path/"$dev"_$cyclenum.fuser 185: : > $err_log_path/"$dev"_$cyclenum.ps 186: fi 187: 188: echo `date '+%Y-%m-%d %T'` >> $err_log_path/"$dev"_$cyclenum.umount 189: echo `date '+%Y-%m-%d %T'` >> $err_log_path/"$dev"_$cyclenum.fuser 190: echo `date '+%Y-%m-%d %T'` >> $err_log_path/"$dev"_$cyclenum.ps 191: /bin/cat $err_log_path/$dev.umount >> $err_log_path/"$dev"_$cyclenum.umount 2>&1 192: /bin/fuser -vum $mount_point >> $err_log_path/"$dev"_$cyclenum.fuser 2>&1 193: /bin/ps -ef >> $err_log_path/"$dev"_$cyclenum.ps 2>&1 194: echo "" >> $err_log_path/"$dev"_$cyclenum.umount 195: echo "" >> $err_log_path/"$dev"_$cyclenum.fuser 196: echo "" >> $err_log_path/"$dev"_$cyclenum.ps 197: 198: retry_count=`expr $retry_count - 1` 199: /bin/sleep $sleep_time 200: else 201: /bin/rm -f $err_log_path/$dev.umount 202: result_flag=0 203: break 204: fi 205: done 206: 207: if [ $result_flag != 0 ] 208: then 209: exit 10 210: fi 211: fi 212: 213: echo "mount,$mount_point" > $post_file 214: 215: # When device was not mounted 216: # 217: else 218: echo "none" > $post_file 219: fi 220: 221: exit 0