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)
Reply
0 Kudos
522 Replies
nsabinske
Enthusiast
Enthusiast

Well, it makes me feel a little better then that I'm not the only one Smiley Happy

I saw a post on the Powershell blog about the community extensions including a file copying command so I'm thinking I'll give that a shot once I get home (must admit, I'm doing this at home... at work Im spoiled with lots of infrastructure and VCB).

I just have this feeling that going through the VI API is throttled in some way...

Reply
0 Kudos
kchawk
Contributor
Contributor

I thought it was just my setup, linux --> smb mount --> usb external drive. I kick off the jobs 6:30pm and let them run, also I have the script tar gz after the copy then delete.

Reply
0 Kudos
kpc
Contributor
Contributor

Is the USB drive connected to the ESXi server? I'd like to do the same but with an nfs share to a linux server and just cp the files there but can't seem to mount the share without making it a vmfs datastore

Reply
0 Kudos
kchawk
Contributor
Contributor

the usb drive is on a windows box. I am going to move the drive to my linux pc running the script to take smb out of the picture.

Reply
0 Kudos
Nathan_Pease
Contributor
Contributor

I have a NFS share mounted on a linux host as a datastore, but I don't see a mount point when I ssh to my esxi server.

I am getting about 1GB per minute when backing up using SCP from linux host.

Reply
0 Kudos
Nathan_Pease
Contributor
Contributor

My script seems to be working great. I have it taking snapshots of all my VM's every night and backing up the entire VM image once a week.

My script depends on authorized keys for SCP. If the ESXi server is rebooted, the /.ssh directory goes away. I was able to get around this by copying the .ssh directory to datastore1 and then putting the following line in /etc/rc.local

#copy ssh authorized keys back to root

cp /vmfs/volumes/datastore1/.ssh/ /.ssh -R

Reply
0 Kudos
kpc
Contributor
Contributor

That's a good solution to use SSH authentication keys, I'm planning on using it to not only get round the speed problem but also to get round having to identify the datasource when you use vifs. That way I can use vmware-cmd -l to identify the VM's. On one of my servers I've got 4 datasources!

Reply
0 Kudos
agomezp
Enthusiast
Enthusiast

good days, create a php script to backup my virtual machines, I work well (I have esxi 3.5), I hope they like my serve.

Message was edited by: agomezp

I update the php script, please check the last post in the Thread

Reply
0 Kudos
kchawk
Contributor
Contributor

I have added remove only created snapshot and tar. the script sanbe submitted had it just didn't add it until l8r.

Reply
0 Kudos
Shanew1
Contributor
Contributor

Are there any additional steps that need to be taken on the ESXi server for the Perl script to work? When I run the script I get a server login error, but I can use the same credentials to login via the VI client or WinSCP. Any ideas?

Reply
0 Kudos
kchawk
Contributor
Contributor

There wasn't anything else I needed to do. Do you have any special chars in the username or pass?

Reply
0 Kudos
kchawk
Contributor
Contributor

There wasn't anything else I needed to do. Do you have any special chars in the username or pass?

Reply
0 Kudos
Shanew1
Contributor
Contributor

Yes, there is an @ in the password. Will that cause a problem?

Reply
0 Kudos
kchawk
Contributor
Contributor

I don't think @ should be an issue. Try and run this from cli - /<pathtorcli>/vmware-cmd -H <hostname or ip> -U <username> -P <password> -l and see what it returns.

Reply
0 Kudos
Shanew1
Contributor
Contributor

The command returned a list of the test VMs on the server.

/vmfs/volumes/48ed0668-b9b66ea7-0b67-0017085ca40f/Test Backup2/Test Backup2.vmx

/vmfs/volumes/48ed0668-b9b66ea7-0b67-0017085ca40f/Test Backup1/Test Backup1.vmx

Reply
0 Kudos
kchawk
Contributor
Contributor

Sorry I didn't totally read the your first question. Using the perl script ESXi-Backup.pl the @ may cause an issue.

Someone else may need to verify but I think the @ is an array symbol, which could be an issue.

Reply
0 Kudos
SteveH1850
Contributor
Contributor

Hi sanbe,

Love the script, was having an issue, but realized it was my own stupidity that caused it.

thanks,

-Steve

Reply
0 Kudos
agomezp
Enthusiast
Enthusiast

good days, create a php script to backup my virtual machines, I work well (I have esxi 3.5), I hope they like my serve.

Reply
0 Kudos
kyle7526
Contributor
Contributor

I need help... I ran the script and it runs and it backs up to my usb drive. But when I try to copy the snapshots to a new server and try to open them I get a error that a file is missing? What am I missing? Any help would be great.

Reply
0 Kudos
agomezp
Enthusiast
Enthusiast

When you create a snapshot on a VM, the VMX file is updated, the properties "scsi0:0.fileName" and similars change the vmdk file is changed (<vm>-000001.vmdk), this is the error, you can edit the .vmx file and replace the reference to .vmdk file for the correct name.

For example:

.vmx file before the snapshot

scsi0.present = "true"

scsi0.sharedBus = "none"

scsi0.virtualDev = "lsilogic"

memsize = "132"

scsi0:0.present = "true"

scsi0:0.fileName = "pfsense.vmdk"

scsi0:0.deviceType = "scsi-hardDisk"

.vmx file after the snapshot

scsi0.present = "true"

scsi0.sharedBus = "none"

scsi0.virtualDev = "lsilogic"

memsize = "132"

scsi0:0.present = "true"

scsi0:0.fileName = "pfsense-000001.vmdk"

scsi0:0.deviceType = "scsi-hardDisk"

ide0:0.present = "true"

replace pfsense-000001.vmdk for pfsense.vmdk and start your server.

please check the script "[m-1074619^14706]" in my last post, this fix the problem

Message was edited by: agomezp

The sequence for make a backup ( by Dave.Mishchenko ) is :

1) Copy the VMX file

2) Take a snapshot

3) copy the VMDK

4) Remove the snapshot.

Reply
0 Kudos