BackupPC-users

[BackupPC-users] tar Wrapper for ESXi and/or Busybox

2012-01-16 04:12:24
Subject: [BackupPC-users] tar Wrapper for ESXi and/or Busybox
From: Christian Völker <chrischan AT knebb DOT de>
To: "General list for user discussion, questions and support" <backuppc-users AT lists.sourceforge DOT net>
Date: Mon, 16 Jan 2012 10:10:16 +0100
Hi,

as some of you might have issues backing up ESXi host I wrote a little
wrapper to get it done.

First, what are the issues with backing up ESXi?
1. ESXi does not allow ssh access by default
2. If ssh access enabled, it does not allow key-based authentication by
default
3. ESXi does not have rsync nor smb shares
4. It does not have GNU tar, only busybox tar instead.

So for issues 1+2 check your preferred search engine.
To solve 3. you'd need to get a rsync binary compiled and added to the
ESXi bootbank --> too complicated for me ;-)

So I decided to use tar as transfer method. Unfortunately the busybox
tar is very crippled compared to the GNU tar. But as far as I can see
BackuPC uses some options which I could easily simulate....
As I said I wrote a wrapper script which will be executed on the ESXi
instead of the (not available) GNU tar.
This script simply replaces the file selection arguments with the files
I'm interested in backing up. And at the end it writes a faked
"--totals" line so BackupPC is happy.

See the script below:
------------------------------------------------------------------------
#!/bin/sh -f
IFS="
"
/bin/tar $1 $2 $3 $4 $5 $6 `find $6 -type f -follow|grep -v
'\-flat.vmdk'|grep -v vswp|grep -v '\-delta.vmdk'|grep -vE '^.*/\..*$'`
exec 1>&2
echo 'Total bytes written: 1863680 (1.8MiB, 12MiB/s)'
------------------------------------------------------------------------

Well yes, BackupPC will always report the same speed ;-)
I'm not backing up the binary virtual disk files (-flat.vmdk) nor the
snapshot binary disk files (-delta.vmdk) but it backs up the disk
configuration files (.vmdk). It does not back up the swap files (.vswp)
and excludes all files (and directories) starting with ".". It skips all
empty directories.
For BackuPC I configured my client in the following way:
------------------------------------------------------------------------
$Conf{TarShareName} = [
  '/vmfs/volumes/A',
  '/vmfs/volumes/B'
  ];
$Conf{XferMethod} = 'tar';
$Conf{TarClientPath} = '/tar_wrapper.sh';
$Conf{TarClientCmd} = '$sshPath -q -x -n -l root $host'
                    . ' env LC_ALL=C $tarPath -c -v -f - -C $shareName+';
------------------------------------------------------------------------
So I configured the volumes to back up (TarShareName)- easily editable
through Web-GUI.
I use "tar" as XferMethod, but replaced the original /bin/gtar with my
wrapper script so the busybox tar does not complain about unknown arguments.


The only issue I have not yet solved how to put the tar_wrapper.sh so it
survives ESXi reboots. Any clues here?

Oh, and for all asking why I'm not fine with just backing up from inside
the virtual machine: This is the reason why I skip all the virtual disk
.vmdk files because I DO backup from inside the virtual machine. But
what I do in backing up the ESXi host is to back up the CONFIGURATION
DATA of the virtual machine (how many RAM assigned and so on). As well
as the log files...nothing which could be done from withing the virtual
machine.

Greetings

Christian

------------------------------------------------------------------------------
RSA(R) Conference 2012
Mar 27 - Feb 2
Save $400 by Jan. 27
Register now!
http://p.sf.net/sfu/rsa-sfdev2dev2
_______________________________________________
BackupPC-users mailing list
BackupPC-users AT lists.sourceforge DOT net
List:    https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:    http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/

<Prev in Thread] Current Thread [Next in Thread>