Bacula-users

Re: [Bacula-users] bacula to backup vmware images

2008-08-15 09:46:30
Subject: Re: [Bacula-users] bacula to backup vmware images
From: "Lukasz Szybalski" <szybalski AT gmail DOT com>
To: "Ronald Buder" <rbuder AT proficom-ag DOT de>
Date: Fri, 15 Aug 2008 08:46:24 -0500
On Fri, Aug 15, 2008 at 3:08 AM, Ronald Buder <rbuder AT proficom-ag DOT de> 
wrote:
> Hi,
>
> as I don't seem to get around to testing with a VMware Server, I'll just
> share my ESX scripts with you... maybe they help, at least as far as
> understanding goes.
>
> Ok, here goes:
>
> #!/bin/sh
>
> # Backup of a single VM using VCB
> # first parameter is an identifier, such as the VM's name inside ESX or
> it's IP (the latter one works with running VMware tools only):
>
> VM=$1
> exportbase=/localdata/bacula
> exportdir=$exportbase/$VM/$(date +"%Y%m%d-%H%M")
> mkdir -p $exportbase/$VM
> /usr/sbin/vcbMounter -a ipaddr:$VM -r $exportdir                    #


If the tools that you are using are available I could definitely try
doing that, but I don't seem to have vcbMounter available? I don't
have vmware tools installed so I'm not sure if that might be a part of
vmware tools for vmware server 1.0.x?

Those running vmware server 1.0.x do you have vcbMounter available to you?

Lucas

> this is the part where the actual work is done
> cd $exportdir
> if [ $? = 0 ]
> then
>  echo "Backup successfull..."
>  exit 0
> else
>  echo "Directory missing, backup failed..."
>  exit 1
> fi
>
> The script really isn't hard. I have a wrapper script which calls this
> one repeatedly. The wrapper script determines the VM's to be saved (I
> spread them across the week in order to keep the load down a bit, 27 VMs
> at the moment, I keep the time the VM was last saved in a database
> table, alter it slightly using a simple random function in order to have
> it spread chaotically). The script itself is being run directly on our
> dedicated backup ESX host, the wrapper script is bacically a perl
> application which runs directly on the bacula director and calls this
> one via ssh with key login enabled. So no need for passwords here...
>
> There is a second script however which works slightly different. It's
> not being called by Bacula at the moment, it runs within our old backup
> system. The goal to the second script was to save every VM on two
> dedicated ESX hosts.
>
> Here goes:
>
> #!/bin/bash
> echo "Script to automatically backup RTL vms"
>
> for host in 10.92.79.48 10.92.79.58
> do
>        ssh root@$host << EOF
>        mount 10.92.79.25:/localdata/rtl /mnt/backup
>        EXPORTBASE=/mnt/backup
>        for i in \`vmware-cmd -l\`
>        do
>                VM_NAME=\`grep displayName \$i | awk '{print \$3}'\`
>                VM_NAME=\`echo \${VM_NAME%?} | sed "s/^.//"\`
>                EXPORTDIR=\$EXPORTBASE/\$VM_NAME/\$(date +"%Y%m%d-%H%M")
>                echo "VM \$VM_NAME wird nach \$EXPORTDIR exportiert"
>                mkdir -p \$EXPORTBASE/\$VM_NAME
>                vcbMounter -h localhost -u root -p VerySecurePassword -a
> name:"\$VM_NAME" -r \$EXPORTDIR
>        done
>        sleep 10
>        umount -l /mnt/backup
> EOF
> done
> exit 0
>
> Not very elegant, I know. Again the part that does the actual work is
> the vcbMounter line. This one basically logs into the first ESX host,
> uses vmware-cmd -l to get the VMs running on that host and then starts
> exporting them one by one. Once through, we log into the second host and
> do the same thing. This is somewhat nessary as we run plenty of ESX
> hosts having DRS enabled so you can never be sure just where a VM
> currently resides. The backup itself runs directly onto a nfs share, as
> you can see.
>
> Anyways, hope that helped. Questions welcome, suggestions also :)
>
> Regards, Ronald
>
>



-- 
Where was my car manufactured?
http://cars.lucasmanual.com/vin
TurboGears Manual-Howto
http://lucasmanual.com/pdf/TurboGears-Manual-Howto.pdf

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users