SearchFAQMemberlist Log in
Reply to topic Page 1 of 1
tar Wrapper for ESXi and/or Busybox
Author Message
Post tar Wrapper for ESXi and/or Busybox 
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 Wink

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 Wink
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.net
List: https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki: http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/

Post tar Wrapper for ESXi and/or Busybox 
Oh, just as an addition:

I'm skipping now the snapshot related files *vmss and *vmsn, too. In
case you want this too, just add the two "grep" commands.


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.net
List: https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki: http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/

Post tar Wrapper for ESXi and/or Busybox 
Hi,

I had to realize there's something going wrong with my attempt.

Anyone having a clue why the backup does not succeed?

vmfs/volumes/B/ad/vmware.log
[ skipped 58 lines ]
tarExtract: Done: 0 errors, 6 filesExist, 56 sizeExist, 208 sizeExistComp, 57 filesTotal, 6068247 sizeTotal
Got fatal error during xfer (No files dumped for share /vmfs/volumes/A)
Backup aborted (No files dumped for share /vmfs/volumes/7x1TB)
Not saving this as a partial backup since it has fewer files than the prior one (got 391 and 0 files versus 406)

I don't get this error message here....

Thanks!

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.net
List: https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki: http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/

Display posts from previous:
Reply to topic Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
  


Magic SEO URL for phpBB