I have spent the last few days trying to find a free backup solution to the newly free ESXi for windows only enviroments (in particular Windows XP). The solution for me was the following:
1. Installing Windows Services for UNIX (WSFU)
2. Copying the ESXi Server password and group files to Windows
3. Configuring WSFU for accepting ESX Server connections
4. Sharing the Windows folder for NFS compatibility
5. Configuring the ESXi Server to mount the Window NFS Share as Datastore.
6. Setup Backup Script
Attached is the complete steps.
I take NO credit for any of this. This is just a complation of others work formated to suit my needs and felt others could benift from it as I have.
by Jason Mattox from Vizioncore (direct copy of his work, I just added more information to make it work in Windows XP)
Haven't tried it, yet, but for those UNIX gurus out there, you can probably enable SSH and then use rsync to copy the files over SSH to a backup location. The downside, of course, is that you'll incur some high CPU overhead for the encryption (and compression, if you use that, too) of SSH.
-
Message was edited by: sanbe
Haven't tried it, yet, but for those UNIX gurus out there, you can probably enable SSH and then use rsync to copy the files over SSH to a backup location. The downside, of course, is that you'll incur some high CPU overhead for the encryption (and compression, if you use that, too) of SSH.
rsync ? Probably not. It is not a part of ESXi.
But you can do it with scp (lots of clients available).
Nevermind...forgot rsync has to be present on the remote host, as well. Doh!
I have also observed that NFS copy seems to run much faster (25MB/s vs. 4MB/s) compared with SCP copy and take less CPU resource (30% vs. 35%) on ESXi host (single cpu P4 3.0GHz though).
I can comfirm this also. I can backup 4 VM 15gb each in less than an hour. Where as it takes 45 mins per VM with scp, and about 60 min per through the datastore browser. All to the same backup server.
The encryption/compression overhead I mentioned :-)...
sanbe, script works great. I have added to it to allow the tar gzip from gnuwin for compression. Do with it what you will.
Working on the restore script now.
I wrote a php script using the rcli on linux. It gets the list of vms and files, creates snap if needed and backups the files, then
removes snaps.
I have tested on three esxi servers that have anywhere from two vm to three.
Message was edited by: kchawk
nice work kchawk and sanbe - I'm going to try it out this week but using just linux and maybe incorporating it all into one perl script.
Cheers
I am trying to do something similar, but in Linux. What files need to be copied to backup a running VM? I have tried copying the following files:
NS3-flat.vmdk
NS3.nvram
NS3.vmdk
NS3.vmsd
NS3.vmx
NS3.vmxf
If I copy them while the VM is powered down, I can restart the copied machine in a diffrent location with no problem. If I take a snapshot and then copy the same files, while the machine is running on the snapshot, I can't turn on the copied machine. I get a file missing error. I was trying to read the pearl script, but I am very good with pearl. I see this line in the script, but I am not sure what it does.
#remove the "\n" at the end of $filename to prevent a error massage in log
chomp($filename)
&actualtime();
print " -
Copy File: ";
print $filename;
At a minimum you really just need the VMDK (and flat.vmdk) file. The VMX can be easily recreated.
When you create a snapshot on a VM, the VMX file is updated to point to the snapshot VMDK file (i.e. <vm-name>-000001.vmdk) instead of the main VMDK file. That's why you can't power it on once you've copied it. You could instead do this
1) Copy the VMX file
2) Take a snapshot
3) copy the VMDK
4) Remove the snapshot.
You would then be able to start that copy on another host.
That works, thanks!
I now can backup my VM's manually and am witting a bash script to do it automatically. I have the remote cli tools installed on a remote Ubuntu server. I am trying to remotely take a snapshot of my VM's during the backup script, but the snapshotmanager.pl gives me an error. Here is the command I am running to my ESXi servers and the error I get. This should be the last piece to make my script work. Any ideas?
root@backup:/backup/# perl /usr/lib/vmware-viperl/apps/vm/snapshotmanager.pl --url https://xxx.xxx.128.21:443/sdk/vimService --username xxxx --password xxxx --operation create --powerstatus poweredOn --snapshotname backup
Error: Server version unavailable at 'https:/xxx.xxx.128.21:443/sdk/vimService.wsdl' :1: parser error : Start tag expected, '<' not found
LWP will support https URLs if the Crypt::SSLeay module is installed.
^ at /usr/local/share/perl/5.8.8/VMware/VICommon.pm line 323
I remember having to add something to perl but can't remember off hand.
cpan install Crypt::SSLeay
This command on my Ubuntu server, did the trick. Thanks!
#aptitude install libcrypt-ssleay-perl
Great script!
One concern, the steps where it's copying the files with vifs.pl are crazy slow. I was pulling out a 5GB VM and it took 31 minutes. I have a number of 20GB VMs and really, two hours each is a bit unreasonable... Is this something everyone else has observed as a limitation of the perl toolkit or the platform, or is something out of whack here?
Same Problem here, great Script, but i can only copy the VM-Files from 2 different VMXi Hosts with about 20Mbits.
yeah same here, takes about 7 times longer for me to copy a 1GB vmdk file from my ESXi server to my RCLI Linux server using SCP. Does the toolkit provide any other way to copy these files off the server? You could of course use SCP to pull the file but then have to think about setting up the keys as SCP will ask for a username/password - not too difficult I remember.