User Tools

Site Tools


backup_vmware

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
backup_vmware [2015/05/05 16:58] herwarthbackup_vmware [2015/05/05 17:44] (current) herwarth
Line 3: Line 3:
 Download latest files from github: Download latest files from github:
 [[https://github.com/lamw/ghettoVCB]] [[https://github.com/lamw/ghettoVCB]]
-Put the files on a datastore. I use datastore backup (/vmfs/volumes/backup), which is NFS mount. +Put the files on a datastore. I use datastore backup (/vmfs/volumes/backup), which is an NFS mount.
-=====Configure ghettoVCB=====+
 I have put the original scripts in /vmfs/volumes/backup/bin. I have create my own cron script to put the backup files in the necessary directories. I have put the original scripts in /vmfs/volumes/backup/bin. I have create my own cron script to put the backup files in the necessary directories.
 +
 +From download machine:
 +  scp ghettoVCB-master.zip root@supermicro1.mngt.bh.helux.nl:/vmfs/volumes/backup
 +From hypervisor:
 +  cd /vmfs/volumes/backup
 +  unzip ghettoVCB-master.zip
 +  mv ghettoVCB-master bin
 +  mkdir log
 +  mkdir data
 +  mkdir conf
  
 <code - /vmfs/volumes/backup/cron-ghettoVCB.sh> <code - /vmfs/volumes/backup/cron-ghettoVCB.sh>
Line 26: Line 35:
  
 exit 0 exit 0
 +</code>
 +
 +=====Configure ghettoVCB=====
 +I use different configs for each datacenter. I have hypervisors in 3 datacenters.
 +
 +<code - /vmfs/volumes/backup/conf/ghettoVCB-ams.conf>
 +VM_BACKUP_VOLUME=/vmfs/volumes/backup/data/amsterdam
 +DISK_BACKUP_FORMAT=thin
 +VM_BACKUP_ROTATION_COUNT=1
 +POWER_VM_DOWN_BEFORE_BACKUP=0
 +ENABLE_HARD_POWER_OFF=0
 +ITER_TO_WAIT_SHUTDOWN=3
 +POWER_DOWN_TIMEOUT=5
 +ENABLE_COMPRESSION=0
 +VM_SNAPSHOT_MEMORY=0
 +VM_SNAPSHOT_QUIESCE=0
 +ALLOW_VMS_WITH_SNAPSHOTS_TO_BE_BACKEDUP=1
 +ENABLE_NON_PERSISTENT_NFS=0
 +UNMOUNT_NFS=0
 +NFS_SERVER=172.30.0.195
 +NFS_VERSION=nfs
 +NFS_MOUNT=/nfsshare
 +NFS_LOCAL_NAME=nfs_storage_backup
 +NFS_VM_BACKUP_DIR=mybackups
 +SNAPSHOT_TIMEOUT=15
 +EMAIL_LOG=0
 +EMAIL_SERVER=auroa.primp-industries.com
 +EMAIL_SERVER_PORT=25
 +EMAIL_DELAY_INTERVAL=1
 +EMAIL_TO=auroa@primp-industries.com
 +EMAIL_FROM=root@ghettoVCB
 +WORKDIR_DEBUG=0
 +VM_SHUTDOWN_ORDER=
 +VM_STARTUP_ORDER=
 +</code>
 +<code - /vmfs/volumes/backup/conf/ghettoVCB-bh.conf>
 +VM_BACKUP_VOLUME=/vmfs/volumes/backup/data/bergschenhoek
 +DISK_BACKUP_FORMAT=thin
 +VM_BACKUP_ROTATION_COUNT=1
 +POWER_VM_DOWN_BEFORE_BACKUP=0
 +ENABLE_HARD_POWER_OFF=0
 +ITER_TO_WAIT_SHUTDOWN=3
 +POWER_DOWN_TIMEOUT=5
 +ENABLE_COMPRESSION=0
 +VM_SNAPSHOT_MEMORY=0
 +VM_SNAPSHOT_QUIESCE=0
 +ALLOW_VMS_WITH_SNAPSHOTS_TO_BE_BACKEDUP=1
 +ENABLE_NON_PERSISTENT_NFS=0
 +UNMOUNT_NFS=0
 +NFS_SERVER=172.30.0.195
 +NFS_VERSION=nfs
 +NFS_MOUNT=/nfsshare
 +NFS_LOCAL_NAME=nfs_storage_backup
 +NFS_VM_BACKUP_DIR=mybackups
 +SNAPSHOT_TIMEOUT=15
 +EMAIL_LOG=0
 +EMAIL_SERVER=auroa.primp-industries.com
 +EMAIL_SERVER_PORT=25
 +EMAIL_DELAY_INTERVAL=1
 +EMAIL_TO=auroa@primp-industries.com
 +EMAIL_FROM=root@ghettoVCB
 +WORKDIR_DEBUG=0
 +VM_SHUTDOWN_ORDER=
 +VM_STARTUP_ORDER=
 +</code>
 +<code - /vmfs/volumes/backup/conf/ghettoVCB-rtd.conf>
 +VM_BACKUP_VOLUME=/vmfs/volumes/backup/data/rotterdam
 +DISK_BACKUP_FORMAT=thin
 +VM_BACKUP_ROTATION_COUNT=1
 +POWER_VM_DOWN_BEFORE_BACKUP=0
 +ENABLE_HARD_POWER_OFF=0
 +ITER_TO_WAIT_SHUTDOWN=3
 +POWER_DOWN_TIMEOUT=5
 +ENABLE_COMPRESSION=0
 +VM_SNAPSHOT_MEMORY=0
 +VM_SNAPSHOT_QUIESCE=0
 +ALLOW_VMS_WITH_SNAPSHOTS_TO_BE_BACKEDUP=1
 +ENABLE_NON_PERSISTENT_NFS=0
 +UNMOUNT_NFS=0
 +NFS_SERVER=172.30.0.195
 +NFS_VERSION=nfs
 +NFS_MOUNT=/nfsshare
 +NFS_LOCAL_NAME=nfs_storage_backup
 +NFS_VM_BACKUP_DIR=mybackups
 +SNAPSHOT_TIMEOUT=15
 +EMAIL_LOG=0
 +EMAIL_SERVER=auroa.primp-industries.com
 +EMAIL_SERVER_PORT=25
 +EMAIL_DELAY_INTERVAL=1
 +EMAIL_TO=auroa@primp-industries.com
 +EMAIL_FROM=root@ghettoVCB
 +WORKDIR_DEBUG=0
 +VM_SHUTDOWN_ORDER=
 +VM_STARTUP_ORDER=
 </code> </code>
  
Line 41: Line 144:
 crond crond
 exit 0 exit 0
 +</code>
 +
 +after that run it for 1 time only!
 +
 +  /etc/rc.local.d/local.sh
 +
 +make it persistent
 +
 +  /sbin/auto-backup.sh
 +
 +=====Use Bacula to backup the NFS share=====
 +We only backup vms backupped with status OK. So I use a script before I run the Bacula job.
 +This script is the same NFS share on Linux as a datastore on the hypervisor. In this situation the NFS share is mounted on /mnt/synology/volume1/vmware/backup on the Linux machine we are going to backup using Bacula.
 +
 +<code - run-before-bacula.sh>
 +#!/bin/bash
 +BACKUPDIR=/mnt/synology/volume1/vmware/backup
 +STATUSOK=STATUS.ok
 +STATUSWARN=STATUS.warn
 +TEMPDIR=$BACKUPDIR/temp
 +
 +case $1 in
 +  bh) DATADIR=$BACKUPDIR/data/bergschenhoek ;;
 +  rtd) DATADIR=$BACKUPDIR/data/rotterdam ;;
 +  ams) DATADIR=$BACKUPDIR/data/amsterdam ;;
 +  *) echo "usage $0 <bh|rtd|ams>"
 +     exit 1 ;;
 +esac
 + 
 +rm -rf $TEMPDIR/*
 +
 +for fulldir in $(find $DATADIR -name $STATUSOK -exec dirname {} \; -o -name $STATUSWARN -exec dirname {} \; ); do
 +  DIR=$(basename $fulldir)
 +  VMNAME=$(echo $fulldir | sed  "s|$DATADIR||" | cut -d'/' -f2)
 +  if [ ! -d $TEMPDIR/$VMNAME ]; then
 +    mkdir $TEMPDIR/$VMNAME
 +  fi
 +  mv $fulldir $TEMPDIR/$VMNAME
 +done
 +
 +rm -rf $DATADIR/*
 +mv $TEMPDIR/* $DATADIR
 </code> </code>
  
backup_vmware.1430845091.txt.gz · Last modified: by herwarth