Symantec scripts for Storage Volume Snapshots
Creation Date: August 01, 2011
Revision Date: August 01, 2011
Product: DS-System (Linux)
Summary
This feature is enabled by the DS-System's "UseSnapshot" Parameter (See "DS-System Advanced Configuration".).
The following are the steps for how to set up scripts for Symantec snapshot. The sample pre-defined scripts that are provided must be configured for each different environment in which they are used.
Steps for how to set up scripts for Symantec snapshot
1. For a Symantec file store, there is no API provided by Symantec. Therefore, the DS-System must use SSH to take a snapshot. This means Symantec snapshot only works for Linux DS-Systems.
2. Two scripts are provided: one is to create a snapshot, and the other is to delete that snapshot.
- You (the Service Provider) must copy these two scripts to a location accessible to the DS-System and set them up in the "Snapshot Create" and "Snapshot Destroy" fields of the "New / Edit Storage" screen:
3. If necessary, modify the following three (3) parameters in each script. (The defaults may be sufficient, depending on your environment.):
|
|
|
|
|
Sets up file system prefix. The default is /vx (you can check what prefix is used from the Symantec tools). |
|
|
Sets up the folder where to mount the snapshot and DS-System will use this directory to access the snapshots. |
|
IDENTITY=/root/.ssh/id_rsa
|
Sets up the SSH connection. - On the DS-System side, select which user to use for the SSH connection to Symantec Storage. In the sample scripts, the user 'root' is used.
- Logon as 'root' to DS-System and perform ssh-keygen to generate a private key (/root/.ssh/id_rsa) and a public key (/root/.ssh/id_rsa.pub) for the user 'root'.
- Set up a user on the storage device that will be used to perform the snapshot (someone other than 'root'). For this example, if you use 'master', you would copy the content of the public key file (/root/.ssh/id_rsa.pub) to the authorized file of user 'master' (/home/master/.ssh/authorized_keys).
- Set up the private file location to "IDENTITY= "
|
4. Example of each script:
symantec_snapshot_create.sh
-
-
#!/bin/sh
-
-
FS_PREFIX=/vx
-
SNAP_DIR=/snapshot
-
IDENTITY=/root/.ssh/id_rsa
-
-
if [ $# -lt 4 ]; then
-
echo "$0 <NAS address> <username> <volume name> <snapshot name>"
-
exit 1
-
fi
-
-
NAS_ADDR=$1
-
USER_NAME=$2
-
VOL_NAME=$3
-
SNAP_NAME=$4
-
/usr/bin/ssh -o StrictHostKeyChecking=no -i $IDENTITY $USER_NAME@$NAS_ADDR storage snapshot create $SNAP_NAME $VOL_NAME
-
rc=$?
-
if [ $rc != 0 ]
-
then
-
echo "Snapshot $SNAP_NAME creation failed (error code: $rc)."
-
exit $rc
-
fi
-
echo "Snapshot $SNAP_NAME created."
-
-
/usr/bin/ssh -o StrictHostKeyChecking=no -i $IDENTITY $USER_NAME@$NAS_ADDR nfs share add ro,no_root_squash,async $FS_PREFIX/$VOL_NAME:$SNAP_NAME
-
rc=$?
-
if [ $rc != 0 ]
-
then
-
echo "NFS share snapshot $SNAP_NAME share failed (error code: $rc)."
-
exit $rc
-
fi
-
echo "Snapshot $SNAP_NAME NFS shared."
-
-
snapdir=$SNAP_DIR/$VOL_NAME:$SNAP_NAME
-
/bin/mkdir -p $snapdir
-
rc=$?
-
if [ $rc != 0 ]
-
then
-
echo "mkdir $snapdir failed (error code: $rc)."
-
exit $rc
-
fi
-
-
/sbin/mount.nfs $NAS_ADDR:$FS_PREFIX/$VOL_NAME:$SNAP_NAME $snapdir -n -o ro,async
-
rc=$?
-
if [ $rc != 0 ]
-
then
-
echo "mount snapshot $SNAP_NAME to $snapdir failed (error code: $rc)."
-
exit $rc
-
fi
-
echo "Snapshot $SNAP_NAME mounted to $snapdir."
-
-
exit 0
-
|
symantec_snapshot_delete.sh
-
#!/bin/sh
-
-
FS_PREFIX=/vx
-
SNAP_DIR=/snapshot
-
IDENTITY=/root/.ssh/id_rsa
-
-
if [ $# -lt 4 ]; then
-
echo "$0 <NAS address> <username> <volume name> <snapshot name>"
-
exit 1
-
fi
-
-
NAS_ADDR=$1
-
USER_NAME=$2
-
VOL_NAME=$3
-
SNAP_NAME=$4
-
-
snapdir=$SNAP_DIR/$VOL_NAME:$SNAP_NAME
-
-
/sbin/umount.nfs $snapdir -f -n -l
-
rc=$?
-
if [ $rc != 0 ]
-
then
-
echo "umount snapshot $SNAP_NAME from $snapdir failed (error code: $rc)."
-
exit $rc
-
fi
-
echo "Snapshot $SNAP_NAME umounted."
-
-
/usr/bin/ssh -o StrictHostKeyChecking=no -i $IDENTITY $USER_NAME@$NAS_ADDR nfs share delete $FS_PREFIX/$VOL_NAME:$SNAP_NAME
-
rc=$?
-
if [ $rc != 0 ]
-
then
-
echo "NFS unshare snapshot $SNAP_NAME failed (error code: $rc)."
-
exit $rc
-
fi
-
echo "Snapshot $SNAP_NAME NFS unshared."
-
-
/usr/bin/ssh -o StrictHostKeyChecking=no -i $IDENTITY $USER_NAME@$NAS_ADDR storage snapshot destroy $SNAP_NAME $VOL_NAME
-
rc=$?
-
if [ $rc != 0 ]
-
then
-
echo "Snapshot $SNAP_NAME deletion failed (error code: $rc)."
-
exit $rc
-
fi
-
echo "Snapshot $SNAP_NAME deleted."
-
-
/bin/rmdir $snapdir
-
-
exit 0
|
See Also
The information provided in this document is provided "AS IS", without warranty of any kind. ASIGRA Inc. (ASIGRA) disclaims all warranties, either express or implied. In no event shall ASIGRA or its business partners be liable for any damages whatsoever, including direct, indirect, incidental, consequential, loss of business profits or special damages, even if ASIGRA or its business partners have been advised of the possibility of such damages. © Asigra Inc. All Rights Reserved. Confidential.