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 17:18] herwarthbackup_vmware [2015/05/05 17:44] (current) herwarth
Line 5: Line 5:
 Put the files on a datastore. I use datastore backup (/vmfs/volumes/backup), which is an NFS mount. Put the files on a datastore. I use datastore backup (/vmfs/volumes/backup), which is an NFS mount.
 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: From download machine:
   scp ghettoVCB-master.zip root@supermicro1.mngt.bh.helux.nl:/vmfs/volumes/backup   scp ghettoVCB-master.zip root@supermicro1.mngt.bh.helux.nl:/vmfs/volumes/backup
Line 143: 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.1430846318.txt.gz · Last modified: by herwarth