Vmware esxi perl script for backup

Hello,

I am trying to use the perl script esxi-backup.pl to backup my unlicensed version of VMware ESXI 4.1.  I have one datastore with 2 VM's.  The second VM copys fine, but the first only copies a few bytes of the vmdk file which should be like 100GB.  I've attached the screen shot of what I see when the script runs.
Capture.JPG
Sean RhudyPresidentAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Andrew Hancock (VMware vExpert / EE MVE^2)Connect With a Mentor VMware and Virtualization ConsultantCommented:
GhettoVCB is simple, supported, developed and maintained by the community.

The PERL script you've found is old and outdated, and developed for ESXi 3.5.
0
 
Sean RhudyPresidentAuthor Commented:
#
# ESXi 3.5 Backup Script
#
# Autor: Christian Gruetzner
#
#
#############################################################################
#
#2008-08-22  V 1.0 Basic Script
#            Functions:     - create snapshots of all local VM's
#                           - get files from ESX-Datastore to local Store
#                           - exclude unneccessary files from backup
#                           - remove all created snapshots
#                           - actual time in log
#
#############################################################################




my $url = "https://dsesxi01/sdk/vimService";     #URL to your ESX Host
my $username = "root";                                  #Username
my $password = "Gp*4rVS71";                                    #User password
my $snapshotname = "BackupSnap";                        #Name of your Snapshot
my $DSPath = "[datastore1]";                            #Datastore name on ESX Host, example [datastore]
my @VMNames;
$VMNames[0] = "DSDC001";                      #Uncomment the next lines if you like to backup more vm's
$VMNames[1] = "DSAP01";
#$VMNames[2] = "";
#$VMNames[3] = "";
#$VMNames[4] = "";
#$VMNames[5] = "";
#$VMNames[6] = "";
#$VMNames[7] = "";
#$VMNames[8] = "";
#$VMNames[9] = "";
my $RCLIPath = "C:/Progra~1/vmware/VMware~1";           #VI Remote CLI Path (Windows: Use ONLY Short Folder Names!!!!)
my $DestPath = "Z:/";                                   #Destination Path you like to copy to (Windows: Use ONLY Short Folder Names!!!!)

#IMPORTANT!!! -- Under DestPath must exist the VMNames Folder 
#(For Example if your VMNames[0] = "ServerA" and your DestPath = "D:/": D:/ServerA/)
#--------------------------------------------------------
# For the short folder name use "dir /X"










#call the sub function (at the bottom)
&actualtime();
print " ***** Script Start *************************\n\n";

&actualtime();
print " ----- Create Snapshots of running VM's -----";
print "\n\n";
system("perl $RCLIPath/Perl/apps/vm/snapshotmanager.pl --url $url --username $username --password $password --operation create --powerstatus poweredOn --snapshotname $snapshotname");
print "\n\n";





&actualtime();
print " ----- Copy VM files to local storage   -----";
print "\n\n";
my $i = 0;
#special loop for arrays. run as long the array has data
foreach (@VMNames)
{
    #read all available files and save filenames in the cache-array
	my @cache = `perl $RCLIPath/bin/vifs.pl --url $url --username $username --password $password --dir \"$DSPath $VMNames[$i]\"`;
	#run as long the cache array has data and save the value everytime in $filename
	foreach my $filename (@cache)
	{
		#exclude uninterresting files from backup to save backup space
	 	if($filename !~ /.log/ && $filename !~ /.vswp/ && $filename !~ /.vmsn/ && $filename !~ /-delta/)
	 	{
	 		#remove the "\n" at the end of $filename to prevent a error massage in log
			chomp($filename)
			&actualtime();
			print " ----- Copy File: ";
	 		print $filename;
	 		#get files from VM Datastore to a local Storage
			system("perl $RCLIPath/bin/vifs.pl --url $url --username $username --password $password --get \"$DSPath $VMNames[$i]/$filename\" \"$DestPath$VMNames[$i]/$filename\"");
			print "\n";
		}
	}
	$i++;
}
print "\n\n";





&actualtime();
print " ----- Remove Snapshots of running VM's -----";
print "\n\n";
system("perl $RCLIPath/Perl/apps/vm/snapshotmanager.pl --url $url --username $username --password $password --operation remove --powerstatus poweredOn --snapshotname $snapshotname --children 1");
print "\n\n";

&actualtime();
print " ***** Script End ***************************";










#sub function to print the actual time in the log
sub actualtime
{
	my ($Sekunden, $Minuten, $Stunden, $Monatstag, $Monat,
	    $Jahr, $Wochentag, $Jahrestag, $Sommerzeit) = localtime(time);
	my $CTIME_String = localtime(time);
	$Monat+=1;
	$Jahrestag+=1;
	$Monat = $Monat < 10 ? $Monat = "0".$Monat : $Monat;
	$Monatstag = $Monatstag < 10 ? $Monatstag = "0".$Monatstag : $Monatstag;
	$Stunden = $Stunden < 10 ? $Stunden = "0".$Stunden : $Stunden;
	$Minuten = $Minuten < 10 ? $Minuten = "0".$Minuten : $Minuten;
	$Sekunden = $Sekunden < 10 ? $Sekunden = "0".$Sekunden : $Sekunden;
	$Jahr+=1900;
	
	print "$Jahr-$Monat-$Monatstag $Stunden:$Minuten:$Sekunden";
}

Open in new window

0
 
gorhonCommented:
ok, but why using vmware vcb backup? please find vcb installation on the web. not hard.
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
Why don't you use the tried and tested Ghetto VCB?

5. ghettoVCB

http://communities.vmware.com/docs/DOC-8760 ((Will work on FREE ESXi, no licensed required.)

(can be performed whilst the virtual machine is live or powered on)

Above taken from my EE Article


VMware ESX/ESXi Backup Guide
0
 
Sean RhudyPresidentAuthor Commented:
vcb isn't free.  GhettoVCB looks much more difficult to configure and run.  The perl script was fairly simple to configure and is working for one VM, just not the other.  Any ideas on what's happening?
0
 
Sean RhudyPresidentAuthor Commented:
Is there a more simple guide out there for GhettoVCB besides the one above?
0
 
Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
You download the script and makes changes to the ghettoVCB.conf file.

The URL above is the best source of how to configire ghettoVCB.

If you are not comfortable with scripts, I would suggest  purchasing a $500 License from VMware and Veeam Backup and Replication v6.
0
 
Sean RhudyPresidentAuthor Commented:
Sorry for the late response, let me give ghettoVCB a try.
0
 
Sean RhudyPresidentAuthor Commented:
Ok, I am configuring Ghetto VCB and have a question.  I want to backup to a NAS drive.  I'm confused on the difference between:

VM_BACKUP_VOLUME=/vmfs/volumes/dlgCore-NFS-bigboi.VM-Backups/WILLIAM_BACKUPS

and

Defining the NFS information

Do I use one or the other?
0
 
Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
specify the datastore you need to backup to

so I have a datastore called

/vmfs/volumes/nfs

i would use thatbin the config
0
 
Sean RhudyPresidentAuthor Commented:
I don't want to backup to a datastore, I want to backup to a Network attached storage device. Can I do that?
0
 
Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
yes, but needs to be added to the host server.

GhettoVCB can automatically mount and dismount the network attached storage, or you can attach to ESXi permenantly. network attached storage connected to ESX server is a datastore.

option is yours.
0
 
Sean RhudyPresidentAuthor Commented:
Got ya, so would I connect the Nas device as a datastore prior to doing this, or will GhettoVCB do it for me?
0
 
Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
youncan connect it advance, and leave it connected, or GhettoVCB will auto mount and demount.

choice is yours.
0
 
Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
less configurationm and issues if you connect it.
0
 
Sean RhudyPresidentAuthor Commented:
I have ghettoVCB setup but am having errors in the backups, I will open a new question.
0
All Courses

From novice to tech pro — start learning today.