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
backup_vmware [2015/05/05 17:26] herwarthbackup_vmware [2015/05/05 17:44] (current) herwarth
Line 154: Line 154:
   /sbin/auto-backup.sh   /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>
  
  
 {{tag>vmware}} {{tag>vmware}}
  
backup_vmware.1430846799.txt.gz · Last modified: by herwarth