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
kpc
Contributor
Contributor

Writing the vmkfs export to a local datastore is the only way I've managed to increase the speed of my backups (by about a third), but remember storing your backups on local datastores is not recommended!! After I export to the datastore I then SCP (pull) the files to my NFS share via my RCLI server. Not exactly how I wanted to do it but if you want to use NFS to store the backups it was the only way I could get round the really slow write speed that ESXi was giving me when exporting directly.

0 Kudos
amstim
Contributor
Contributor

How about this.

1. Copy from your production datastore mine are DAS (SAN, DAS, whatever) to a ESATA drive that is attached to the ESXi server. In it's current form the script snapshots them all and then copys. My current plan is to modify the script to shutdown a VM and Copy it, then repeat for each VM this should reduce downtime and I get full non "crash backups". My VMs being down for a few mins in turn every month in the middle of the night is not a problem.

2. Then pull that ESATA and install another.

That way you get fast DAS to DAS write speed and off site back for your image level backups.

So far i've not been able to get ESXi to detect hot swaps like this. You can remove a drive from ESATA just fine when there is no activity on it. But when I install another and try to rescan it does not show up for some reason. Not to mention the bug I am encountering that I posted before. I am hoping the swapping issue and the bug are somehow related to the Promise SATA 150 TX2 Plus I am using in my test system.

Khaliss you are copying from DAS to NFS and getting 100-120 thats pretty good. I get really fast speeds DAS to DAS.......then it blows up. :_|

0 Kudos
amstim
Contributor
Contributor

KPC whats wrong with DAS? Why is it not reccomended?

0 Kudos
khaliss
Contributor
Contributor

Okay, I am attaching a modified version of Sanbe's original script. I typed down some notes in the first few lines to explain what additional variables I've added. This script will copy from one datastore to another under your ESXi server, and as it was originally designed, I am a big fan of automating everything so putting all stuff on one script for me is the way to go. I do not like manually plugging in stuff or typing down commands every now and then (hello "Scheduled Tasks").

My environment only uses static datastores (ie. local SCSi/Raid, DAS, iSCSI, or NFS volumes). I do not use removable storage.

KPC, I agree with you that storing backups on a local datastore is not recommended (what is the point of a backup?), but locally mapped remote datastores (NFS, iSCSI) are exceptions.

0 Kudos
kpc
Contributor
Contributor

HI Amstim, there's nothing technically wrong with keeping your backups on the local datastore or even a disk inside the server however you will be keeping your VM's and backups on the same server, what if something happened to that server you not only lose all your VM's but also the backups to. At the end of the day it all depends on what kind of shop you are and how valuable your data is - I work for the government, so data needs to be secure and resiliant.

Additionally the extra space you take for the backups on DAS could be used for VM's, again this will also depend on what kind of hardware your using. At the moment I'm running with 10 disk Dell 2900's, a mix of raid 1's and 5's, there's no way I'd want to lose any of the drives over to storing backups. Again if your a small shop and have a spare disk in your server and not many other servers available then using a single disk is an option. Depends on how much money you have to spend!

0 Kudos
kpc
Contributor
Contributor

Hi Khaliss

Have you managed to get round the slow write performance for NFS volumes? I tried a number of different settings and tweaks but still couldn't write faster than 10MB/s.

You may want to look into using the vmkfstools command and do an export rather than copy the whole VM with vifs, it should cut your backup time in half, well it did mine!

Cheers

0 Kudos
khaliss
Contributor
Contributor

30Mbits/sec is the maximum speed I get from copying from one NFS datastore to another NFS datastore using vifs. That is really slow compared to copying from the server's local/DAS volume to a remote NFS datastore (this is my backup volume)... all ethernet links are gigabit (mix copper/fiber). But if you think about it, it is only logical since:

A) NFS to NFS copying involves 2 "traffic lights". Goes like this:

NFS source ---> travel over ethernet --> ESXi server ---> travel over ethernet -


> NFS destination

B) local/DAS volume to NFS copying involves only one "traffic light":

ESXi server ---> travel over ethernet ---> NFS destination

Factor in throughput of local storage which is what? 3GB/sec (for SATA) raw speed versus Ethernet's 1GB/sec (300MB/s real world max)

KPC, I would appreciate if you can you provide a basic walkthrough on how you accomplish vmkfstools to do exports/backups via scripts? Thanks

0 Kudos
amstim
Contributor
Contributor

Hi KPC,

I was hoping to use ESATA removable storage or a spare internal hot swap bay connected to a non raid SATA controller. That way it can be taken off site. I agree that DAS is silly for backup if you don't take it off site or at least out of the machine. I was proposing DAS only for the fast copy's and then swapping it out.

I guess with your 10 drive setup it would be hard to stuff that in a single chassis.

0 Kudos
kpc
Contributor
Contributor

Hi Khaliss

Tomorrow I'll post my script, it's all in Linux shell and runs from a VM that has the RCLI installed, but is easy to follow, the basic steps are:

1) Create temp backup directory on datastore which hosts the VM you are backing up e.g. mkdir /vmfs/volumes/datastore1/myvm/backup

2) Run the export vmkfstools -d 2gbsparse -i /vmfs/volumes/datastore1/myvm/myvm.vmdk /vmfs/volumes/datastore1/backup/myvm/myvm.vmdk (you could use any space on any datastore for this)

3) SCP the files back over to the NFS share on the RCLI server

4) Remove the temp backup directory rm -r /vmfs/volumes/datastore1/myvm/backup

On an ESXi server that I had 10 VM's on it reduced the backup time from 4 hours to 1 hour! If NFS was working at the speed it should I wouldn't have to do step 3 and that 1 hour would probably be cut to 40 minutes.

On the NFS speed issue try taking the same 1GB file for instance and note the time it takes to:

a) Copy from the ESXi local datastore to the NFS share

b) Copy from another linux/windows server to the NFS share

I run about 20 or so ESX Servers that all have the same mounted NFS share, I get perfect speed both write and read, however when I try the same thing on my ESXi servers speed is reduced by about 60%, it seems as ESXi uses busybox it mounts the NFS share differently. Definately a weird one.

0 Kudos
Johny009
Contributor
Contributor

Hi Sanbe...

I want to ask if your script works with ESX 3.0.1 Server

0 Kudos
khaliss
Contributor
Contributor

Thanks for sharing your method KPC, I will look into it once you've posted your script. I don't have a lot of VMs (only 2 ESXi servers, and perhaps a dozen VMs). Total backup time takes about 8 hours using the vifs scripts that was originally written by Sanbe. This is not that bad, since backups are only done nighttime (12 hours ideal limit). I would be desperate to find something faster if I had say 20 or more VMs to backup. I used SNMP graphic tools to analyze traffic usage on all our NAS/NFS servers.

0 Kudos
s1xth
VMware Employee
VMware Employee

Does anyone know if it possible to use another ESXi server as the backup destination instead of NFS/NAS location for this script? If this script cant do it I am just wondering if it is even possible to do this same concept to another ESXi server. It would be great to have a server on 'standby' with the previous nights backups ready to go in case of a server failure etc.

Thanks everyone!

http://www.virtualizationimpact.com http://www.handsonvirtualization.com Twitter: @jfranconi
0 Kudos
khaliss
Contributor
Contributor

Ideally, I would setup a dedicated NFS server (FreeNAS is free and it's what I use) to be sort of your backup repository in between ESXi servers. I have two ESXi servers in my environment, both for loadbalancing and failover roles. I have one NFS server (and share) that both the ESXi servers are mapped to so they can share this volume not just for backup, but also for hosting live VMs. If you don't have a spare PC you can convert into a NAS server, either build one, or you can virtualize an NFS server (using FreeNAS) on one of your ESX servers to act as your "central repository", this is assuming you have tons of capacity. I dont recommend going this route, as there might be a significant performance hit.

And yes, it is entirely possible to use the script on another server, either you can:

A.) modify the script heavily to include another $url variable and of course supporting lines of code to include the 2nd server to the routine.

B.) simplier route is to copy the script and rename it to match your second server (just change the $url variable to point to your second ESXi server), then include this to your scheduled task.

0 Kudos
fahrer
Contributor
Contributor

Hi,

i'm currently planning to create a little appliance for ESXi backup. any of you guys intrested in making that to a real appliance? I could need some help with scripting and especially in creating a nice web frontend.

I planing to implement backuping up to: to smb/nfs shares (using the appliance as a proxy), to vmfs (nfs for example), to antoher ESXi host.

A scheduler, hot and cold backups, compression, excluding disks, recovery function and some other stuff.

0 Kudos
khaliss
Contributor
Contributor

To NFS and scripting gurus out there... anyone know how to set NFS attributes/permissions so that after calling the vifs --copy command, the resulting copied file(s) to the destination will have all attributes checked? Backup files created by sanbe's script has only "owner" RX attribute set (see fig1.jpg), but in order for me to move the backup files around the Windows Environment, I need "Other" RX attributes also checked (See fig2.jpg). This can be manually changed using Windows, but I would like the script to automatically change the attributes of the backup files so using windows-based scripts to move the files around will also work. If the vifs.pl script can't be set to do this, is there another script or software that can do the same function?

Would really appreciate it if anyone can help out. Thanks!

0 Kudos
khaliss
Contributor
Contributor

I would help if I knew a lot more about PL scripting, etc... as it stands I am a newb and the only thing I've managed to do was modify someone else's script to work for my environment. But if an appliance can be made to be able to do this kind of thing, that would be great and will be extremely helpful to the vmware community! Good luck Smiley Happy

0 Kudos
s1xth
VMware Employee
VMware Employee

I agree with the poster above, I am not much of a scripting/programming person myself, but it should would be great if someone could make such a appliance it would be awesome!

http://www.virtualizationimpact.com http://www.handsonvirtualization.com Twitter: @jfranconi
0 Kudos
crazyx
Contributor
Contributor

HI fahrer,

I am not a developer, but a very good tester!

That's what I can offer!

bye

0 Kudos
fahrer
Contributor
Contributor

yes testing will also be very important Smiley Happy

creating such an appliance will be a whole lot of work... i will definitly start to write a script for esxi backup (since i need one myself). so maybe some volunteers will start helping in time Smiley Happy

I keep you up to date with the progress.

0 Kudos
kpc
Contributor
Contributor

Why build your own virtual appliance when VMware already provides you with one with the RCLI already installed...It's a debain build if I remember rightly.

0 Kudos