Hello all,
I've written a backup utility, it's currently still in 'beta' but I think I've worked out most of the bugs and it's been working very well for me, so I thought I'd share my work with the community.
I'll be trying to update it fairly regularly, hot-clone of a VM or specific VMDK attached to a VM planned for next version.
Please see the readme file here for some initial instructions: http://users.ox.ac.uk/~alexm/README
You can download the utility here:
http://xtravirt.com/index.php?option=com_remository&Itemid=75&func=select&id=5
Once you've extracted the archive, please read the README file in the directory created for instructions on using the utility.
Any problems post them to this thread and I'll try and resolve them, I'll set up a proper website when I have the time.
Alex
p.s. Big thanks to acr for help with testing!
Added link to the latest release - 21st May 2007[/b]
Message was edited by:
MR-T: Updated with link to Xtravirt site
Alex,
It happened while I was creating a config file and tried to send a test mail. However, after reading your message, I tried to finished the whole configureation file without testing, and it worked. When I went back to do a test mail, and it worked too. I didn't do anything different, but it did work this time. After that, a couple tests were all successful. I guess everything is fine now. The version that I am using is 0.8.5.
Thanks for your following up.
-BZ
Strange! If you see the problem again let me know, there's clearly some strange set of conditions that can occur that break the mail function - probably an obscure bug. If I can get enough info to track it down I'll sort it.
New version available here, please upgrade from 0.8.5.
You can now point it at any ESX server or your VC server (which also makes it DRS aware), thus the only requirement to backup a VM is the host you run it on can see the storage containing the VM. I've also improved the restore scripts.
http://www.xtravirt.com/index.php?option=com_remository&Itemid=75&func=fileinfo&id=7
Cheers,
Alex
"Added support for targeting VC server for backups"
This is awesome, thanks a ton.
Does anyone know of a way to backup to a vmfs volume, but retain the VMDK 'compression' benefits of backing up to an SMB share. We could then backup to the SAN via this script using minimum disk space.
Any ideas?
Andy
Hi Andy,
Easy, just add the line "2gbsparse=1" to your config file (assuming you're running v0.8.5 or later). This will cause backups to be created in the same format as when you export to an SMB share, even if you're backing up to a VMFS volumes.
Regards,
Alex
I tried to have it point to VC and tested backing up VM1000. It failed. It can't find the the VM, and here is the output.
***************************************
We're running VMware ESX Server 3.0.1 build-37303
\----
Searching for target VMs....
Locating VM files....
Processing config files....
VM1000 is not on a VMFS volume visible by this host!
Target VMs from specified searchspec:
VM1000
Snapshotting VM VM1000....
Snapshot of VM1000 successful.
Exporting disks for VM1000....
No disks to export!
Removing Snapshot for VM1000....
Snapshot removed successfully from VM1000.
Exporting VM config and log file...
cp: omitting directory `/tmp/'
ls: : No such file or directory
WARNING: Config or log file could not be exported for VM1000.
Use of uninitialized value in concatenation (.) or string at /usr/local/sbin/vi- backup.pl line 325, line 7.
chmod: changing permissions of `/mnt/backup/VM1000/VM1000.restore' (requested: 0700, actual: 0755): Operation not permitted
***************************************
When I tried to have it pointed to another ESX host, it failed too. And here is the output.
***************************************
We're running VMware ESX Server 3.0.1 build-37303
\----
Searching for target VMs....
Locating VM files....
VMControl error -11: No such virtual machine
VMControl error -11: No such virtual machine
***************************************
It seems the VMControl error goes indefinitely. Are there anyone else getting the same error, or it is just me?
Thanks for all the help.
-BZ
Is VM1000 on storage visible to the host you are running the script from?
Yes, the datastore that VM1000 resides on is visible to any host. In order to make sure of it, I have done a VMotion between these two hosts right before my last post.
-BZ
OK, could you PM me or email me you vi-backup.cfg file (minus passwords and real hostnames of course), and the .vmx file for the problem VM. I'll take a look at them see if I can work out what's going wrong.
Cheers,
Alex
Alex,
I'm trying to point the utility to my VC server from an ESX Host which has access to all the datastores and can ping all the hosts and the VC Server.
Here is a config file for a VM called backup-SERVER3.cfg:[code]## Config file created by vi-backup.pl 0.9 ##
hostname=abc-vcenter.abc.net
username=abc\administrator
password=abc123
searchspec=Name:SERVER3
exportpath=/vmfs/volumes/vi-backup/
2gbsparse=1
safemode=0
mailreport=1
mailserver=10.0.0.10
mailfrom=vi-backup@abc.net
mailto=hugo@abc.net
smb=0[/code]
But I get the following error when I run the script using the config file for that VM = vi-backup.pl -c backup-SERVER3.cfg:[code]We're running VMware ESX Server 3.0.1 build-44686
\----
Searching for target VMs....
FATAL ERROR: No VMs found from specified search specification '"Name:SERVER3"'!
Name searches are case sensitive, please check your VMs name.[/code]
Questions: Do I need to run the script on the ESX Host currently hosting SERVER3 even though I am pointing to the VC Server?
My intention is to just have VISBU installed on only one ESX Host, and point the scripts to the VC server. Can it be done this way?
I think this has been answered before or at least touched on but I am not a script person so I have not been able to figure it out. Just installed the script and trying to do my first backup with a config file and I am gettign the following errors.
readline() on closed filehandle CONFIG at /usr/local/sbin/vi-backup.pl line 1282.
Use of uninitialized value in concatenation (.) or string at /usr/local/sbin/vi-backup.pl line 1199.
Use of uninitialized value in substitution (s///) at /usr/local/sbin/vi-backup.pl line 1200.
Use of uninitialized value in substitution (s///) at /usr/local/sbin/vi-backup.pl line 1200.
Use of uninitialized value in pattern match (m//) at /usr/local/sbin/vi-backup.pl line 1202.
FATAL ERROR: You cannot use / as a destination for backups! Exiting script.
Here is whats in the config file.
\## Config file created by vi-backup.pl 0.9 ##
hostname=HQVM1.int.parkerfire.org
username=root
password=****
searchspec=name:VMguest
exportpath=/tmp/smbmnt/
2gbsparse=0
safemode=1
mailreport=0
smb=1
smbshare=//10.1.10.26/share
smbuser=username
smbpass=password
I created the smbmnt right off of the xtravirt webpage.
Any help would be very usefull
Thanks
It's failing to read from your config file for some reason. Did you manually edit the config file after creation? How are you running the script? "vi-backup.pl -c /usr/local/vi-backup.cfg"? Are you running it as root?
Is there a way to specify more then one machine using this syntax. Thanks for your comments
searchspec=Name:test1
Alex,
Thanks for that. My problem was due to me using the domain administrator credentials which I have removed from Permissions of my Datacentre. doh!
What is the lowest level credentials that I can give to a domain user to be able to backup the VMs in the VC farm?
-Hugo
Update:
The domain user only requires Read-Only access.
Alex,
I now get this error:[code]*****Virtual Infrastructure Scripted Backup Utility v0.9 by Alex Mittell*****
We're running VMware ESX Server 3.0.1 build-44686
\----
Searching for target VMs....
Locating VM files....
Processing config files....
SERVER3 is not on a VMFS volume visible by this host!
Target VMs from specified searchspec:
SERVER3
Snapshotting VM SERVER3....
VM SERVER3 is set to be excluded from backup. No snapshot taken. Skipping VM.[/code]
What I am trying to do is run the script from ESX1 pointing to abc-vcenter.abc.net using a domain account with Read-Only access to the Hosts & Clusters with propagation. SERVER3 is running on ESX2. ESX1 & ESX2 are part of a DRS Cluster which obviously have the same LUNS presented. I get the above error.
Can you assist please?
-Hugo
Is there a way to specify more then one machine using
this syntax. Thanks for your comments
searchspec=Name:test1
Currently the only way to do this is to have multiple config files, each with the searchspec=name:VM for the VM you want to backup. You can just copy your existing config and edit it to do this.
Unfortunately the searchspec is currently limited to those of vcbVmName, i.e. powerstate=on or off, name, ipaddr, uuid, any.
I'll be adding a .vmcfg file to the next release which will allow you to specify a list of VMs to backup.
Hi Hugo,
For some reason it's failing to see the VMs files. Could you email or PM me your .cfg file (minus passwords etc of course), the .vmx file, and the path to the .vmx. It'd probably also be useful to have an ls[/b] output of the VMs config file directory.
I'll try and work out what's going wrong from this information as what you are trying to do should work.
Cheers,
Alex
I tried to have it point to VC and tested backing up
VM1000. It failed. It can't find the the VM, and here
is the output.
***************************************
We're running VMware ESX Server 3.0.1 build-37303
\-------------------------------------------------
Searching for target VMs....
Locating VM files....
Processing config files....
VM1000 is not on a VMFS volume visible by this host!
Target VMs from specified searchspec:
VM1000
otting VM VM1000....
Snapshot of VM1000 successful.
Exporting disks for VM1000....
No disks to export!
Removing Snapshot for VM1000....
Snapshot removed successfully from VM1000.
Exporting VM config and log file...
cp: omitting directory `/tmp/'
ls: : No such file or directory
WARNING: Config or log file could not be exported for
VM1000.
Use of uninitialized value in concatenation (.) or
string at /usr/local/sbin/vi-
ackup.pl line 325, <STDIN> line 7.
Use of uninitialized value in concatenation (.) or
string at /usr/local/sbin/vi-
ackup.pl line 330, <STDIN> line 7.
Use of uninitialized value in string eq at
/usr/local/sbin/vi-backup.pl line 574
<STDIN> line 7.
hmod: changing permissions of
`/mnt/backup/VM1000/VM1000.restore' (requested:
700, actual: 0755): Operation not permitted
OK, I'm having the exact same problem when I try to point to my VC server. Any luck getting this resolved?
I did notice that it works if the VM you're tying to backup is on the ESX server where vi-backup.pl is running. However, if the VM is on a different host then it blows up like this.
(Using vcbMounter in the same way works without errors.)