views:

5667

answers:

6

What is the best way to backup VMWare Servers (1.0.x)? The virtual machines in question are our development environment, and run isololated from the main network (so you can't just copy data from virtual to real servers).

The image files are normally in use and locked when the server is running, so it is difficult to back these up with the machines running.

Currently: I manually pause the servers when I leave and have a scheduled task that runs at midnight to robocopy the images to a remote NAS.

Is there a better way to do this, ideally without having to remember to pause the virtual machines?

A: 

If I recall correctly, VMWare Server has a scripting interface, available via Perl or COM. You might be able to use that to automatically pause the VMs before running the backup.

If your backup software was shadow-copy aware, that might work, too.

Roger Lipscombe
+5  A: 

VMWare server includes the command line tool "vmware-cmd", which can be used to perform virtually any operation that can be performed through the console.

In this case you would simply add a "vmware-cmd susepend" to your script before starting your backup, and a "vmware-cmd start" after the backup is completed.

We use vmware-server as part of our build system to provide a known environment to run automated DB upgrades against, so we end up rolling back state as part of each build (driven by CruiseControl), and have found this interface to be rock solid.

Usage: /usr/bin/vmware-cmd <options> <vm-cfg-path> <vm-action> <arguments>
       /usr/bin/vmware-cmd -s <options> <server-action> <arguments>

  Options:
    Connection Options:
       -H <host>       specifies an alternative host (if set, -U and -P must also be set)
       -O <port>       specifies an alternative port
       -U <username>   specifies a user
       -P <password>   specifies a password
    General Options:
       -h More detailed help.
       -q Quiet. Minimal output
       -v Verbose.

  Server Operations:
    /usr/bin/vmware-cmd -l 
    /usr/bin/vmware-cmd -s register <config_file_path>
    /usr/bin/vmware-cmd -s unregister <config_file_path>
    /usr/bin/vmware-cmd -s getresource <variable>
    /usr/bin/vmware-cmd -s setresource <variable> <value>

  VM Operations:
    /usr/bin/vmware-cmd <cfg> getconnectedusers
    /usr/bin/vmware-cmd <cfg> getstate
    /usr/bin/vmware-cmd <cfg> start <powerop_mode>
    /usr/bin/vmware-cmd <cfg> stop <powerop_mode>
    /usr/bin/vmware-cmd <cfg> reset <powerop_mode>
    /usr/bin/vmware-cmd <cfg> suspend <powerop_mode>
    /usr/bin/vmware-cmd <cfg> setconfig <variable> <value>
    /usr/bin/vmware-cmd <cfg> getconfig <variable>
    /usr/bin/vmware-cmd <cfg> setguestinfo <variable> <value>
    /usr/bin/vmware-cmd <cfg> getguestinfo <variable>
    /usr/bin/vmware-cmd <cfg> getid
    /usr/bin/vmware-cmd <cfg> getpid
    /usr/bin/vmware-cmd <cfg> getproductinfo <prodinfo>
    /usr/bin/vmware-cmd <cfg> connectdevice <device_name>
    /usr/bin/vmware-cmd <cfg> disconnectdevice <device_name>
    /usr/bin/vmware-cmd <cfg> getconfigfile
    /usr/bin/vmware-cmd <cfg> getheartbeat
    /usr/bin/vmware-cmd <cfg> getuptime
    /usr/bin/vmware-cmd <cfg> getremoteconnections
    /usr/bin/vmware-cmd <cfg> gettoolslastactive
    /usr/bin/vmware-cmd <cfg> getresource <variable>
    /usr/bin/vmware-cmd <cfg> setresource <variable> <value>
    /usr/bin/vmware-cmd <cfg> setrunasuser <username> <password>
    /usr/bin/vmware-cmd <cfg> getrunasuser
    /usr/bin/vmware-cmd <cfg> getcapabilities
    /usr/bin/vmware-cmd <cfg> addredo <disk_device_name>
    /usr/bin/vmware-cmd <cfg> commit <disk_device_name> <level> <freeze> <wait>
    /usr/bin/vmware-cmd <cfg> answer
John Stauffer
A: 

There is a tool called (ahem) Hobocopy which will copy locked VM files. I would recommend taking a snapshot of the VM and then backing up the VMDK. Then merge the snapshot after the copy is complete.

seisyll
A: 

you can find scripts with google, while i read this, i think, maybe filesystem level snapshots can be useful?

+1  A: 

Worth looking at rsync? If only part of a large image file is changing then rsync might be the fastest way to copy any changes.

Martin Beckett
+1  A: 

I found an easy to follow guide for backing up VM's in vmware server 2 here: Backup VMware Server 2

MadCAt