ETERNUS SF AdvancedCopy Manager Operator's Guide 13.0 -Linux- |
Contents
Index
![]() ![]() |
This chapter explains the shell scripts that perform the pre- and post-processing of replication in AdvancedCopy Manager.
The shell scripts that perform the pre- and post-processing of replication start before and after replication (copy) processing.
These shell scripts contain processing code required by AdvancedCopy Manager for the copy source volume and copy destination volume.
This chapter describes the setup of preprocessing and postprocessing.
The replication preprocessing and postprocessing in AdvancedCopy Manager needs to be performed for both the replication source volume and the replication destination volume. However, the purpose for each is different.
Preprocessing and postprocessing for a replication source volume
The purpose of the processing is to freeze the replication source data in a state in which consistency is temporarily ensured. Replication source data is frozen temporarily in preprocessing, and after the replication has been created, the frozen status is released in postprocessing.
Preprocessing and postprocessing for a replication destination volume
The purpose of the processing is to prevent any application from accessing a replication destination volume during replication (copy) processing. In preprocessing, replication data for the destination is placed in access-disabled status, and after the replication has been created, this status is released in postprocessing.
Specific processing performed in preprocessing and postprocessing varies according to the data on the volume. The next section describes the preprocessing and postprocessing of a file system and a database.
The preprocessing and postprocessing for a file system is the unmount processing and mount processing of the file system. (For Windows, the processing consists of allocating and canceling a drive letter.) The preprocessing and postprocessing for the replication source volume ensure the integrity of the replication source data. The preprocessing and postprocessing for the replication destination volume are performed to make access from other processes during synchronization processing and snapshot copying impossible. If no volume is mounted, the preprocessing and postprocessing are not performed.
The implementation status of the preprocessing and postprocessing for a file system is shown below. This table shows whether preprocessing and postprocessing are performed depending on the command type .It also shows the copy status upon execution of the command.
Command |
Copy status |
Source/target |
Preprocessing |
Postprocessing |
---|---|---|---|---|
Replication start command (swsrpstartsync) |
uncopy or replication establishment |
Source |
X |
X |
target |
O--*1 |
X |
||
Replication making command (swsrpmake) |
equivalence maintenance |
Source |
O |
O |
target |
X |
O--*2 |
||
Replication cancellation command (swsrpcancel) |
equivalence maintenance |
Source |
O |
O |
target |
X |
O--*2 |
||
Replication establishment |
Source |
X |
X |
|
target |
X |
X |
||
copying |
Source |
X |
X |
|
target |
X |
X |
||
Snap shot replication making command (swsrpmake) |
uncopy |
Source |
O |
O |
target |
O |
O |
O : executed, X : not executed
The postprocessing for the preprocessing performed in (1) is performed in (2). In the postprocessing in (2), re-mount is performed for the mount point where unmount was performed in the preprocessing in (1).
The preprocessing and postprocessing for a file system can be customized. The processing is started in accordance with the table above when a replication management command is executed. For replication between servers, these scripts are executed by remote execution by TCP/IP in the preprocessing and postprocessing of a volume that is not connected.
The operation image before and after processing is shown in Figure C.1.
If processing other than the standard preprocessing and postprocessing is required in the preprocessing and postprocessing, customize the scripts.
When customizing a script, strictly observe the following rules regarding error code:
Error code |
Usage |
---|---|
0-99 |
Unusable (reserved for AdvancedCopy Manager) |
100-255 |
Usable |
AdvancedCopy Manager does not support any functions for the preprocessing and postprocessing of a database. You will need to perform your own preprocessing and postprocessing before and after the execution of a AdvancedCopy Manager command.
The replication source volume (RepSrcPre.js) and the replication destination volume (RepDstPre.js) are prepared for a pretreatment script, and it is stored in the following directory subordinates. Please customize a script according to the necessity for processing.
In the case of non-cluster operation
/etc/opt/FJSVswsrp/sh directory subordinate
In the case of cluster operation
/etc/opt/FJSVswsrp/<logic node name>/sh directory subordinate
RepSrc.pre (copy source volume script)
1: #!/bin/sh 2: 3: # AdvancedCopy Manager 4: # All Rights Reserved, Copyright FUJITSU LIMITED, 2002-2006 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: 29: # Determination postprocessing file name 30: if [ "`echo $device | /bin/grep "/dev/sd"`" != "" ] 31: then 32: # /dev/sd? -> sd? 33: dev="`echo $device | /bin/sed "s/\/dev\///"`" 34: elif [ "`echo $device | /bin/grep "/dev/FJSV"`" != "" ] 35: then 36: # /dev/FJSVmphd/dsk/mplb?s? -> mplb?s? 37: # /dev/FJSVmphd/dsk/mphd?s? -> mphd?s? 38: dev="`echo $device | /bin/cut -d/ -f5`" 39: elif [ "`echo $device | /bin/grep "/dev/sfdsk/"`" != "" ] 40: then 41: if [ "`echo $device | /bin/grep ":"`" != "" ] 42: then 43: # /dev/sfdsk/class/dsk/volume:sd? -> class_volume_sd? 44: dev="`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`" 45: dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`" 46: dev="`echo $dev | /bin/sed "s/:/_/"`" 47: device="`echo $device | /bin/cut -d: -f1`" 48: else 49: # /dev/sfdsk/class/dsk/volume -> _gds_class_volume 50: dev="_gds_`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`" 51: dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`" 52: fi 53: else 54: exit 0 55: fi 56: post_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".spre" 57: fstype_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".sfstype" 58: 59: err_log_path="/var/opt/FJSVswsrp/"$SWSTGNODE"/log" 60: 61: if [ "$mount_point" != "" ] 62: # When device was mounted 63: # 64: then 65: 66: if [ `/bin/cat /proc/mounts |/bin/cut -d' ' -f 2|/bin/grep "^$mount_point\$"|/usr/bin/wc -w` != 1 ]; then 67: # stack mount (multi device on $mount_point) 68: /bin/mount > $err_log_path/$dev.umount 2>&1 69: exit 13 70: fi 71: if [ `/bin/cat /proc/mounts |/bin/cut -d' ' -f 1|/bin/grep "^$device\$"|/usr/bin/wc -w` != 1 ]; then 72: # bind mount (device has multi mount point) 73: /bin/mount > $err_log_path/$dev.umount 2>&1 74: exit 13 75: fi 76: 77: /bin/awk "\$2==\"$mount_point\" {print \$3}" /proc/mounts > $fstype_file 78: 79: /bin/umount $mount_point 2>/dev/null 80: 81: if [ $? != 0 ] 82: then 83: retry_count=3 84: sleep_time=1 85: result_flag=1 86: 87: while [ $retry_count -gt 0 ] 88: do 89: /bin/umount $mount_point > $err_log_path/$dev.umount 2>&1 90: if [ $? != 0 ] 91: then 92: retry_count=`expr $retry_count - 1` 93: /bin/sleep $sleep_time 94: else 95: /bin/rm -f $err_log_path/$dev.umount 96: result_flag=0 97: break 98: fi 99: done 100: 101: if [ $result_flag != 0 ] 102: then 103: /sbin/fuser -vu $mount_point> $err_log_path/$dev.fuser 2>&1 104: /bin/ps -ef > $err_log_path/$dev.ps 2>&1 105: exit 10 106: fi 107: fi 108: 109: echo "mount,$mount_point" > $post_file 110: 111: # When device was not mounted 112: # 113: else 114: echo "none" > $post_file 115: fi 116: 117: exit 0 |
RepDst.pre (copy destination volume script)
1: #!/bin/sh 2: 3: # AdvancedCopy Manager 4: # All Rights Reserved, Copyright FUJITSU LIMITED, 2002-2006 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: 29: # Determination postprocessing file name 30: if [ "`echo $device | /bin/grep "/dev/sd"`" != "" ] 31: then 32: # /dev/sd? -> sd? 33: dev="`echo $device | /bin/sed "s/\/dev\///"`" 34: elif [ "`echo $device | /bin/grep "/dev/FJSV"`" != "" ] 35: then 36: # /dev/FJSVmphd/dsk/mplb?s? -> mplb?s? 37: # /dev/FJSVmphd/dsk/mphd?s? -> mphd?s? 38: dev="`echo $device | /bin/cut -d/ -f5`" 39: elif [ "`echo $device | /bin/grep "/dev/sfdsk/"`" != "" ] 40: then 41: if [ "`echo $device | /bin/grep ":"`" != "" ] 42: then 43: # /dev/sfdsk/class/dsk/volume:sd? -> class_volume_sd? 44: dev="`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`" 45: dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`" 46: dev="`echo $dev | /bin/sed "s/:/_/"`" 47: device="`echo $device | /bin/cut -d: -f1`" 48: else 49: # /dev/sfdsk/class/dsk/volume -> _gds_class_volume 50: dev="_gds_`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`" 51: dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`" 52: fi 53: else 54: exit 0 55: fi 56: post_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".dpre" 57: fstype_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".dfstype" 58: 59: err_log_path="/var/opt/FJSVswsrp/"$SWSTGNODE"/log" 60: 61: if [ "$mount_point" != "" ] 62: # When device was mounted 63: # 64: then 65: 66: if [ `/bin/cat /proc/mounts |/bin/cut -d' ' -f 2|/bin/grep "^$mount_point\$"|/usr/bin/wc -w` != 1 ]; then 67: # stack mount (multi device on $mount_point) 68: /bin/mount > $err_log_path/$dev.umount 2>&1 69: exit 13 70: fi 71: if [ `/bin/cat /proc/mounts |/bin/cut -d' ' -f 1|/bin/grep "^$device\$"|/usr/bin/wc -w` != 1 ]; then 72: # bind mount (device has multi mount point) 73: /bin/mount > $err_log_path/$dev.umount 2>&1 74: exit 13 75: fi 76: 77: /bin/awk "\$2==\"$mount_point\" {print \$3}" /proc/mounts > $fstype_file 78: 79: /bin/umount $mount_point 2>/dev/null 80: 81: if [ $? != 0 ] 82: then 83: retry_count=3 84: sleep_time=1 85: result_flag=1 86: 87: while [ $retry_count -gt 0 ] 88: do 89: /bin/umount $mount_point > $err_log_path/$dev.umount 2>&1 90: if [ $? != 0 ] 91: then 92: retry_count=`expr $retry_count - 1` 93: /bin/sleep $sleep_time 94: else 95: /bin/rm -f $err_log_path/$dev.umount 96: result_flag=0 97: break 98: fi 99: done 100: 101: if [ $result_flag != 0 ] 102: then 103: /sbin/fuser -vu $mount_point> $err_log_path/$dev.fuser 2>&1 104: /bin/ps -ef > $err_log_path/$dev.ps 2>&1 105: exit 10 106: fi 107: fi 108: 109: echo "mount,$mount_point" > $post_file 110: 111: # When device was not mounted 112: # 113: else 114: echo "none" > $post_file 115: fi 116: 117: exit 0 |
If you do not want to unmount the mounted copy source volume, then customize the script while referring to "Preprocessing and Postprocessing of Backup."
This is possible only in the following file system:
ext2
ext3
The replication source volume (RepSrcPost.js) and the replication destination volume (RepDstPost.js) are prepared for a post-processing script, and it is stored in the following directory subordinates. Please customize a script according to the necessity for processing.
In the case of non-cluster operation
/etc/opt/FJSVswsrp/sh directory subordinate
In the case of cluster operation
/etc/opt/FJSVswsrp/<logic node name>/sh directory subordinate
RepSrc.post (copy source volume script)
1: #!/bin/sh 2: 3: # AdvancedCopy Manager 4: # All Rights Reserved, Copyright FUJITSU LIMITED, 2002-2006 5: 6: # 7: # Postprocessing of Replication(Source) processing 8: # 9: # Argument: $1 Device name of Source disk 10: # 11: # Error number 12: # 2: Argument error 13: # 11: mount error 14: 15: # Argument check 16: case $# in 17: 1) 18: ;; 19: *) 20: exit 2 21: ;; 22: esac 23: 24: device=$1 25: 26: # Determination of postprocessing file name 27: if [ "`echo $device | /bin/grep "/dev/sd"`" != "" ] 28: then 29: # /dev/sd? -> sd? 30: dev="`echo $device | /bin/sed "s/\/dev\///"`" 31: elif [ "`echo $device | /bin/grep "/dev/FJSV"`" != "" ] 32: then 33: # /dev/FJSVmphd/dsk/mplb?s? -> mplb?s? 34: # /dev/FJSVmphd/dsk/mphd?s? -> mphd?s? 35: dev="`echo $device | /bin/cut -d/ -f5`" 36: elif [ "`echo $device | /bin/grep "/dev/sfdsk/"`" != "" ] 37: then 38: if [ "`echo $device | /bin/grep ":"`" != "" ] 39: then 40: # /dev/sfdsk/class/dsk/volume:sd? -> class_volume_sd? 41: dev="`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`" 42: dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`" 43: dev="`echo $dev | /bin/sed "s/:/_/"`" 44: device="`echo $device | /bin/cut -d: -f1`" 45: else 46: # /dev/sfdsk/class/dsk/volume -> _gds_class_volume 47: dev="_gds_`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`" 48: dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`" 49: fi 50: else 51: exit 0 52: fi 53: post_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".spre" 54: fstype_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".sfstype" 55: 56: err_log_path="/var/opt/FJSVswsrp/"$SWSTGNODE"/log" 57: 58: # Confirmation of postprocessing 59: if [ ! -r $post_file ] 60: then 61: exit 0 62: fi 63: post="`/bin/cat $post_file | /bin/cut -d',' -f1`" 64: mount_point="`/bin/cat $post_file | /bin/cut -d',' -f2`" 65: 66: # Confirmation of FStype 67: if [ ! -r $fstype_file ] 68: then 69: fs="" 70: else 71: fs="`/bin/cat $fstype_file`" 72: fi 73: 74: # No processing 75: if [ "$post" = "none" ] 76: then 77: /bin/rm -rf $post_file 2> /dev/null 78: /bin/rm -rf $fstype_file 2> /dev/null 79: exit 0 80: fi 81: 82: # mount processing 83: if [ "$post" = "mount" ] 84: then 85: Result="`/bin/df -l | /bin/grep "$device " | /bin/awk 'END {print NR}'`" 86: if [ "$Result" != "1" ] 87: then 88: if [ ! -r $fstype_file ] 89: then 90: /bin/mount $device $mount_point 2> /dev/null 91: else 92: Result1="`echo $fs | /bin/awk 'END {print NR}'`" 93: if [ "$Result1" != "1" ] 94: then 95: /bin/mount $device $mount_point 2> /dev/null 96: else 97: /bin/mount -t $fs $device $mount_point 2> /dev/null 98: fi 99: fi 100: if [ $? != 0 ] 101: then 102: retry_count=3 103: sleep_time=1 104: result_flag=1 105: 106: while [ $retry_count -gt 0 ] 107: do 108: if [ ! -r $fstype_file ] 109: then 110: /bin/mount $device $mount_point > $err_log_path/$dev.mount 2>&1 111: else 112: Result1="`echo $fs | /bin/awk 'END {print NR}'`" 113: if [ "$Result1" != "1" ] 114: then 115: /bin/mount $device $mount_point > $err_log_path/$dev.mount 2>&1 116: else 117: /bin/mount -t $fs $device $mount_point > $err_log_path/$dev.mount 2>&1 118: fi 119: fi 120: if [ $? != 0 ] 121: then 122: retry_count=`expr $retry_count - 1` 123: /bin/sleep $sleep_time 124: else 125: /bin/rm -f $err_log_path/$dev.mount 126: result_flag=0 127: break 128: fi 129: done 130: 131: if [ $result_flag != 0 ] 132: then 133: exit 11 134: fi 135: fi 136: fi 137: /bin/rm -rf $post_file 2> /dev/null 138: /bin/rm -rf $fstype_file 2> /dev/null 139: exit 0 140: fi 141: 142: exit 0 |
RepDst.post (copy destination volume script)
1: #!/bin/sh 2: 3: # AdvancedCopy Manager 4: # All Rights Reserved, Copyright FUJITSU LIMITED, 2002-2006 5: 6: # 7: # Postprocessing of Replication(Destination) processing 8: # 9: # Argument: $1 Device name of Destination disk 10: # 11: # Error number 12: # 2: Argument error 13: # 11 mount error 14: 15: # Argument check 16: case $# in 17: 1) 18: ;; 19: *) 20: exit 2 21: ;; 22: esac 23: 24: device=$1 25: 26: # Determination of postprocessing file name 27: if [ "`echo $device | /bin/grep "/dev/sd"`" != "" ] 28: then 29: # /dev/sd? -> sd? 30: dev="`echo $device | /bin/sed "s/\/dev\///"`" 31: elif [ "`echo $device | /bin/grep "/dev/FJSV"`" != "" ] 32: then 33: # /dev/FJSVmphd/dsk/mplb?s? -> mplb?s? 34: # /dev/FJSVmphd/dsk/mphd?s? -> mphd?s? 35: dev="`echo $device | /bin/cut -d/ -f5`" 36: elif [ "`echo $device | /bin/grep "/dev/sfdsk/"`" != "" ] 37: then 38: if [ "`echo $device | /bin/grep ":"`" != "" ] 39: then 40: # /dev/sfdsk/class/dsk/volume:sd? -> class_volume_sd? 41: dev="`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`" 42: dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`" 43: dev="`echo $dev | /bin/sed "s/:/_/"`" 44: device="`echo $device | /bin/cut -d: -f1`" 45: else 46: # /dev/sfdsk/class/dsk/volume -> _gds_class_volume 47: dev="_gds_`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`" 48: dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`" 49: fi 50: else 51: exit 0 52: fi 53: post_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".dpre" 54: fstype_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".dfstype" 55: 56: err_log_path="/var/opt/FJSVswsrp/"$SWSTGNODE"/log" 57: 58: # Confirmation of postprocessing 59: if [ ! -r $post_file ] 60: then 61: exit 0 62: fi 63: post="`/bin/cat $post_file | /bin/cut -d',' -f1`" 64: mount_point="`/bin/cat $post_file | /bin/cut -d',' -f2`" 65: 66: # Confirmation of FStype 67: if [ ! -r $fstype_file ] 68: then 69: fs="" 70: else 71: fs="`/bin/cat $fstype_file`" 72: fi 73: 74: # No processing 75: if [ "$post" = "none" ] 76: then 77: /bin/rm -rf $post_file 2> /dev/null 78: /bin/rm -rf $fstype_file 2> /dev/null 79: exit 0 80: fi 81: 82: # mount processing 83: if [ "$post" = "mount" ] 84: then 85: # df -l $device > /dev/null 2>&1 86: # if [ $? != 0 ] 87: Result="`/bin/df -l | /bin/grep "$device " | /bin/awk 'END {print NR}'`" 88: if [ "$Result" != "1" ] 89: then 90: if [ ! -r $fstype_file ] 91: then 92: /bin/mount $device $mount_point 2> /dev/null 93: else 94: Result1="`echo $fs | /bin/awk 'END {print NR}'`" 95: if [ "$Result1" != "1" ] 96: then 97: /bin/mount $device $mount_point 2> /dev/null 98: else 99: /bin/mount -t $fs $device $mount_point 2> /dev/null 100: fi 101: fi 102: if [ $? != 0 ] 103: then 104: retry_count=3 105: sleep_time=1 106: result_flag=1 107: 108: while [ $retry_count -gt 0 ] 109: do 110: if [ ! -r $fstype_file ] 111: then 112: /bin/mount $device $mount_point > $err_log_path/$dev.mount 2>&1 113: else 114: Result1="`echo $fs | /bin/awk 'END {print NR}'`" 115: if [ "$Result1" != "1" ] 116: then 117: /bin/mount $device $mount_point > $err_log_path/$dev.mount 2>&1 118: else 119: /bin/mount -t $fs $device $mount_point > $err_log_path/$dev.mount 2>&1 120: fi 121: fi 122: if [ $? != 0 ] 123: then 124: retry_count=`expr $retry_count - 1` 125: /bin/sleep $sleep_time 126: else 127: /bin/rm -f $err_log_path/$dev.mount 128: result_flag=0 129: break 130: fi 131: done 132: 133: if [ $result_flag != 0 ] 134: then 135: exit 11 136: fi 137: fi 138: fi 139: /bin/rm -rf $post_file 2> /dev/null 140: /bin/rm -rf $fstype_file 2> /dev/null 141: exit 0 142: fi 143: 144: exit 0 |
Contents
Index
![]() ![]() |