ETERNUS SF AdvancedCopy Manager Operator's Guide for Tape Backup Option 13.0 -Microsoft(R) Windows(R) 2000/Microsoft(R) Windows Sever(TM) 2003-, -Solaris-, -HP-UX-, -Linux-, -AIX- |
Contents
Index
![]() ![]() |
This appendix describes shell scripts used for preprocessing and postprocessing of backup, restoration, and tape copy.
Note that a shell script described in this appendix has different linefeed positions due to formatting of this manual.
The shell scripts used for backup, restoration, and tape copy preprocessing and postprocessing are started before or after backup, restoration, or tape copying when the backup, restore, or tape copy command is executed.
These shell scripts contain the code for the processing required by Tape Backup of AdvancedCopy Manager for backup, restoration, or tape copying of a transaction volume.
This chapter describes the setup of preprocessing and postprocessing.
Backup preprocessing and postprocessing is performed by a disk backup process that takes place when the acmbackup command is executed as follows:
For information on backup preprocessing and postprocessing, see appendix "Preprocessing and Postprocessing of Backup" in the "ETERNUS SF AdvancedCopy Manager Operator's Guide" for the operating system of the target Storage Server.
Restoration preprocessing and postprocessing is always performed when the acmrestore command is executed.
For information on restoration preprocessing and postprocessing, see appendix "Preprocessing and Postprocessing of Restoration" in the "ETERNUS SF AdvancedCopy Manager Operator's Guide" for the operating system of the target Storage Server.
Tape copy preprocessing and postprocessing is performed by a tape backup process that takes place when the acmbackup command is executed as follows:
It is also performed whenever the acmhistcopy command is executed.
Solaris, Linux, HP-UX and AIX:
Basically, tape copying by AdvancedCopy Manager must be performed while the backup volume subject to the tape copying is unmounted.
Normally, the preprocessing shell script obtains the mount status of the backup volume from the backup history and takes the following action according to the status.
Backup volume status |
Preprocessing |
---|---|
Mounted |
Unmounts the backup volume. |
Unmounted |
Takes no action. |
The postprocessing shell script does nothing during tape copying. Therefore, the backup volume that was mounted before tape copying remains in the unmounted state after the tape copying.
When you need to add user-specific processes to preprocessing and postprocessing, add the processes to the tape copy preprocessing and postprocessing script.
Windows:
When performing backups with AdvancedCopy Manager, it is usually necessary to prevent the transaction volume from being accessed by other processes during backup.
For this reason, the backup volume is usually locked during preprocessing.
The backup volume is unlocked during postprocessing.
Locking and unlocking is performed by a program. The locking process can be modified by creating a setup file called a "backup volume lock specification file for tape copying
When you need to add user-specific processes to preprocessing and postprocessing, add the processes to the tape copy preprocessing and postprocessing script.
These scripts are written in JScript and run on the Windows Scripting Host (WSH).
Solaris, Linux, HP-UX and AIX:
It is necessary to modify the preprocessing shell script for adjusting the cluster system environment.
On single system, as shown in above, tape copying by AdvancedCopy Manager must be performed while the backup volume subject to the tape copying is unmounted. However, on cluster system, the offline operation must be used instead of unmounting the backup volume.
For example, if the VERITAS Cluster Service for Solaris is used as the cluster system, modify the preprocessing shell script (TapeCopy.pre described in "Preprocessing of tape copy") as follows.
Current |
(lines 74) /usr/sbin/umount $cur_mount_point 2>/dev/null |
After modification |
/opt/VRTSvcs/bin/hares -offline resouce_name -sys system_name |
After doing the offline operation for mount point resources, there is the time lag until volumes are actually unmounted. Therefore, as follows, add the processing that waits for the completion of unmount (e.g. Observing the result of sleep command or df command) after the location where the success or failure of offline is judged.
On TapeCopy.pre described in "Preprocessing of tape copy", add the following line between line 102 and 103.
while /usr/sbin/df -l "$device">/dev/null 2>&1; do :; done |
For the notes in the case that the Storage Server is operated on cluster system environment, see the following sections in the "ETERNUS SF AdvancedCopy Manager Operator's Guide" for the operating system of the target Storage Server.
- "Notes on cluster operation"
- "Notes on backup operation in cluster operation"
Windows:
This is the same as when the Storage Server is in a single-server configuration.
The name of the shell script for preprocessing before tape copy processing is as follows.
/etc/opt/FJSVswsts/sh/TapeCopy.pre
/etc/opt/FJSVswsts/<logical node name>/sh/TapeCopy.pre
1 #!/bin/sh 2 3 # AdvancedCopy Manager 4 # All Rights Reserved, Copyright FUJITSU LIMITED, 2005-2006 5 6 # 7 # Preprocessing of tape copy processing 8 # 9 # Argument: $1 Device name of backup disk 10 # $2 Reserve 11 # 12 # Error number 13 # 2: Argument error 14 # 10: umount error 15 16 17 # Argument check 18 case $# in 19 1) 20 ;; 21 2) 22 ;; 23 *) 24 exit 2 25 ;; 26 esac 27 28 device="`echo $1`" 29 30 # Determination postprocessing file name 31 32 if [ "$SWSTGNODE" != "" ] 33 then 34 swstg_node="/`echo $SWSTGNODE`" 35 else 36 swstg_node="" 37 fi 38 39 err_log_path="/var/opt/FJSVswsts"$swstg_node"/log" 40 41 if [ "`echo $device | /usr/bin/grep "/dev/dsk/"`" != "" ] 42 then 43 # /dev/dsk/c?t?d?s? -> c?t?d?s? 44 dev="`echo $device | /usr/bin/sed "s/\/dev\/dsk\///"`" 45 elif [ "`echo $device | /usr/bin/grep "/dev/FJSV"`" != "" ] 46 then 47 # /dev/FJSVmphd/dsk/mplb?s? -> /dev/FJSVmphd/dsk/mplb?s? 48 # /dev/FJSVmphd/dsk/mphd?s? -> /dev/FJSVmphd/dsk/mphd?s? 49 dev="`echo $device | /usr/bin/cut -d/ -f5`" 50 elif [ "`echo $device | /usr/bin/grep "/dev/sfdsk/"`" != "" ] 51 then 52 # /dev/sfdsk/class/dsk/volume -> _gds_class_volume 53 dev="_gds_`echo $device | /usr/bin/sed "s/\/dev\/sfdsk\///"`" 54 dev="`echo $dev | /usr/bin/sed "s/\/dsk\//_/"`" 55 elif [ "`echo $device | /usr/bin/grep "/dev/vx/dsk/"`" != "" ] 56 then 57 # /dev/vx/dsk/volume -> _vx_rootdg_volume 58 # /dev/vx/dsk/disk-group/volume -> _vx_disk-group_volume 59 dev=_vx_"`echo $device | /usr/bin/awk -F\/ '{ if (NF == 6) { print $5"_"$6 } else print "rootdg_"$5 }'`" 60 elif [ "`echo $device | /usr/bin/grep "/dev/vx/dmp/"`" != "" ] 61 then 62 # /dev/vx/dmp/device -> _vx_pv_device 63 dev=_vx_pv_"`echo $device | /usr/bin/cut -d/ -f5`" 64 else 65 exit 0 66 fi 67 post_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".pre" 68 69 # Device unmount process. 70 # 71 cur_mount_point=`/usr/sbin/mount | grep "$device " | cut -f1 -d' '` 72 if [ "$cur_mount_point" != "" ] 73 then 74 /usr/sbin/umount $cur_mount_point 2>/dev/null 75 if [ $? != 0 ] 76 then 77 retry_count=3 78 sleep_time=1 79 result_flag=1 80 81 while [ $retry_count -gt 0 ] 82 do 83 /usr/sbin/umount $cur_mount_point > $err_log_path/$dev.umount 2>&1 84 if [ $? != 0 ] 85 then 86 retry_count=`expr $retry_count - 1` 87 /usr/bin/sleep $sleep_time 88 else 89 /usr/bin/rm -f $err_log_path/$dev.umount 90 result_flag=0 91 break 92 fi 93 done 94 95 if [ $result_flag != 0 ] 96 then 97 /usr/sbin/fuser -cu $cur_mount_point> $err_log_path/$dev.fuser 2>&1 98 /usr/bin/ps -ef > $err_log_path/$dev.ps 2>&1 99 100 exit 10 101 fi 102 fi 103 echo "mount" > $post_file 104 105 # When device was not mounted 106 # 107 else 108 echo "none" > $post_file 109 fi 110 exit 0 |
The name of the shell script for postprocessing after tape copy processing is as follows.
/etc/opt/FJSVswsts/sh/TapeCopy.post
/etc/opt/FJSVswsts/<logical node name>/sh/TapeCopy.post
1 #!/bin/sh 2 3 # AdvancedCopy Manager 4 # All Rights Reserved, Copyright FUJITSU LIMITED, 2005-2006 5 6 # 7 # Postprocessing of tape copy processing 8 # 9 # Argument: $1 Device name of backup disk 10 # $2 Reserve 11 # 12 # Error number 13 # 2: Argument error 14 15 # Argument check 16 case $# in 17 1) 18 ;; 19 2) 20 ;; 21 *) 22 exit 2 23 ;; 24 esac 25 26 device="`echo $1`" 27 28 # Determination of postprocessing file name 29 30 if [ "$SWSTGNODE" != "" ] 31 then 32 swstg_node="/`echo $SWSTGNODE`" 33 else 34 swstg_node="" 35 fi 36 37 err_log_path="/var/opt/FJSVswsts"$swstg_node"/log" 38 39 if [ "`echo $device | /usr/bin/grep "/dev/dsk/"`" != "" ] 40 then 41 # /dev/dsk/c?t?d?s? -> c?t?d?s? 42 dev="`echo $device | /usr/bin/sed "s/\/dev\/dsk\///"`" 43 elif [ "`echo $device | /usr/bin/grep "/dev/FJSV"`" != "" ] 44 then 45 # /dev/FJSVmphd/dsk/mplb?s? -> /dev/FJSVmphd/dsk/mplb?s? 46 # /dev/FJSVmphd/dsk/mphd?s? -> /dev/FJSVmphd/dsk/mphd?s? 47 dev="`echo $device | /usr/bin/cut -d/ -f5`" 48 elif [ "`echo $device | /usr/bin/grep "/dev/sfdsk/"`" != "" ] 49 then 50 # /dev/sfdsk/class/dsk/volume -> _gds_class_volume 51 dev="_gds_`echo $device | /usr/bin/sed "s/\/dev\/sfdsk\///"`" 52 dev="`echo $dev | /usr/bin/sed "s/\/dsk\//_/"`" 53 elif [ "`echo $device | /usr/bin/grep "/dev/vx/dsk/"`" != "" ] 54 then 55 # /dev/vx/dsk/volume -> _vx_rootdg_volume 56 # /dev/vx/dsk/disk-group/volume -> _vx_disk-group_volume 57 dev=_vx_"`echo $device | /usr/bin/awk -F\/ '{ if (NF == 6) { print $5"_"$6 } else print "rootdg_"$5 }'`" 58 elif [ "`echo $device | /usr/bin/grep "/dev/vx/dmp/"`" != "" ] 59 then 60 # /dev/vx/dmp/device -> _vx_pv_device 61 dev=_vx_pv_"`echo $device | /usr/bin/cut -d/ -f5`" 62 else 63 exit 0 64 fi 65 post_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".pre" 66 67 # Confirmation of postprocessing 68 if [ ! -r $post_file ] 69 then 70 exit 0 71 fi 72 73 /usr/bin/rm -f $post_file 2> /dev/null 74 exit 0 |
The names of the preprocessing shell scripts used for tape copying are:
/etc/opt/FJSVswsts/sh/TapeCopy.pre
/etc/opt/FJSVswsts/<logical node name >/sh/TapeCopy.pre
1 #!/bin/sh 2 3 # AdvancedCopy Manager 4 # All Rights Reserved, Copyright FUJITSU LIMITED, 2005-2006 5 6 # 7 # Preprocessing of tape copy processing 8 # 9 # Argument: $1 Device name of backup disk 10 # $2 Reserve 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 31 # Determination postprocessing file name 32 33 if [ "$SWSTGNODE" != "" ] 34 then 35 swstg_node="/`echo $SWSTGNODE`" 36 else 37 swstg_node="" 38 fi 39 40 err_log_path="/var/opt/FJSVswsts"$swstg_node"/log" 41 42 if [ "`echo $device | /bin/grep "/dev/sd"`" != "" ] 43 then 44 # /dev/sd? -> sd? 45 dev="`echo $device | /bin/sed "s/\/dev\///"`" 46 elif [ "`echo $device | /bin/grep "/dev/FJSV"`" != "" ] 47 then 48 # /dev/FJSVmphd/dsk/mplb?s? -> mplb?s? 49 # /dev/FJSVmphd/dsk/mphd?s? -> mphd?s? 50 dev="`echo $device | /bin/cut -d/ -f5`" 51 elif [ "`echo $device | /bin/grep "/dev/sfdsk/"`" != "" ] 52 then 53 # /dev/sfdsk/class/dsk/volume -> _gds_class_volume 54 dev="_gds_`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`" 55 dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`" 56 else 57 exit 0 58 fi 59 post_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".pre" 60 61 cur_mount_point=`/bin/mount | grep "$device " | cut -f3 -d' '` 62 if [ "$cur_mount_point" != "" ] 63 then 64 65 if [ `/bin/cat /proc/mounts |/bin/cut -d' ' -f 2|/bin/grep "^$cur_mount_point\$"|/usr/bin/wc -w` != 1 ]; then 66 # stack mount (multi device on $cur_mount_point) 67 /bin/mount > $err_log_path/$dev.umount 2>&1 68 exit 13 69 fi 70 if [ `/bin/cat /proc/mounts |/bin/cut -d' ' -f 1|/bin/grep "^$device\$"|/usr/bin/wc -w` != 1 ]; then 71 # bind mount (device has multi mount point) 72 /bin/mount > $err_log_path/$dev.umount 2>&1 73 exit 13 74 fi 75 76 /bin/umount $cur_mount_point 2>/dev/null 77 if [ $? != 0 ] 78 then 79 retry_count=3 80 sleep_time=1 81 result_flag=1 82 83 while [ $retry_count -gt 0 ] 84 do 85 /bin/umount $cur_mount_point > $err_log_path/$dev.umount 2>&1 86 if [ $? != 0 ] 87 then 88 retry_count=`expr $retry_count - 1` 89 /bin/sleep $sleep_time 90 else 91 /bin/rm -f $err_log_path/$dev.umount 92 result_flag=0 93 break 94 fi 95 done 96 97 if [ $result_flag != 0 ] 98 then 99 /sbin/fuser -vu $cur_mount_point> $err_log_path/$dev.fuser 2>&1 100 /bin/ps -ef > $err_log_path/$dev.ps 2>&1 101 102 exit 10 103 fi 104 fi 105 echo "mount" > $post_file 106 107 # When device was not mounted 108 # 109 else 110 echo "none" > $post_file 111 fi 112 113 exit 0 |
The names of the postprocessing shell scripts used for tape copying are:
/etc/opt/FJSVswsts/sh/TapeCopy.post
/etc/opt/FJSVswsts/<logical node name >/sh/TapeCopy.post
1 #!/bin/sh 2 3 # AdvancedCopy Manager 4 # All Rights Reserved, Copyright FUJITSU LIMITED, 2005-2006 5 6 # 7 # Postprocessing of tape copy processing 8 # 9 # Argument: $1 Device name of backup disk 10 # $2 Reserve 11 # 12 # Error number 13 # 2: Argument error 14 15 # Argument check 16 case $# in 17 1) 18 ;; 19 2) 20 ;; 21 *) 22 exit 2 23 ;; 24 esac 25 26 device="`echo $1`" 27 28 # Determination of postprocessing file name 29 30 if [ "$SWSTGNODE" != "" ] 31 then 32 swstg_node="/`echo $SWSTGNODE`" 33 else 34 swstg_node="" 35 fi 36 37 err_log_path="/var/opt/FJSVswsts"$swstg_node"/log" 38 39 if [ "`echo $device | /bin/grep "/dev/sd"`" != "" ] 40 then 41 # /dev/sd? -> sd? 42 dev="`echo $device | /bin/sed "s/\/dev\///"`" 43 elif [ "`echo $device | /bin/grep "/dev/FJSV"`" != "" ] 44 then 45 # /dev/FJSVmphd/dsk/mplb?s? -> mplb?s? 46 # /dev/FJSVmphd/dsk/mphd?s? -> mphd?s? 47 dev="`echo $device | /bin/cut -d/ -f5`" 48 elif [ "`echo $device | /bin/grep "/dev/sfdsk/"`" != "" ] 49 then 50 # /dev/sfdsk/class/dsk/volume -> _gds_class_volume 51 dev="_gds_`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`" 52 dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`" 53 else 54 exit 0 55 fi 56 post_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".pre" 57 58 # Confirmation of postprocessing 59 if [ ! -r $post_file ] 60 then 61 exit 0 62 fi 63 /bin/rm -f $post_file 2> /dev/null 64 65 exit 0 |
The names of the preprocessing shell scripts used for tape copying are:
/etc/opt/FJSVswsts/sh/TapeCopy.pre
/etc/opt/FJSVswsts/<logical node name >/sh/TapeCopy.pre
1 #!/bin/sh 2 3 # AdvancedCopy Manager 4 # All Rights Reserved, Copyright FUJITSU LIMITED, 2005-2006 5 6 # 7 # Preprocessing of tape copy processing 8 # 9 # Argument: $1 Device or VG name of backup disk 10 # $2 Reserve 11 # 12 # Error number 13 # 2: Argument error 14 # 10: umount error 15 16 17 # Argument check 18 case $# in 19 1) 20 ;; 21 2) 22 ;; 23 *) 24 exit 2 25 ;; 26 esac 27 28 device=$1 29 30 # Determination postprocessing file name 31 if [ "$SWSTGNODE" != "" ] 32 then 33 swstg_node="/`echo $SWSTGNODE`" 34 else 35 swstg_node="" 36 fi 37 38 err_log_path="/var/opt/FJSVswsts"$swstg_node"/log" 39 40 # Device type check 41 trans="`echo $device | /usr/bin/grep "/dev/dsk/"`" 42 lvmtrans="`echo $device | /usr/bin/grep "/dev/"`" 43 vxpvtrans="`echo $device | /usr/bin/grep "/dev/vx/dmp/"`" 44 if [ "$trans" != "" ] 45 then 46 dev="`echo $device | /usr/bin/sed "s/\/dev\/dsk\///"`" 47 elif [ "$vxpvtrans" != "" ] 48 then 49 dev_type="vxvm_pv" 50 # /dev/vx/dmp/XXXX -> XXXX 51 dev="`echo $device | /usr/bin/awk -F\/ '{ print $5 }'`" 52 elif [ "$lvmtrans" != "" ] 53 then 54 # /dev/XXXX -> XXXX 55 dev="`echo $device | /usr/bin/awk -F\/ '{ print $3 }'`" 56 else 57 exit 0 58 fi 59 60 post_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".pre" 61 62 if [ "$trans" != "" ] 63 then 64 # Physical volume 65 cur_mount_list=`/usr/sbin/mount | grep " $device" | cut -f1 -d' '` 66 elif [ "$vxpvtrans" != "" ] 67 then 68 # VxVM PV 69 cur_mount_list="" 70 else 71 # Logical volume 72 cur_mount_list=`/usr/sbin/mount | grep " $device/" | cut -f1 -d' '` 73 fi 74 # Device unmount process. 75 # 76 if [ "$cur_mount_list" != "" ] 77 then 78 for cur_mount in $cur_mount_list 79 do 80 /usr/sbin/umount $cur_mount 2>/dev/null 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 /usr/sbin/umount $cur_mount > $err_log_path/$dev.umount 2>&1 90 if [ $? != 0 ] 91 then 92 retry_count=`expr $retry_count - 1` 93 /usr/bin/sleep $sleep_time 94 else 95 /usr/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 /usr/sbin/fuser -cu $cur_mount> $err_log_path/$dev.fuser 2>&1 104 /usr/bin/ps -ef > $err_log_path/$dev.ps 2>&1 105 exit 10 106 fi 107 fi 108 done 109 echo "mount" > $post_file 110 111 # When device was not mounted 112 # 113 else 114 echo "none" > $post_file 115 fi 116 117 exit 0 |
The names of the postprocessing shell scripts used for tape copying are:
/etc/opt/FJSVswsts/sh/TapeCopy.post
/etc/opt/FJSVswsts/<logical node name >/sh/TapeCopy.post
1 #!/bin/sh 2 3 # AdvancedCopy Manager 4 # All Rights Reserved, Copyright FUJITSU LIMITED, 2005-2006 5 6 # 7 # Postprocessing of tape copy processing 8 # 9 # Argument: $1 Device or VG name of backup disk 10 # $2 Reserve 11 # 12 # Error number 13 # 2: Argument error 14 15 # Argument check 16 case $# in 17 1) 18 ;; 19 2) 20 ;; 21 *) 22 exit 2 23 ;; 24 esac 25 26 device=$1 27 28 # Determination of postprocessing file name 29 30 if [ "$SWSTGNODE" != "" ] 31 then 32 swstg_node="/`echo $SWSTGNODE`" 33 else 34 swstg_node="" 35 fi 36 37 err_log_path="/var/opt/FJSVswsts"$swstg_node"/log" 38 39 # Device type check 40 trans="`echo $device | /usr/bin/grep "/dev/dsk/"`" 41 lvmtrans="`echo $device | /usr/bin/grep "/dev/"`" 42 vxpvtrans="`echo $device | /usr/bin/grep "/dev/vx/dmp/"`" 43 if [ "$trans" != "" ] 44 then 45 dev="`echo $device | /usr/bin/sed "s/\/dev\/dsk\///"`" 46 elif [ "$vxpvtrans" != "" ] 47 then 48 dev_type="vxvm_pv" 49 # /dev/vx/dmp/XXXX -> XXXX 50 dev="`echo $device | /usr/bin/awk -F\/ '{ print $5 }'`" 51 elif [ "$lvmtrans" != "" ] 52 then 53 # /dev/vgXX -> vgXX 54 dev="`echo $device | /usr/bin/awk -F\/ '{ print $3 }'`" 55 else 56 exit 0 57 fi 58 post_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".pre" 59 60 # Confirmation of postprocessing 61 if [ ! -r $post_file ] 62 then 63 exit 0 64 fi 65 /usr/bin/rm -f $post_file 2> /dev/null 66 67 exit 0 |
The names of the preprocessing shell scripts used for tape copying are:
/etc/opt/FJSVswsts/sh/TapeCopy.pre
/etc/opt/FJSVswsts/<logical node name >/sh/TapeCopy.pre
1 #!/bin/sh 2 3 # AdvancedCopy Manager 4 # All Rights Reserved, Copyright FUJITSU LIMITED, 2005-2006 5 6 # 7 # Preprocessing of tape copy processing 8 # 9 # Argument: $1 VG name of backup disk 10 # $2 Reserve 11 # 12 # Error number 13 # 2: Argument error 14 # 10: umount error 15 16 # Argument check 17 case $# in 18 1) 19 ;; 20 2) 21 ;; 22 *) 23 exit 2 24 ;; 25 esac 26 27 device=$1 28 29 if [ "$SWSTGNODE" != "" ] 30 then 31 swstg_node="/`echo $SWSTGNODE`" 32 else 33 swstg_node="" 34 fi 35 36 err_log_path="/var/opt/FJSVswsts"$swstg_node"/log" 37 38 # Determination of postprocessing file name 39 if [ "`echo $device | /usr/bin/grep "/dev/hdisk"`" != "" ] 40 then 41 dev_type="lvm_pv" 42 # /dev/hdisk? -> hdisk? 43 dev="`echo $device | /usr/bin/awk -F\/ '{ print $3 }'`" 44 45 elif [ "`echo $device | /usr/bin/grep "/dev/vx/dmp/"`" != "" ] 46 then 47 dev_type="vxvm_pv" 48 # /dev/vx/dmp/device -> device 49 dev="`echo $device | /usr/bin/awk -F\/ '{ print $5 }'`" 50 51 elif [ "`echo $device | /usr/bin/grep "/dev/"`" != "" ] 52 then 53 dev_type="lvm_vg" 54 # /dev/VG_Name -> VG_Name 55 dev="`echo $device | /usr/bin/awk -F\/ '{ print $3 }'`" 56 57 else 58 # Other Volume 59 exit 0 60 fi 61 62 post_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".pre" 63 64 # When the backup disk is a volume group ##################################### 65 if [ "$dev_type" = "lvm_vg" ] 66 then 67 68 # Devices is volume group and script not customize 69 exit 99 70 71 # When devices of volume group was mounted 72 # # Specify the name of volume group to unmount 73 # if [ "$device" = "/dev/vg**" ] 74 # then 75 # 76 # # Unmount all logical volumes of the volume group 77 # mount_point="/**" 78 # /usr/sbin/umount $mount_point 2>/dev/null 79 # if [ $? != 0 ] 80 # then 81 # retry_count=3 82 # sleep_time=1 83 # result_flag=1 84 # 85 # while [ $retry_count -gt 0 ] 86 # do 87 # /usr/sbin/umount $mount_point > $err_log_path/$dev.umount 2>&1 88 # if [ $? != 0 ] 89 # then 90 # retry_count=`expr $retry_count - 1` 91 # /usr/bin/sleep $sleep_time 92 # else 93 # /usr/bin/rm -f $err_log_path/$dev.umount 94 # result_flag=0 95 # break 96 # fi 97 # done 98 # 99 # if [ $result_flag != 0 ] 100 # then 101 # /usr/sbin/fuser -cu $mount_point> $err_log_path/$dev.fuser 2>&1 102 # /usr/bin/ps -ef > $err_log_path/$dev.ps 2>&1 103 # 104 # exit 10 105 # fi 106 # fi 107 # echo "mount" > $post_file 108 # fi 109 110 # When the backup disk is a VxVM physical volume ############################# 111 elif [ "$dev_type" = "vxvm_pv" ] 112 then 113 # Nothing is done to VxVM physical volume. 114 echo "none" > $post_file 115 116 # When the backup disk is a LVM physical volume ############################## 117 elif [ "$dev_type" = "lvm_pv" ] 118 then 119 # Nothing is done to LVM physical volume. 120 echo "none" > $post_file 121 122 fi 123 exit 0 |
The names of the postprocessing shell scripts used for tape copying are:
/etc/opt/FJSVswsts/sh/TapeCopy.post
/etc/opt/FJSVswsts/<logical node name>/sh/TapeCopy.post
1 #!/bin/sh 2 3 # AdvancedCopy Manager 4 # All Rights Reserved, Copyright FUJITSU LIMITED, 2005-2006 5 6 # 7 # Postprocessing of tape copy processing 8 # 9 # Argument: $1 VG name of backup disk 10 # $2 Reserve 11 # 12 # Error number 13 # 2: Argument error 14 15 # Argument check 16 case $# in 17 1) 18 ;; 19 2) 20 ;; 21 *) 22 exit 2 23 ;; 24 esac 25 26 device=$1 27 28 if [ "$SWSTGNODE" != "" ] 29 then 30 swstg_node="/`echo $SWSTGNODE`" 31 else 32 swstg_node="" 33 fi 34 35 err_log_path="/var/opt/FJSVswsts"$swstg_node"/log" 36 37 # Determination of postprocessing file name 38 if [ "`echo $device | /usr/bin/grep "/dev/hdisk"`" != "" ] 39 then 40 dev_type="lvm_pv" 41 # /dev/hdisk? -> hdisk? 42 dev="`echo $device | /usr/bin/awk -F\/ '{ print $3 }'`" 43 44 elif [ "`echo $device | /usr/bin/grep "/dev/vx/dmp/"`" != "" ] 45 then 46 dev_type="vxvm_pv" 47 # /dev/vx/dmp/device -> device 48 dev="`echo $device | /usr/bin/awk -F\/ '{ print $5 }'`" 49 50 elif [ "`echo $device | /usr/bin/grep "/dev/"`" != "" ] 51 then 52 dev_type="lvm_vg" 53 # /dev/VG_Name -> VG_Name 54 dev="`echo $device | /usr/bin/awk -F\/ '{ print $3 }'`" 55 56 else 57 # Other Volume 58 exit 0 59 fi 60 61 post_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".pre" 62 63 # Confirmation of postprocessing 64 if [ ! -r $post_file ] 65 then 66 exit 0 67 fi 68 69 /usr/bin/rm -f $post_file 2> /dev/null 70 exit 0 |
The names of the preprocessing script files used for tape copying are:
"environment settings directory"\etc\backup\scripts\TapeCopyPre.js
<shared disk>:\etc\opt\swstorage\etc\backup\scripts\TapeCopyPre.js
1 // AdvancedCopy Manager for Windows 2 // All Rights Reserved, Copyright FUJITSU LIMITED, 2005-2006 3 // 4 // TapeCopyPre.js: Pre-Processing Script for tape copy 5 // 6 // [Parameters] 7 // 1st argument: device name of backup volume 8 // 9 // [Return Values] 10 // 0: The script ended normally. 11 // 2: The number of the arguments is incorrect. 12 // 4: An error other than the above occurred. 13 14 try { 15 // create global objects 16 var WshShell = WScript.CreateObject("WScript.Shell"); // create Shell object 17 var WshEnv = WshShell.Environment("PROCESS"); // create Environment object 18 var fsObj = WScript.CreateObject("Scripting.FileSystemObject"); // create FileSystemObject object 19 20 // create SwstTapeCopyPreProc object 21 var proc = new SwstTapeCopyPreProc(); 22 23 // there is nothing to do if the pre/post-processing is not customized 24 proc.doNothingForDriveLetter(); 25 26 SwstQuit(0); 27 } catch (e) { 28 SwstQuit(4); 29 } 30 31 function SwstTapeCopyPreProc() 32 { 33 // member variables 34 this.bvName = WScript.Arguments.length!=1?SwstQuit(1):WScript.Arguments.Item(0); // device name of transaction volume 35 this.postFileName = getDataPathName() + "\\" + getPutFileName(this.bvName) + ".pre"; // name of postprocessing file 36 37 // member functions 38 this.doNothingForDriveLetter = doNothingForDriveLetter; // self-explanatory 39 this.writePostFile = writePostFile; // self-explanatory 40 } 41 42 function doNothingForDriveLetter() 43 { 44 this.writePostFile(this.postFileName, "none"); 45 } 46 47 function writePostFile(postfile, postdata) 48 { 49 var overwrite = true; // means to overwrite a file if it exists. 50 var postFileStream = fsObj.CreateTextFile(postfile, overwrite); 51 postFileStream.Write(postdata); 52 postFileStream.Close(); 53 } 54 55 function SwstQuit(exitStatus) 56 { 57 switch(exitStatus) { 58 case 0: 59 WScript.Quit(0); 60 case 1: 61 WScript.Echo("[Tape copy Preprocessing] The number of the arguments is incorrect."); 62 WScript.Quit(2); 63 default: 64 WScript.Echo("[Tape copy Preprocessing] The script exited abnormally."); 65 WScript.Quit(4); 66 } 67 } 68 69 function getDataPathName() 70 { 71 return WshShell.RegRead(getSetupInfoKey() + "\\etcPathName") + "\\etc\\backup\\data\\DEFAULT"; 72 } 73 74 function getSetupInfoKey() 75 { 76 var nodeName = WshEnv.Item("SWSTGNODE"); 77 if( nodeName != "" ){ 78 return "HKEY_LOCAL_MACHINE\\SOFTWARE\\Fujitsu\\AdvancedCopy Manager\\CurrentVersion\\" + nodeName; 79 } 80 return "HKEY_LOCAL_MACHINE\\SOFTWARE\\Fujitsu\\AdvancedCopy Manager\\CurrentVersion"; 81 } 82 83 function getPutFileName(deviceName){ 84 var fileName; 85 fileName = deviceName; 86 return(fileName); 87 } 88 |
The names of the postprocessing script files used for tape copying are as follows:
"environment settings directory"\etc\backup\scripts\TapeCopyPost.js
<shared disk>:\etc\opt\swstorage\etc\backup\scripts\TapeCopyPost.js
1 // AdvancedCopy Manager for Windows 2 // All Rights Reserved, Copyright FUJITSU LIMITED, 2005-2006 3 // 4 // TapeCopyPost.js: Post-Processing Script for tape copy 5 // 6 // [Parameters] 7 // 1st argument: device name of backup volume 8 // 9 // [Return Values] 10 // 0: The script ended normally. 11 // 2: The number of the arguments is incorrect. 12 // 4: An error other than the above occurred. 13 14 try { 15 // create global objects 16 var WshShell = WScript.CreateObject("WScript.Shell"); // create Shell object 17 var WshEnv = WshShell.Environment("PROCESS"); // create Environment object 18 var fsObj = WScript.CreateObject("Scripting.FileSystemObject"); // create FileSystemObject object 19 20 // create SwstTapeCopyPostProc object 21 var proc = new SwstTapeCopyPostProc(); 22 23 // do nothing if postprocessing file exists 24 if (fsObj.FileExists(proc.postFileName) == false) { 25 SwstQuit(0); 26 } 27 28 // get postprocessing type 29 var postProcType = proc.getPostProcData(proc.postFileName); 30 switch(postProcType) { 31 case "none": 32 proc.doNothing(); 33 break; 34 } 35 36 // clear temporary files 37 proc.deletePostFile(proc.postFileName); 38 SwstQuit(0); 39 } catch (e) { 40 SwstQuit(6); 41 } 42 43 function SwstTapeCopyPostProc() 44 { 45 // member variables 46 this.bvName = WScript.Arguments.length!=1?SwstQuit(1):WScript.Arguments.Item(0); // device name of transaction volume 47 this.postFileName = getDataPathName() + "\\" + getPutFileName(this.bvName) + ".pre"; // name of postprocessing file 48 49 // member functions 50 this.getPostProcData = getPostProcData; // self-explanatory 51 this.doNothing = doNothing; // self-explanatory 52 this.deletePostFile = deletePostFile; // self-explanatory 53 } 54 55 function getPostProcData(postfile) 56 { 57 var iomode = 1; // means read-only mode 58 var create = false; // means not to create a file 59 var postFileStream = fsObj.OpenTextFile(postfile, iomode, create); 60 var postData = postFileStream.ReadAll(); 61 postFileStream.Close(); 62 return postData; 63 } 64 65 function doNothing() 66 { 67 // do nothing 68 } 69 70 function deletePostFile(postfile) 71 { 72 if (fsObj.FileExists(postfile) == true) { 73 fsObj.DeleteFile(postfile); 74 } 75 } 76 77 function SwstQuit(exitStatus) 78 { 79 switch(exitStatus) { 80 case 0: 81 WScript.Quit(0); 82 case 1: 83 WScript.Echo("[Tape copy Postprocessing] The number of the arguments is incorrect."); 84 WScript.Quit(2); 85 default: 86 WScript.Echo("[Tape copy Postprocessing] The script exited abnormally."); 87 WScript.Quit(4); 88 } 89 } 90 91 function getDataPathName() 92 { 93 return WshShell.RegRead(getSetupInfoKey() + "\\etcPathName") + "\\etc\\backup\\data\\DEFAULT"; 94 } 95 96 function getSetupInfoKey() 97 { 98 var nodeName = WshEnv.Item("SWSTGNODE"); 99 if( nodeName != "" ){ 100 return "HKEY_LOCAL_MACHINE\\SOFTWARE\\Fujitsu\\AdvancedCopy Manager\\CurrentVersion\\" + nodeName; 101 } 102 return "HKEY_LOCAL_MACHINE\\SOFTWARE\\Fujitsu\\AdvancedCopy Manager\\CurrentVersion"; 103 } 104 105 function getPutFileName(deviceName){ 106 var fileName; 107 fileName = deviceName; 108 return(fileName); 109 } |
The backup volume is locked and unlocked by programs, not scripts. This means that the tape copy preprocessing script is executed immediately before the volume is locked, and the tape copy postprocessing script is executed immediately after the volume is unlocked. The preprocessing and postprocessing scripts for tape copying do not perform any actual processing.
If, during tape copy preprocessing, the locking process fails because of the need to avoid a temporary access conflict with another application, the locking process will be retried. If the specified number of retries is exceeded, the command terminates abnormally. This indicates that one or more processes are still using the backup volume. The user should take appropriate measures such as terminating applications or services to prevent the volume from being used by other processes. Note that the specified number of retries can be changed by creating a setup file called a "backup volume lock specification file". (See "Backup volume lock specification file for tape copying in Windows" for details.)
Note that if the measures to prevent other processes from using the target volume are correctly implemented while the tape copying process is being performed, there is usually no need to create this file.
If, during tape copy preprocessing in Windows, the locking process fails because of the need to avoid a temporary conflict with another application trying to access the backup volume, the locking process will be retried.
The standard retry process is as follows:
The maximum number of retries (20 by default) and the retry interval (1 second by default) can be modified by creating a setup file called a "backup volume lock specification file for tape copying".
This setup file can also be used to direct tape copy preprocessing to perform the following operations:
The backup volume lock specification file for tape copying is not backed up by the resource backup command (swstresback). If the backup volume lock specification file for tape copying is being used, you will need to back it up using a command such as copy.
To create a backup volume lock specification file for tape copying, use the following file names.
File name |
For non-cluster operation: For cluster operation: |
The following sample settings are for a backup volume lock specification file for tape copying.
[g1d2p1] LockForceMode=on LockRetryNumber=10 LockRetryInterval=10 [g1d2p2] NoPrePost=on [ANY] LockForceMode=off LockRetryNumber=20 LockRetryInterval=100
The backup volume lock specification file for tape copying is created as follows:
Key |
Description |
---|---|
LockForceMode |
If locking of a backup volume fails, the locking process will be retried. This parameter specifies that the volume will be unmounted before the retry process begins. off (default) = Do not unmount the volume before the retry process When a volume is unmounted, all open handles on that volume will be disabled. Note: If a volume is in use soon after it has been unmounted, it may not be possible to lock it. This parameter is disabled if NoPrePost is set to on. |
LockRetryNumber |
If locking of a backup volume fails, the locking process will be retried. This parameter specifies the number of retries to be performed.Any interval between 1 and 10000 can be specified. The default value is 20 (retries). If a backup volume cannot be locked after the specified number of retries have been performed, the process is suspended and the command is forced to terminate abnormally. This parameter is disabled if NoPrePost is set to on. |
LockRetryInterval |
If locking of a backup volume fails, the locking process will be retried. This parameter specifies the interval (in milliseconds) between each retry operation. Any interval between 1 and 600000(10 minutes) can be specified. The default value is 1000 (1 second). This parameter is disabled if NoPrePost is set to on. |
NoPrePost |
This parameter specifies that tape copy preprocessing will not be performed. off (default) = Perform tape copy preprocessing and postprocessing on = Do not perform tape copy preprocessing and postprocessing When NoPrePost is set to on, all other parameters (LockForceMode, LockRetryNumber and LockRetryInterval) are disabled. |
Contents
Index
![]() ![]() |