Thursday, October 30, 2008

VCB basic usage - VM restore with vcbRestore

The last question remains - how to restore the fully backuped virtual machine as we made it in the previous article? The virtual machine is stored at the NFS server and we need to get it back to the ESX host. There are many possible scenarios to do it - e.g., the original machine is corrupted and you have to restore it from backup. Or you don't have VirtualCenter Server available and you would like to deploy a virtual machine like from template without template feature.

Virtual machine full backup performed with vcbMouter command is defined with a specific catalog file which contains summary of backup. The catalog file contains definitions of virtual machine's:
  • display name
  • name of datastore
  • folder path
  • resource pool
Let's inspect one of such catalog files:
version= esx-3.0
state= poweredOn
display_name= "nas-openfiler"
uuid= "564da78f-f2fc-484f-4d92-24238e486380"
disk.scsi0:0.filename= "scsi0-0-0-nas-openfiler.vmdk"
disk.scsi0:0.diskname= "[storage1] nas-openfiler/nas-openfiler.vmdk"
config.vmx= "[storage1] nas-openfiler/nas-openfiler.vmx"
host= vmware.dom.tld
timestamp= "Sun Oct 12 01:37:12 2008"
config.suspenddir= "[storage1] nas-openfiler"
config.snapshotdir= "[storage1] nas-openfiler"
config.file0= "nas-openfiler.vmsd"
config.file1= "nas-openfiler-cf281ca9.vmss"
config.file2= "nas-openfiler.vmxf"
config.file3= "nas-openfiler.nvram"
config.logdir= "[storage1] nas-openfiler"
config.log0= "vmware-1.log"
config.log1= "vmware.log"
folderpath= "/ha-folder-root/ha-datacenter/vm"
resourcepool= "/ha-folder-root/ha-datacenter/host/vmware.dom.tld/Resources"
Now, what can we say about the backuped virtual machine?
  • it is visible as nas-openfiler in VI client (the display name is nas-openfiler)
  • it is stored at the [storage1] datastore in the nas-openfiler directory
  • it belongs to the vm folder in the VirtualCenter folder hierarchy
  • it is running at vmware.dom.tld ESX host
As you can see, everything around the virtual machine is stored inside the ""[storage1] nas-openfiler" directory. The datastore name is a symbolic name of datastore. You can check it via VI client in storage configuration tab. Or you list the contents of the /vmfs/volumes directory.

Let's suppose, we want to create identical machine like "nas-openfiler" but we want to restore it to a different datastore and directory, e.g. "[storage2] nas-openfiler2", and we want to call it "nas-openfiler2". To do it, we need to change selected parameters in the catalog file:
version= esx-3.0
state= poweredOn
display_name= "nas-openfiler2"
uuid= "564da78f-f2fc-484f-4d92-24238e486380"
disk.scsi0:0.filename= "scsi0-0-0-nas-openfiler.vmdk"
disk.scsi0:0.diskname= "[storage2] nas-openfiler2/nas-openfiler.vmdk"
config.vmx= "[storage2] nas-openfiler2/nas-openfiler.vmx"
host= vmware.dom.tld
timestamp= "Sun Oct 12 01:37:12 2008"
config.suspenddir= "[storage2] nas-openfiler2"
config.snapshotdir= "[storage2] nas-openfiler2"
config.file0= "nas-openfiler.vmsd"
config.file1= "nas-openfiler-cf281ca9.vmss"
config.file2= "nas-openfiler.vmxf"
config.file3= "nas-openfiler.nvram"
config.logdir= "[storage2] nas-openfiler2"
config.log0= "vmware-1.log"
config.log1= "vmware.log"
folderpath= "/ha-folder-root/ha-datacenter/vm"
resourcepool= "/ha-folder-root/ha-datacenter/host/vmware.dom.tld/Resources"
It is recommended to backup the original catalog file somewhere. Try to compare them and to notice the changes.
The last step is we need to perform restore operation with the vcbRestore command. Let's our full backup of virtual machine is in the directory /backup/nas-openfiler. The directory can be local directory or mounted from the NFS server. The original catalog file is catalog and modified one catalog.new. Let's go to restore the machine according to new catalog:
vcbRestore -s /backup/nas-openfiler -a /backup/nas-openfiler/catalog.new
The -s parameter specifies the source directory where the backup is stored and -a parameter specifies use this particular catalog file. If everything is working the command should produce next output:
[2008-10-17 11:00:21.644 'App' 3076444992 info]
Current working directory: /backup/nas-openfiler2
Converting "/vmfs/volumes/storage2/nas-openfiler2/nas-openfiler.vmdk" (VMFS (flat)):
0%=====================50%=====================100%
**************************************************
The machine was restored and you can see it in VI client interface. Or you can check it from the service console of ESX host:
vmware-cmd -l | grep nas-openfiler2
It should print something like this:
/vmfs/volumes/483c.../nas-openfiler2/nas-openfiler.vmx
The new virtual machine nas-openfiler2 can be powered on now. It is identical with the original one by the contents - both machines are the same, but they have different datastore. Final customization is for another article.

1 comment:

Anonymous said...

I do not have virtualcenter but only an esx 3.5 server. I am able to run my backups with vcbmounter and get them on tape. But after I try to restore my backup to the esx box, I continue to recieve: Could not find host vmserver.blah on this VirtualCenter instance when running vcbrestore.