The default VCB scripts do not enable backup of a select disk or disks attached to a VM - vcbMounter.exe will snapshot and backup all disks attached to a VM unless a disk is placed in "Independent" mode meaning it cannot be placed in snapshot mode.

 

In many situations you may have a VM with a system disk (say 10GB) and an application or data disk (say 50GB) - and you only want to do a full-image backup of the system disk to (and maybe an incremental of the data disk).

 

This has always frustrated me so I set out to write a script to enable me to export specific VMDKs only.

 

A description of the process follows.

 

Attached, you will find a vb script that I have written to perfrom the process from your VCB proxy server. The VBScript takes 2 arguments as shown below:

 

cscript.exe export_select_disks.vbs <FQDN_OF_VM> <COMMA-SEPARATED_LIST_SCSI_BUS_IDs_OF_DISKS_TO_BACKUP>

 

 

e.g.

cscript.exe *export_select_disks.vbs *DEVSQL01.domain.local scsi0.0,scsi0.1

 

 

You will need to modify the constants at the top of the script to suit your environment (default mount point, vcb proxy user and password, whether to delete any existing vcb snapshot for the VM etc).

 

 

Hope this helps someone!

 

 

(if you have trouble reading the below - see attached word doc)

 

 

====================================================

FULL IMAGE BACKUP OF INDIVIDUAL DISK USING VCB:

====================================================

 

NOTE: to create a usable script that implements the following process, will need to be able to feed in relevant command line args to CommVault "Pre-backup" script:

 

 

 

 

 

 

 

 

 

 

  • FQDN of VM to backup

  • COMMA-SEPARATED LIST oF SCSI ID/s oF DISK/s to export (while ignoring other disks)

 

Process is as follows:

 

1. GET "VmId" OF VM:

 

=> vcbVmName -h <vc_server> -u <vc_logon_account> -p <vc_password> -s ipaddr:<FQDN_or_IP_OF_VM>

e.g.

vcbVmName -h myvcserver.domain.local -u vcbproxyuser -p vcbproxypass -s ipaddr:vcbtest2.domain.local

 

Output (note VM ID in bold):

 

Found VM:

moref:vm-14168

name:VCBTEST2

uuid:5026fe86-c802-f99d-b1db-f3d6e9a5e732

ipaddr:10.96.64.136

 

2. CREATE SNAPSHOT (RETURNS SNAPSHOT ID FOR USE IN SUBSEQUENT COMMANDS):

 

 

SYNTAX: vcbSnapshot -h <vc_server> -u <vc_logon_account> -p <vc_password> -c <VmId> <SNAPSHOT_NAME>

 

=> vcbSnapshot -h myvcserver.domain.local -u vcbproxyuser -p vcbproxypass -c moref:vm-14168 VCB-BACKUP

 

 

Output (note snapshot ID in bold):

 

2007-10-03 19:06:27.901 'CreateSnapshot' 4316 info Creating snapshot

SsId:snapshot-14259

 

 

3. GET LIST OF DISKS IN SNAPSHOT (I.E. ENABLES IDENTIFICATION OF DISK/s TO EXPORT & BACK UP):

 

 

=> vcbSnapshot -h myvcserver.domain.local -u vcbproxyuser -p vcbproxypass -l moref:vm-14168 SsId:snapshot-14259

 

(NOTE: "ssid" and "vmid" values comes from output of previous commands)

 

 

Output (note SCSI IDs in bold):

 

 

scsi0.0:[DEVSANNET08] VCBTEST2/VCBTEST2_1.vmdk

scsi0.1:[DEVSANNET08] VCBTEST2/VCBTEST2.vmdk

vmx:[DEVSANNET08] VCBTEST2/VCBTEST2.vmx

logdir:[DEVSANNET08] VCBTEST2/

suspenddir:[DEVSANNET08] VCBTEST2/

config0:VCBTEST2.vmsd

config1:VCBTEST2.vmxf

config2:VCBTEST2.nvram

log0:vmware-7.log

log1:vmware-8.log

log2:vmware-9.log

log3:vmware-10.log

log4:vmware-5.log

log5:vmware-6.log

log6:vmware.log

 

 

4. EXPORT THE DESIRED VIRTUAL DISK/s (SCRIPT GETS DISK PATH FROM OUTPUT OF PREVIOUS COMMAND):

 

 

cd D:\mnt

md VCBTEST2.emapdev.net-CustomDiskBackup

 

 

SYNTAX: vcbExport -M 1 -d VCBTEST2_1.vmdk -s "blklst://<snapshot_id><VMDK_PATH>@<vc_servert>?<vc_user>/<vc_pass>"

 

 

NOTE: sytax must be precise!

 

E.G.:

=> vcbExport -M 1 -d D:\mnt\VCBTEST2_1.vmdk -s "blklst://snapshot-14259[DEVSANNET08] VCBTEST2/VCBTEST2_1.vmdk@lonman01.emap.net? vcbproxyuser/vcbproxypass"

 

 

Output (over SAN not NIC):

 

 

Converting "D:\mnt\VCBTEST2_1.vmdk" (compact file):

0%=====================50%=====================100%

**********************************************************************************

 

 

Does block-level export in consolidated format to a single .VMDK file.

Repeat for additional disks

 

 

5. POST-DISK-EXPORT COMMAND - COMMIT SNAPSHOT AS PER NORMAL vcbMounter POST-EXPORT PROCESS:

 

 

SYNTAX: vcbSnapshot -h <vc_server> -u <vc_logon_account> -p <vc_password> -d <VM_ID> <SNAPSHOT_ID>

 

 

E.G.

=> vcbSnapshot -h myvcserver.domain.local -u vcbproxyuser -p vcbproxypass -d moref:*vm-14168 SsId:snapshot-14259*

 

 

Then run commands to delete local temp directory holding previously exported vmdk's

 

 

6. *SAMPLE COMMAND LINE FOR COMMVAULT PREBACKUP SCRIPT:*_

 

 

SYNTAX: cscript.exe export_select_disks.vbs <VM_FQDN> <SCSI_ID1,SCSI_ID2,....>

 

 

E.G. (this is what we would specify in "Pre-scan" command line of our backup software (CommVault in our case)):

cscript.exe export_select_disks.vbs DEVSQL01.domain.local scsi0.0,scsi0.1

 

 

(this will back up VM disks SCSI(0:0) and SCSI(0:1) on the VM - each to a consolidated .vmdk file)

 

 

7. MOUNTING A DISK EXPORTED (BACKED UP) USING vcbExport (LOTS OF OPTIONS - THIS IS ONLY AN EG OF SYNTAX):

 

 

(Use for file extraction or as quick test of backup integrity)

 

SYNTAX: mountvm -cycleId -d <full_path_to_exported_disk_file> <directory_path_for_mount>

 

 

E.G.

=> mountvm -cycleId -d D:\mnt\DEVSQL01_DISK_SCSI_0.1.vmdk D:\mnt\temp

 

 

Unmount:

SYNTAX: mountvm -u <directory_path_for_mount>

=> mountvm -u D:\mnt\temp

 

 

8. HOW TO RESTORE A DISK EXPORTED (BACKED UP) USING vcbExport:

 

 

Provided "-M 1" option is used during vcbExport backup, then restore is simple process:

 

 

 

 

 

 

 

 

 

 

  • Copy the VMDK to a temp drive on the target ESX server

  • Import the vmdk file: vmkfstools -i <SOURCE_VMDK_THE_ONE_FROM_vcbExport> <DESTINATION_VMDK>
    (NOTE: This will expand the disk to it's original size!)

  • Now just add the virtual disk to either a new VM, or to original VM (at same SCSI BUS ID as per original disk you are replacing)

 

See attached files and comments in the VB Script file