User Tools

Site Tools


Backup Vmware Server 1 and 2

Besides following instructions offered below, an extensive backup script can also be used to backup VMs. Many scripts exists, both OpenSource as well as commercially. VMSbackup seems like an opensource total solution for both Vmware Server 1 and 2.

Vmware Server 1

Vmware Server 2

To backup Virtual Machines from Vmware we need some tricks, because it is better so save a virtual machine in suspended mode instead of directly running.

My steps I am doing to backup am vm are es follows:

  1. Suspend running virtual Machine ( RunBeforeJob or ClientRunBeforeJob)
  2. Backup virtual Machine Folder
  3. Resume suspended virtual Machine ( RunAfterJob or ClientRunAfterJob)

Suspend a VM

We can easily suspend a vm through the console. Furthermore we can use the RunBeforeJob definition of bacula. The proper example for such a RunBeforeJob command is as follows.

 (Client)RunBeforeJob = "vmrun -T $HOST -u $USER -p $PASSWORD -h https://$HOST_IP:8333/sdk suspend \"[$DATASTORE] $VM_FOLDER/$VM.vmx\" "

Of course you have to modify the variables $HOST,$USER,$PASSWORD,$HOST_IP,$DATASTORE,$VM_FOLDER,$VM for your individual needs and specifications.

:!: For security reasons I personally advise you to create an own user like bacula_vmware with a password which has just the privileges to start, suspend and interact by console with a machine. It is not a MUST but it makes it even nicer.

Create a FileSet in which you specify the location of your *.vmdk's and *.vmx's (by default /var/lib/vmware/Virtual Machines/<server_name>/). The space CAN cause problem but with a \ before the space you can fix it ;-) .

Then we just have to tell bacula that after the job it should start the machine again.

(Client)RunAfterJob = "vmrun -T $HOST -u $USER -p $PASSWORD -h https://$HOST_IP:8333/sdk start \"[$DATASTORE] $VM_FOLDER/$VM.vmx\" "

Thats it, I think that for a free solution quite good and it works prettly well. I safe may virtual machines every sunday night.

application_specific_backups/vmwareserver.txt · Last modified: 2009/09/08 12:58 by olaf