In this post, I will share one of the most important script you can use for backup ODA Virtual Machines and also you can use this backups for cloning Virtual Machines.
Before running this script in your own environment, please make sure that all the directories and environments are correct.
Here is the script with explain plan.
- Change the general Environment directories and names
- Change environment for your each Virtual Machine
- Below 3 lines are creating snapshot, tar that snapshot files and delete snapshot
- Create one “include” file for each vm, this file will be including snapshot directory path
Note : You can also create Virtual Disk backup with the same script, Just paste Vİrtual disk names into the environments and commands
#######01 – General Environment ######################
BASE_DIR=/NAS/ITTUTORIAL/VMBACKUP
Tarih=`date ‘+%d_%m_%Y’`
BACKUP_DIR=/NAS/ITTUTORIAL/VMBACKUP/$Tarih
mkdir -p $BACKUP_DIR
####### 02 – Virtual Machine Environment ################
BACKUP_NAME=APPLICATION_VM_01
INCLUDE_FILE=$BASE_DIR/scripts/INC_${BACKUP_NAME}_include.lst
###### 03 – Virtual Machine Backup Commands ############
syntax : acfsutil snap create -p <virtualmachinename> <nameofthesnapshot> <snapshotdirectory>
acfsutil snap create -p APPLICATION_VM_01 APPLICATION_VM_01_snap /u01/app/sharedrepo/vm_data
tar -cpzvf $BACKUP_DIR/$BACKUP_NAME.tar.gz –files-from=$INCLUDE_FILE
acfsutil snap delete APPLICATION_DATA_snap /u01/app/sharedrepo/vm_data
##### 04 – INCLUDE FILE ############################
# cat /NAS/ITTUTORIAL/VMBACKUP/scripts/INC_APPLICATION_VM_01_include.lst
/u01/app/sharedrepo/vm_data/.ACFS/snaps/APPLICATION_VM_01_snap
2,035 views last month, 1 views today