VMware Cloud Community
ChrisInTexas
Contributor
Contributor

Free ESXi Backup Solution for Windows

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)

(NFS Server port information)

by robink (The backup script)

(ssh on ESXi)

Tags (3)
0 Kudos
522 Replies
kyle7526
Contributor
Contributor

I was running the .pl script from a windows 2003 server that has the cli tools installed on it. Can I run the .php script from a windows 2003 server? I thought that script was only a linux script?

0 Kudos
agomezp
Enthusiast
Enthusiast

you can install php in windows ( the script is for new backups no for fix) , but you can edit the file and fix it to

0 Kudos
Shanew1
Contributor
Contributor

I have tested the Perl script on one of my ESXi servers and it works great, but my VMs are stored in more than one datastore. Can this script be modified to accommodate the backup of VMs in multiple datastores?

0 Kudos
agomezp
Enthusiast
Enthusiast

yes "[m-1074619^14706]" export all vm in a esxi host

0 Kudos
kpc
Contributor
Contributor

Shanew, I've written one that backs up all VM's in all datastores using vmware-cmd, however not being a Windows guy i've written it for my linux server. It would be pretty easy to convert to Windows or download and run it on the remote cli linux virtual appliance. I also think one of the PHP scripts on this thread can also handle multiple datastores. I wanted something that I could just simply schedule for each night and almost forget and not have to edit. Also would email me a report and do a weekly backup. Plus it uses SCP to copy the files, I couldn't get vifs to work faster than 1Mb/s. Hope it's some help to you.

http://communities.vmware.com/message/1078887

Cheers

0 Kudos
sm0kescreen
Contributor
Contributor

Nathan,

Do you have a list of steps on how to install the RCLI on Ubuntu Server?

Thanks

Will

0 Kudos
Nathan_Pease
Contributor
Contributor

Sorry, I believe all I had to do was download the package and untar it.

If I remember there was an install.pl script that you ran and it

installed itself. After the install do a

#aptitude install libcrypt-ssleay-perl

Then you should be good to go.

0 Kudos
kchawk
Contributor
Contributor

Has there been any info on the copy speed using vifs? Is it capped?

0 Kudos
tractng
Enthusiast
Enthusiast

Hey,

If the vms sit on the datastore that is from a iscsi (san/nas such as openfiler), what would be the best approach to backing up the vm?

Should this be a question on the openfiler forum or here?

Tnt

0 Kudos
elazar
Enthusiast
Enthusiast

Nice work Chris! Just to note, you can this on the ESXi host itself(via SSH or Alt + F1) as well, as follows:

-


cp /vmfs/volumes/<datastore>/<vmname>/*.vmx /vmfs/volumes/<backupdatastore>/<vmname>/

vim-cmd vmsvc/snapshot.create <vmid><snapshotName>

vmkfstools -d 2gbsparse -i /vmfs/volumes/<datastore>/<vmname>/<vmname>.vmdk /vmfs/volumes/<backupdatastore>/<vmname>/<vmname>.vmdk

vim-cmd vmsvc/snapshot.removeall <vmid>

-


I haven't tested this yet under cron, but it should work. Additionally, based on what I have read using 2gbsparse on file systems other than vmfs is the way to go(I know the default format for NFS is thin, however, if you were to clone a thin disk(say 20GB/2GB used) to local storage on the ESXi host, and then attempted to copy the clone via say WinSCP, the disk is copied as a thick disk(all 20GB) as opposed to a thin disk(about the 2GB that is in use), whereas 2gbsparse stays to about what is used on the disk, the only caveat with 2gbsparse is that ESXi cannot read it, to restore the disk, you would need to clone it from 2gbsparse back to a thick or thin disk), though running cloning directly to the NFS store, as opposed to copying the cloned vmdk after the fact, supposedly keeps the thin disks, thin. Any additional insight(s) would be greatly appreciated.

elazar

0 Kudos
cosy
Contributor
Contributor

HI All,

I'm new to ESXI so can someone please create the"how to backup" procedure for us please.

Cosy

0 Kudos
kpc
Contributor
Contributor

elazar, this is how many of the existing ESX scripts work, Just remembered about the vim-cmd command, Xtravirt do a really good guide on it. There's no CRONTAB command on ESXi or any CRON locations, is there any other way to schedule directly on the ESXi server? Looks like you still may need another server to run the scripts remotely.

0 Kudos
cosy
Contributor
Contributor

HI,

How do i setup your script?

I just install the RCL Virtual Client and login to that localhost:/usr/bin# vmware-cmd -H 192.168.4.20 -U root -P 1234

then i got error connecting to server at : 500 connect failed

so how do i run your script please?

0 Kudos
ipadl
Contributor
Contributor

Sanbe or others,

I'm a newbie with this stuff, but have been lurking for a while. Any way that I can get the ESXi-backup script to also create a log file? I know nothing about Perl scripting. Thanks for the script, I have it running on my test server and will likely be implementing it into the production server in the near future. Thanks!

Seth

0 Kudos
cosy
Contributor
Contributor

Hi Sanbe,

I done step 1 and step 2

But can you tell me the correct command and how do we setup step 3?

Pls PLS PLs can someone help me

Thanks,

0 Kudos
elazar
Enthusiast
Enthusiast

kpc, I am not familiar with any of the ESX scripts. I wasn't sure if people were aware of the fact that vim-cmd has similar functionality to vmware-cmd.pl and vmware-cmd on ESX. In my case, I am unable to run another box in order to automate a backup with the RCLI(I guess I could use a VM for this though), so being able to run a backup script on the host itself is crucial for me. The crontab on ESXi lives under /var/spool/cron/crontabs, I would suspect that it gets wiped out on host reboot, unless you modify the appropriate archive in bootbank. Attached is a simple bash script that I put together.

The script is located at: http://communities.vmware.com/docs/DOC-8881

elazar

Updated the backup script

Updated yet again. The script now pulls the configuration and disk names and paths from vim-cmd vmsvc/get.filelayout. No more source datastore and disk name hard coding.

0 Kudos
elazar
Enthusiast
Enthusiast

One more thing, if you get a BSOD(BAD_POOL_HEADER) when installing Services for Unix, see . Generally, anti-virus software is the culprit as some vendors register RPC filter drivers. The hotfix(click View and Request Hotfix downloads on the top left) referenced in the KB article resolves the issue. In my case, the SFU installation triggered the BSOD, so I had to manually remove SFU, copy the hotfixed rpcxdr.sys to the nfs directory under where I extracted the SFU installation files(you can manually extract the hotfix by running hotfix-executable-name.exe /x, or by using 7ZIP and like), and reinstall.

0 Kudos
ipadl
Contributor
Contributor

Cosy,

If you're running a windows box to do this backup, just set up a scheduled task as follows:

1. Control Panel>Scheduled Tasks.

2. Run the wizard.

3. Browse to location that you have the script saved when it asks what program you want Windows to run.

4. Figure out what day and what time.

5. Name it.

6. Enter your credentials

You should be good to go.

Seth

0 Kudos
cosy
Contributor
Contributor

HI,

Thanks,

0 Kudos
kpc
Contributor
Contributor

Hi Elazar

I've been experimenting with vmkfstools exports, it's defiantely the way forward as I can produce a backup for a 10GB linux VM which uses about 3.5GB of that 10GB in about 90 seconds to another datastore. I copy all my ESX backups to an NFS share, here's where the problem is at for me, the transfer speed directly to an NFS share is only about 1MB/s, it should be around 20MB/s. It doesn't matter if I do an export straight to the NFS share or do a CP it's still the same slow speed.

I think a few others in this thread had the same problem, not only with NFS but also with vifs. I could just copy the whole VM over once the snapshot is taken but then thats not using the vmkfstools export function.

One way round I've found is to do an export to another datastore and then scp that to another server's local disk or NFS

1) vmkfstools -d 2gbsparse -i /vmfs/volumes/datastore1/myvm/myvm.vmx /vmfs/volumes/datastore2/myvm/myvm.vmx

2) scp -r /vmfs/volumes/datastore2/myvm root@192.168.0.1:/backup

Using this method I've cut down the backup time from 15 minutes to 6 minutes! About 60% faster, that's a huge amount if you're going to be backing up around 50 VM's to the same NFS share on a nightly basis. Would be slightly faster also if the NFS share on the ESXi server gave the same speed.

0 Kudos