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
tractng
Enthusiast
Enthusiast

kpc,

Is the vmkfstools part of the free ESXi ?:_|

Tnt

0 Kudos
kpc
Contributor
Contributor

Tnt

Yes, you'll find that ESXi has a few of the commands that ESX has, just different ways of running them. Check out the vimsh guide from xrtavirt.com for more info

0 Kudos
elazar
Enthusiast
Enthusiast

Thats basically what I do. I have a PowerEdge 1800 at home running ESXi, it has a PERC 6i with 2 WD 640's in a RAID 1 as my primary datastore, and 2 Seagate 200's attached to the onboard controller as backup datastores. I backup to either 200GB drive and then copy the the VMX and VMDK's from it via NFS(WSfU) to a USB hard disk, speed isnt that bad, but I could definitely do better. I would think that SCP is slower because of the encryption, Ill have to check it out though. As far as disk size vs VMDK size, 2GB sparse creates up to 2GB VMDK files which should be around the amount of space used on the virtual disk. So, a 20GB Linux VM which is only consuming 2GB, vmkfstools will create several VMDKs which in total will equal roughly 2GB. From what I have read, 2gbsparse is the most portable when moving the files to other file system formats, i.e. FAT/NTFS/EXTn etc...

elazar

0 Kudos
sm0kescreen
Contributor
Contributor

Elazar,

I have setup a NFS share using Ubuntu server. I can mount the share in ESXi but I cannot access any of the files. I get a permission denied error. This is my first NFS share on linux. I was able to get the share and permissions to work using Windows For Unix services. I made sure the user UIDs match on both servers. What else do I need to do? Let me know if I can provide you with any additional info.

My goal is to use plink from the Ubuntu box to copy the VM Guests to the NFS share.

Thanks in advance!

Will

0 Kudos
sm0kescreen
Contributor
Contributor

Nathan,

I have setup NFS using Ubuntu Server. I have mounted the NFS share on the ESXi server but when I try to access the NFS mount on the ESXi server I get a permission denied error. My goal is to use ssh to copy the VM guest config files to the NFS share. I am newer to NFS so I used the ubuntu NFS guide to help me with the setup but I guess I am not understanding how the permissions work. Do I need to use the root user? I would rather not use the root user if possible. I have created matching user/uids on both servers. I have created matching groups on both servers and made the users a member of this group. I have changed the owner and permissions on my NFS share.

Thanks in advance!

Will

0 Kudos
xAyiDe
Enthusiast
Enthusiast

I would rather see some sort of script doing the "Export command" that is found in VC. This makes the import from a backupshare and/or usb-disk a lot easier. It exports the whoie Vm to a readymade package that is VERY easy to manage and reimport to ESXi.

0 Kudos
amstim
Contributor
Contributor

I've been strugling with ESXi back lately too.

I've got around 600gb of thick disks to backup every few months as a disaster recovery. Currently the main datastore is on a RAID 1 using 1TB drives so we can backup by pulling a drive, however i don't like messing with the array if I don't have too. Not to mention if we need to move to a RAID 10 for speed reasons we would have to pull 2 drives....dicey if you get it wrong at that point too.

We use file level backups from the servers as the daily backups. Using vifs.pl for the image level backup is crazy go nuts slow. I don't want to use SSH as it's not officially supported. If VMware decided to turn off SSH access in later release my backup system would be useless.

My latest attempt was to use vifs.pl to copy from datastore1 to datastore2 this was all well and good copying super fast as you would expect from SATA to SATA. Then it just stopped after about 5gig of the first big file. Datastore2 crashes out and goes offline. I can reproduce using the GUI datastore browser. the HD access light on the datastore2 is stuck on 100%.

Anyone else having this issue? Sure would be nice to copy at SATA speeds to a secondary datastore. If the second datastore was a simple RAID 1 you could pull a drive and take it offsite. Then just replace the pulled drive with a spare and let it rebuild. I might just use a single drive in a hot swap bay, if you don't mind shutting down the ESXi server everytime to get it to recognize the inserted disk. (no hot plug! grrrr....)

I suppose with this system your backup would be on a VMFS file system but chances are if you have to use the backup it would be on a ESXi server anyhow. Guess if it were on NTFS or simalar you could use VMConverter and bring it up on VM Server or even Workstation... this is not an issue for me though.

The error is occuring on my test system using 2 single raptor 76gigs on a Promise FastTrak S150 TX2plus, i've not tried on the production system.

0 Kudos
xAyiDe
Enthusiast
Enthusiast

No my intentions with the Export-verions of the backupprocedure would be to be able to have it on External disks and such since I use ESXi at home. At work we do use ESX 3.5 not ESXi and we do use vRanger there. Any other solution would be unfit for backup of such huge amounts of data (9 TB in total on VMFS). But for home use the export would be a better alternative since I would like to move the backups out od the dangerzone of having them online on the productionserver. And having them on USB using NTFS would be a benefitt if going from an empty ESXi server to a full production system in no time while having the crashed server intact to maybe save some extra data or fix it later on while having servers already running on replacement.

0 Kudos
luisfjv
Contributor
Contributor

Hi

If I use your script, how can I do a complete restore if my ESXi Server falls??

Thanks

0 Kudos
kpc
Contributor
Contributor

Hi Luis

1) Re-install the ESXi software

2) Re-register your vmdk files from your backups by copying them to your datastore, browsing the datastores through the VI client and adding them to the Inventory.

A little vague but should give you the idea.

0 Kudos
MRLewis52
Contributor
Contributor

How do you actually run this script once the changes are made?

0 Kudos
khaliss
Contributor
Contributor

Hi Sanbe,

Thank you for the awesome script, after an hour or two, I was able to modify it and got it to work in my environment. The next thing I want to try is to have my ESXi server directly dump the backup files to another datastore (a second NAS volume in my case) instead of dumping it to a windows drive. How do I modify the script ($Destpath variable?) to be able to accomplish this? Should the backup speed increase if the ESXi server is backing up directly to another datastore volume?

Thanks in advance.

0 Kudos
Dave_Mishchenko
Immortal
Immortal

You may also want to modify the script to run vicfg-cfgbackup.pl from the RCLI to backup the configuration of ESXi itself. Then your restore process would be

1) re-install ESXi.

2) restore ESXi config backup (reboot)

3) restore VM data files.

Backing up the config of ESXi will save you having to setup any network / storage configuration that you made post install.

0 Kudos
luisfjv
Contributor
Contributor

Thank you Dave.

Where i made a mistake in this proccess?

1.- I made a backup of my virtual machine with the sanbe's script. I have a folder called "SERVERX" with all files (.vmdk, .vmx, etc).

2.- I made a backup of my ESXi configuration, with vicfg-cfgbackup.pl

3.- Change the hard disk of my server, with a new one with same features.

4.- Installed ESXi on the new disk.

5.- Restored the ESXi config backup. Reboot. All the virtual machines appear as "Unknown (inaccessible)".

6.- Uploaded the folder "SERVERX" (is the same name than de original folder on the original ESXi server) by the datastore browser on Vmware Infraestructure Client.

7.- The virtual machine still appears like "Unknown"

What is wrong?

Thank you so much

0 Kudos
mfoster11
Contributor
Contributor

Because you backed up to a folder called serverx, that does not mean that was the original location of the files for the VM.

If you originally had them in the root they need to back to the root and not in the serverx folder, so upload them without the serverx folder.

Think that makes sense Smiley Happy

Been reading this topic for a while to sort my own backup solution for 2 esxi servers, the original script has helped me solve alot of issues so thanks to the creator.

Has anyone got a script that will stop a VM move it to another esxi server including the files to the other esxi datastore then start it again ?

0 Kudos
luisfjv
Contributor
Contributor

Thanks for answering...

In fact, the files on the original ESXi server are on a folder with the same name, "serverx".

The "backup" ESXi server has the same datastore name, with the same folders structure, but the VM still appears as "Unknown (inaccessible)"

Any idea?

Message was edited by: luisfjv

Ups... I forget to do the "Add to inventory" on the .vmx file when I finished to put de folder on the backup ESXi Server. Now is ok

0 Kudos
khaliss
Contributor
Contributor

Nevermind, I found the options under vifs.pl script. using --copy command instead of --get will let you save to another datastore listed under your ESXi server instead of the windows machine that is calling the scripts. I've modified the script also to backup from the multiple datastore sources.... works pretty well now for our environment.

Observed backup speeds:

source: remote NFS datastore A ; destination: remote NFS datastore B = around 30MBits/sec average

source: local SCSI datastore; destination: remote NFS datastore = around 100-120Mbits/sec

Thanks again Sanbe

0 Kudos
amstim
Contributor
Contributor

Well good to hear it can work. When I try it i get the error i mentioned above.... I will try another IO controller!

0 Kudos
Dave_Mishchenko
Immortal
Immortal

If you're coping a file to a datastore then it's much better to use the vmkfstools command as it is specifically designed to handle this.

0 Kudos
luisfjv
Contributor
Contributor

Hi khaliss.

Can you upload your new script that copy vms betweend datastores, or maybe write how to modify the original sanbe's script?

Thanks

0 Kudos