Aug 30, 2011

How To Backup VMware Data Recovery To Tape in Windows

A lot of you out there are VMware admins like me right? How many of you know about VMware's really awesome backup appliance called VMware Data Recovery? How many of you know that it backs up full VM's directly from within vSphere, and stores them using  deduplication? Now answer me how many of you don't use it because it only backs up to disk, and not to tape?

I'm sure there are quite a few of you out there still using VCB, or something similar to backup full VMs, as well as send them offsite using tape because you can't get that with VMware Data Recovery. Hell, some of you probably use both. VMware Data Recovery for fast restores, and VCB to get offsite. Well, now you can stop using both, and just use VMware Data Recovery.

Using some Linux scripting skills and some WinSCP scripting skills in Windows, we can easily snap a backup of your VMware Data Recovery backups and wisk them off to tape.

Here's what you do:

  • On you VMware Data Recovery Server create a new /etc/crontab file using your favorite textvmwaredr editor. I like nano. For example:

                #nano /etc/crontab

  • Paste in the following:

                # run-parts
               01 * * * * root run-parts /etc/cron.hourly
               02 4 * * * root run-parts /etc/cron.daily
               22 4 * * 0 root run-parts /etc/cron.weekly
               42 4 1 * * root run-parts /etc/cron.monthly

               # Weekly VMware Tarball
               0 5 * * 0 root  /root/vmwareback.sh


  • Restart the Cron service:

                #/etc/init.d/crond restart

  • Create a script in /root called vmwareback.sh
  • Paste in the following:

               #!/bin/sh
               cd /SCSI-0\:1/
               tar -czvf VMwareDR-$(date +%m%d%y).tgz VMwareDataRecovery/

  • Make the script executable:

               #chmod +x vmwareback.sh

The above options creates a weekly tarball of the /SCSI-0:1/VMwareDataRecovery directory with the data appended to it every Monday at 5:00am. I'll let you Google how to change the date and time options for Cron on your own. I do mine on Monday because VMware Data recovery runs all weekend, and I want to get the weekend's backups off site by Wednesday.

Now that is done, download and install WinSCP on your Windows backup server.

Hint: NTBackup in Windows 2003 and below has the ability to backup to tape. If all you need to do it backup your VMware environment, this may be a completely free solution for you.

  • Once WinSCP is installed, create a folder for your scripts, and place to store the tarball we created in the previous steps. I put mine in E:\vmware. To keep things simple, I copied my WinSCP.exe program from C:\Program Files (x86)\WinSCP to E:\vmware.
  • Create two batch files. One called VMware.cmd and the other called WinSCP.cmd.
  • In VMware.cmd paste the following:

               option batch on
               option confirm off
               open root:password@IP_OF_VMDR
               cd /SCSI-0:1/
               option transfer binary
               get *.tgz
               rm *.tgz
               close
               exit

  • In WinSCP.cmd paste the following:

               e:
               cd e:\vmware
               winscp.exe /console /script=e:\vmware\vmware.cmd

  • Now add a scheduled task in WIndows to run your WinSCP.cmd script once a week one day after your Cron job on the VMware Data Recovery server runs and it will automatically go out, grab the tarball to e:\vmware then delete it from the server.

Once your tarball is on your Windows backup server, you can then back it up to tape! To restore it later, all you have to do is setup a new VMware Data Recovery Server. Create a LUN on your SAN, and format it with ext3, then copy your tarball to the LUN. Extract the tarball with the following:

tar –xzvf *.tgz

Which should create a VMwareDataRecovery folder on the root of that LUN. Now mount that LUN to VMware Data Recovery. VMware Data Recovery should now rescan it, and be able to see your old backups.

If you're a corporate user that's interested in backing up an entire network, you can take a look at some of the solutions for VMware at Dell.com that include data center services.

Did this work for you? Did it not? Do you do it a different way? Let us know in the comments!

 

 

Enhanced by Zemanta



Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | stopping spam