VMware Communities > VMTN > VMTN Solutions > User Solutions > Discussions
1 2 3 Previous Next
42 Replies Last post: May 20, 2009 12:59 PM by PCS_Dan
Reply

VISBU - Free easy-to-use VI3 backup utility

Mar 6, 2007 9:53 AM

Click to view mittell's profile Champion mittell 3,096 posts since
Apr 25, 2006
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 as and when I have time, 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://users.ox.ac.uk/~alexm/visbu-0.8.4.tar.gz

Once you've extracted the archive, please read the README file in the directory created for instructions on using the utility.

Alex
Reply Re: VISBU - Free easy-to-use VI3 backup utility Apr 27, 2007 6:22 AM
Click to view paulkbeyer's profile Enthusiast paulkbeyer 44 posts since
Sep 27, 2006
Hey Alex,

Cracking Script mate, though I haven't DOH'd through the config file yet .. I'm just having a real hard time getting the export path right. My error output is :-

[root@esxhost vi-backup]# vi-backup.pl -c /usr/local/vi-backup.cfg
readline() on closed filehandle CONFIG at /usr/local/sbin/vi-backup.pl line 1162.
Use of uninitialized value in concatenation (.) or string at /usr/local/sbin/vi-backup.pl line 1081.
Use of uninitialized value in substitution (s///) at /usr/local/sbin/vi-backup.pl line 1082.
Use of uninitialized value in substitution (s///) at /usr/local/sbin/vi-backup.pl line 1082.
Use of uninitialized value in pattern match (m//) at /usr/local/sbin/vi-backup.pl line 1083.
FATAL ERROR: You cannot use / as a destination for backups! Exiting script.

The .cfg file looks like this :-

hostname=esxhost.domain.com
username=root
password=password
searchspec=name:VMGuest
exportpath=/vmfs/volumes/virtual_machines_backup/
safemode=0
mailreport=1
mailserver=192.168.0.1
mailfrom=esxhostbackup@domain.com
mailto=esxalerts@domain.com
smb=0

Can anyone see where I've been slightly dim?

Again, it's a cracking script Alex and it makes me want to learn Perl so I feel I could contribute! Any references to starting scripting in Perl appreciated! Really cool stuff.

Paul.
Reply Re: VISBU - Free easy-to-use VI3 backup utility May 13, 2007 2:51 PM
Click to view Intelligen's profile Novice Intelligen 12 posts since
Mar 16, 2006
Can you give some more details information on the settings when setting up a configuration file?

Like what is SafeMode? Where are these Search Param?
Reply Re: VISBU - Free easy-to-use VI3 backup utility May 21, 2007 6:58 AM
in response to: Intelligen
Click to view mittell's profile Champion mittell 3,096 posts since
Apr 25, 2006
Hi there,

Safemode means that the old backup will not be deleted until the current backup has finished successfully.

Some basic search params are powerstate:on, powerstate:off, name, uuid, ipaddr, etc.

Please take a look at the README file that is bundled with the script, it's got more detailed explanations for all of the options.

While I'm here there's also a new version out, 0.8.5, please use this rather than 0.8.4.

http://users.ox.ac.uk/~alexm/visbu-0.8.5.tar.gz

Cheers,

Alex
Reply Re: VISBU - Free easy-to-use VI3 backup utility May 24, 2007 8:12 AM
in response to: mittell
Click to view mittell's profile Champion mittell 3,096 posts since
Apr 25, 2006
Hi Guys,

I'm going to be contributing to xtravirt.com, and my backup script will also be hosted there from now on. Please use the below link for future downloads - this is where updating versions will be hosted from now on.

Cheers!

Alex

http://xtravirt.com/index.php?option=com_remository&Itemid=75&func=select&id=5
Reply Re: VISBU - Free easy-to-use VI3 backup utility Jun 3, 2007 1:55 PM
Click to view mcretan's profile Lurker mcretan 5 posts since
Aug 15, 2006
Great Script thanks Alex - works like a charm!

Any idea when you might implement the zip backup file option? (hint hint ;)

We're using your script to create VM backups, which we want to then zip up and arhive off to tape with our backup exec server via RALUS on the esx box. We could do the zipping outside your script, but it'd be much neater if it was included as part of the backup process.

Also, another idea for you - any chance of allowing a separate email reporting address to be used if errors are encountered during backups? It'd really help to put backup errors in the face of people that need to know about them without them having to manually scour plain old log messages.

Keep up the great work.

Cheers,

Mike Cretan
Reply Re: VISBU - Free easy-to-use VI3 backup utility Jun 4, 2007 3:10 PM
in response to: mcretan
Click to view mittell's profile Champion mittell 3,096 posts since
Apr 25, 2006
Backup compression coming soon. :)

In the mean time, I've updated the script to fix some bugs and add some new functionality. 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

For support please post in this thread, email or PM me.

http://www.vmware.com/community/thread.jspa?threadID=70253

Suggestions welcome.

Cheers,

Alex
Reply Re: VISBU - Free easy-to-use VI3 backup utility Jun 6, 2007 11:25 PM
in response to: mittell
Click to view violet68's profile Enthusiast violet68 84 posts since
Dec 1, 2006
Hi all,

if i want to backup VM1 nothing else,

what is the command to run ?

and should i change the config file like this :
## Config file created by vi-backup.pl 0.9 ##
hostname=ESX3-01.XXX.COM
username=root
password=password
searchspec=name:VM1
exportpath=/mnt/backup/
2gbsparse=1
safemode=1
mailreport=1
mailserver=192.168.X.X
mailfrom=XXX@XXX.COM
mailto=XXX@XXX.COM
smb=0
Reply Re: VISBU - Free easy-to-use VI3 backup utility Jun 7, 2007 7:42 PM
in response to: violet68
Click to view violet68's profile Enthusiast violet68 84 posts since
Dec 1, 2006
i found the answer

use this : searchspec=name:VM1
Reply Re: VISBU - Free easy-to-use VI3 backup utility Jun 12, 2007 2:04 PM
Click to view dwightmccann's profile Novice dwightmccann 14 posts since
Apr 5, 2005
I am running on an ESX 3.0.0 system with two virtual machines provided to me to test your script (for which I thank you profusely.) I have a couple of issues that are eluding me.

The VMs:
[root@blade20 volumes]# vmware-cmd -l
/vmfs/volumes/455dbba7-fdf002e9-db01-0011254a3fe4/2k3test2/2k3test2.vmx
/vmfs/volumes/455dbba7-fdf002e9-db01-0011254a3fe4/esx3/esx3.vmx

The .cfg file:
[root@blade20 volumes]# cat /usr/local/vi-backup/vi-backup.cfg
## Config file created by vi-backup.pl 0.9 ##
hostname=blade20.xxx.xxx.xxx
username=root
password=xxx
searchspec=powerstate:on
exportpath=/vmfs/volumes/44f70cf4-1cf7a617-71dc-0011254a3fe4/visbutest
2gbsparse=0
safemode=1
mailreport=1
mailserver=xxx.xxx.xxx
mailfrom=dwight.mccann@isc.ucsb.edu
mailto=xxx.xxx.xxx
smb=0

The .vmx for the machine with the issue:
#!/usr/bin/vmware
config.version = "6"
virtualHW.version = "3"
floppy0.present = "true"
powerType.powerOff = "default"
powerType.powerOn = "default"
powerType.suspend = "default"
powerType.reset = "default"

displayName = "2k3test2"
extendedConfigFile = "2k3test2.vmxf"

scsi0.present = "true"
scsi0.sharedBus = "none"
scsi0.virtualDev = "vmxlsilogic"
memsize = "1024"
scsi0:0.present = "true"
scsi0:0.name = "2k3test2.vmdk"
scsi0:0.deviceType = "scsi-hardDisk"
ide0:0.present = "true"
ide0:0.fileName = "/dev/cdrom"
ide0:0.deviceType = "atapi-cdrom"
floppy0.startConnected = "false"
floppy0.fileName = "/dev/fd0"
ethernet0.present = "true"
ethernet0.startConnected = "TRUE"
ethernet0.allowGuestConnectionControl = "false"
ethernet0.networkName = "123SubNet"
ethernet0.addressType = "vpx"
ethernet0.generatedAddress = "00:50:56:b7:3d:bd"
guestOS = "winnetstandard"
uuid.bios = "50 37 02 81 d9 92 8b d8-87 e6 c9 7b 4c b4 46 5e"
log.fileName = "vmware.log"
sched.cpu.min = "0"
sched.cpu.units = "mhz"
sched.cpu.shares = "normal"
sched.mem.minsize = "512"
sched.mem.max = "1024"
sched.mem.shares = "normal"
cpuid.1.eax = "----xxxxxxxx--------xxxx--------"
cpuid.1.ecx = "----------------R-0------R------"
cpuid.1.ecx.amd = "--------------------------------"
cpuid.80000001.ecx = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0"
cpuid.80000001.edx = "xx0xxxxxxxx0xxxxxxxxxxxxxxxxxxxx"

checkpoint.cptConfigName = "2k3test2"
priority.grabbed = "normal"
priority.ungrabbed = "normal"
scsi0:0.redo = "/vmfs/volumes/455dbba7-fdf002e9-db01-0011254a3fe4/2k3test2/2k3test2.vmdk.REDO"
tools.syncTime = "FALSE"

uuid.location = "56 4d d6 54 91 4b a0 d5-a0 b7 b8 58 c5 bc d2 26"
sched.swap.derivedName = "/vmfs/volumes/455dbba7-fdf002e9-db01-0011254a3fe4/2k3test2/2k3test2.vswp"

The issue is that VISBU says there are no disks to export for the 2k3test2 VM:
11/06/2007 23:55:06: [esx3] Backup completed without errors.

11/06/2007 23:59:57: [2k3test2] No disks to export!
Backup completed without errors.

*** Script completed successfully. ***

The log file:
12/06/2007 04:07:23: Log file opened.
12/06/2007 04:07:24: [2007-06-12 04:07:24.150 'App' 3076448384 info] Current working directory: /
[2007-06-12 04:07:24.182 'BaseLibs' 13863856 warning] [Vmdb_Unset] Unsetting unknown path: /vmomi/

[2007-06-12 04:07:24.316 'CreateSnapshot' 3076448384 info] Creating snapshot
[2007-06-12 04:07:24.377 'vcbSnapshot' 3076448384 error] Error: This operation is not supported.
12/06/2007 04:07:24: [2007-06-12 04:07:24.703 'App' 3076452480 info] Current working directory: /
[2007-06-12 04:07:24.735 'BaseLibs' 7977904 warning] [Vmdb_Unset] Unsetting unknown path: /vmomi/

[2007-06-12 04:07:24.866 'App' 3076452480 error]

Exception: Assert failed!
[2007-06-12 04:07:24.867 'App' 3076452480 error] Backtrace:
[00] eip 0xa06d1e
[01] eip 0x95dd29
[02] eip 0x918295
[03] eip 0x91893e
[04] eip 0x9189f9
[05] eip 0x918ac5
[06] eip 0x8062bed
[07] eip 0x806067f
[08] eip 0x805e650
[09] eip 0x8072e95
[10] eip 0x805e82e
[11] eip 0x39279a
[12] eip 0x805dbc1

[2007-06-12 04:07:24.870 'App' 3076452480 error] Backtrace:
[00] eip 0xa06d1e
[01] eip 0x95dd29
[02] eip 0xa06965
[03] eip 0x91894b
[04] eip 0x9189f9
[05] eip 0x918ac5
[06] eip 0x8062bed
[07] eip 0x806067f
[08] eip 0x805e650
[09] eip 0x8072e95
[10] eip 0x805e82e
[11] eip 0x39279a
[12] eip 0x805dbc1

Any clues as to what is going wrong? Unfortunately I am not the VMware person but the Backup person and I didn't create the server or the VMs.

Dwight
Reply Re: VISBU - Free easy-to-use VI3 backup utility Jun 13, 2007 5:58 AM
in response to: dwightmccann
Click to view mittell's profile Champion mittell 3,096 posts since
Apr 25, 2006
I've come across this problem before - the snapshot backtrace in the log file is the clue.

The VM couldn't be snapshotted so the disks could not be exported. The reason the snapshot did not work is because the virtual hardware version of the VM is out of date. Was this VM imported from WS/Server/ESX2.x?

This line:

virtualHW.version = "3"

Should read:

virtualHW.version = "4"

Right click on the VM in the VI client and select "upgrade virtual hardware". Snapshot should then work after this and you'll be able to back the VM up.
Reply Re: VISBU - Free easy-to-use VI3 backup utility Jun 13, 2007 9:19 AM
Click to view dwightmccann's profile Novice dwightmccann 14 posts since
Apr 5, 2005
Yes, it was imported from ESX 2 as it turns out ... your response looks very helpful for resolving some other issues for us. Thanks. I'll try to get back here with an update.
Reply Re: VISBU - Free easy-to-use VI3 backup utility Jun 16, 2007 11:33 AM
in response to: mittell
Click to view mittell's profile Champion mittell 3,096 posts since
Apr 25, 2006
UPDATE: Could everyone using v0.9 please update to v0.9.1.

This update fixes the problem of backing up a VM register on another ESX host to your backup host when pointed at your VC server giving "VM files not found!" errors . It also re-enables the 'Any' search.
Reply Re: VISBU - Free easy-to-use VI3 backup utility Aug 30, 2007 1:23 PM
in response to: mittell
Click to view Wingen's profile Lurker Wingen 1 posts since
Aug 30, 2007
I had an issue with a corrupt esx.conf file presumably from running out of disk space during a backup.
Reply Re: VISBU - Free easy-to-use VI3 backup utility Oct 5, 2007 7:02 AM
in response to: Wingen
Click to view Ramdez's profile Lurker Ramdez 3 posts since
Oct 4, 2007

same exact thing happened to us. corrupted both of our host config files and we're reinstalling tonight. do you think in the next release it would be beneficial to include the esx.conf file in the backup process?

The issue reared it's ugly head by a vm saying after a reboot 'cable disconnected' because our vswitch was no longer active. Then editing a vswitch we saw the error

Error during configuration of the host: no child key with name:vswitch1 at parent net /net/vswitch

1 2 3 Previous Next
Actions