VMware
12 Replies Last post: Jul 13, 2006 11:01 PM by TonioRoffo  

Best way to backup a VM posted: Jul 12, 2006 12:22 AM

Click to view stiff_bg's profile Novice 22 posts since
Apr 27, 2006
I am sorry if there is already a thread about this but I couldn't find it.

My question is simple:

I want to backup the ENTIRE vm in case of disk failiare or some serious software damage.

What is the best way?
1. Goast image?
2. Snapshot and copy the files to cd?
3. Some other way?

Re: Best way to backup a VM

1. Jul 12, 2006 12:31 AM in response to: stiff_bg
Click to view Liz's profile Virtuoso 3,321 posts since
Dec 2, 2004
k, depends a little IMHO on how you've set it up.

I tend to copy the directory for the guest onto dvd, or zip it and stick the zip on dvd.

if you have (s)DLT devices you can use, again, just make sure the vm isnt running at the time and blast the files to dlt

You could ghost it, but, IMHO the disk file is as good as.

Re: Best way to backup a VM

3. Jul 12, 2006 6:41 AM in response to: stiff_bg
Click to view KevinG's profile Guru 16,980 posts since
Jan 8, 2004
--------General Backup Information for virtual machines:-----------

The best way to back-up Virtual machines that require 24x7 uptime is to load a back-up agent in the virtual machine that will connect directly through your network to your back-up servers. This will allow you to completely back-up individual files on your virtual machines and recover files individually.

Your entire VMware server can also be backed up by shutting down all virtual machines and then backing up the VMware server and all virtual machine directories. This will give you a complete back-up set for your VMware Server environment from that point in time. However, restoring a virtual machine directory from such a backup will bring you back to that point in time and individual files in the virtual machine would not be restorable.

Another method involves backing up virtual machines by suspending and resuming a virtual machine. Suspending a virtual machine will put in a state in which backup software can gain exclusive access to the virtual machine files to complete its task. This can be done with a batch file with a line similar to the one below

vmware-cmd c:\vms\win2k\win2k.vmx suspend or vmware-cmd c:\vms\win2k\win2k.vmx stop

The backup of this virtual machine's directory would now be safe for a clean backup. After the backup job for the virtual machine is completed you would need to run a resume batch job to restart the virtual machine using a line as such

vmware-cmd c:\vms\win2k\win2k.vmx start

This line would resume your virtual machine into an active, operational state. Virtual machines backed up while they are shutdown may be restored to other servers besides the VMware server they were originally were housed. These commands may be used in pre/post job scripts that are normally available via the backup software being used. Veritas Backup Exec should have the capability to run pre/post batch jobs with scheduled backups.

Virtual machine directories should not be backed up on the VMware server host if they are in a running state. They should be either suspended or shutdown before proceeding to backup a virtual machine directory. This can cause virtual machines to hang and be unreachable. Open file agents loaded on the VMware server do not always work reliably when backing up open virtual disks that will be gigabytes in size.

Please test and document any backup schemes in advance before implementing them. This will help insure successful backup and restores may be completed by yourself and others and that the scheme fits your needs.

Batch file example:

The startup batch file should look the following example:
C:
cd "\Program Files\VMware\VMware Server"
call vmware-cmd <config file> start

NOTE: You may need to include the full path to vmware-cmd in your
batch file, if vmware-cmd is not part of the %PATH% environment variable.

Where <config file> is the path to the virtual machine .vmx file.
Example: c:\..\..\win2kpro.vmx

If your path contains a space, but the path in ""
Example "C:\Virtual Machines\xyz.vmx"

The shutdown batch file should look the following example:
C:
cd "\Program Files\VMware\VMware Server"
call vmware-cmd <config file> stop trysoft

NOTE: You may need to include the full path to vmware-cmd in your
batch file, if vmware-cmd is not part of the %PATH% environment variable.

Where <config file> is the path to the virtual machine .vmx file.
Example: c:\..\..\win2kpro.vmx

The suspend batch file should look the following example:
C:
cd "\Program Files\VMware\VMware Server"
call vmware-cmd <config file> suspend

NOTE: You may need to include the full path to vmware-cmd in your
batch file, if vmware-cmd is not part of the %PATH% environment variable.

Where <config file> is the path to the virtual machine .vmx file.
Example: c:\..\..\win2kpro.vmx

More information for scripting and the use of the vmware-cmd file may be viewed in the following PDF file in Appendix A:
http://www.vmware.com/support/developer/scripting-API/doc/Scripting_API.pdf

Re: Best way to backup a VM

4. Jul 12, 2006 6:44 AM in response to: stiff_bg
Click to view TonioRoffo's profile Hot Shot 248 posts since
Apr 21, 2005
Run backup just like you would do with a physical machine, and make a backup of your vmx files without the vmdk (disk) files - or better yet, with the disks when they are still empty!

When you lose everything, just restore the vmx files to the host, do a restore and you're good to go.

I use drive snapshot for sector based backup & restore - but beware the issues this can have with domain controllers...

Re: Best way to backup a VM

6. Jul 12, 2006 8:00 AM in response to: stiff_bg
Click to view RDPetruska's profile Guru 15,875 posts since
Jan 11, 2005
So a backup with goast for the data and then backup
the vmx file without the vmdk will work?

Than how will I do a restore?


1. Recreate a new VM using the backed up vmx file. (basically, just register the restored vmx file).
2. Launch the VM, run the ghost restore disc inside the guest, and restore your backup.

Re: Best way to backup a VM

8. Jul 12, 2006 12:21 PM in response to: KevinG
Click to view jcerroni's profile Enthusiast 20 posts since
Mar 24, 2006

This line would resume your virtual machine into an
active, operational state. Virtual machines backed up
while they are shutdown may be restored to other
servers besides the VMware server they were
originally were housed.

Just confirming the above quote. I thought VM's backed up while in a suspended state could NOT be restored to another server. Is that true?

Re: Best way to backup a VM

9. Jul 13, 2006 12:37 PM in response to: jcerroni
Click to view mwheeler1982's profile Enthusiast 115 posts since
Sep 16, 2005
Just confirming the above quote. I thought VM's
backed up while in a suspended state could NOT be
restored to another server. Is that true?

I just wanted to throw my "me too" in for an answer to this question!

Re: Best way to backup a VM

10. Jul 13, 2006 12:50 PM in response to: mwheeler1982
Click to view KevinG's profile Guru 16,980 posts since
Jan 8, 2004
The method of backing up virtual machines by suspending should be done only on the same VMware Server that the backup would be restored to. This is because the state of the virtual machine(s) (CPU registers, memory..etc are saved in the suspend file.

Restoring this backup to another VMware Server with a different host processor may not allow the virtual machine to start or could possibly cause the VM and/or guest OS to crash.

You may have success restoring the backup to another VMware Server, if the host processor is the same, but still is not recommended.

Re: Best way to backup a VM

11. Jul 13, 2006 12:52 PM in response to: KevinG
Click to view jcerroni's profile Enthusiast 20 posts since
Mar 24, 2006
Thanks, that's what I thought.

Re: Best way to backup a VM

12. Jul 13, 2006 11:01 PM in response to: jcerroni
Click to view TonioRoffo's profile Hot Shot 248 posts since
Apr 21, 2005
You can always throw away the "suspended" files but that would lead your machine to a dirty restart with possible AD/DB corruptions...

Decisions decisions!

I used to do backups on the host but switched to guest based backup now.

VMware Developer

SDKs, APIs, Videos, Learn and much more in the Developer community.

Learn More

Developer Sample Code

Increase your developer productivity with VMware API sample code.

Learn More

VMworld Sessions & Labs

Online access to the latest VMworld Sessions & Labs and online services.

Learn more

Purchase PSO Credits Online

Purchase credits to redeem training and consulting services online.

Buy Now

Community Hardware Software

View reported configurations or report your own.

Learn More

VMware vSphere

Come witness the next giant leap in virtualization.

Register Today

Communities