cos11
Contributor
Contributor

can vco clone individual vmdk?

does anyone know if vco can clone a selection of vmdk disks instead of the whole virtual machine? If so does anyone know how?

thanks

0 Kudos
4 Replies
ChristianWehner
VMware Employee
VMware Employee

Hi,

there is a method called copyVirtualDisk_Task. You will find some information about here:

http://communities.vmware.com/message/1015081

I copyed it and wrote an untested vco script:

var mySourceDatacenter       = System.getModule("com.vmware.library.vc.basic").getDatacenterForVimObject(mySourceVirtualMachine);
var myDestinationDatacenter  = System.getModule("com.vmware.library.vc.basic").getDatacenterForVimObject(myDestinationVirtualMachine);
var mySourceVirtualDisk      = new VcVirtualDisk();
var myVirtualDiskManager     = myDestinationVirtualMachine.sdkConnection.virtualDiskManager;
for each ( var myDevice in mySourceVirtualMachine.config.hardware.device )
{
if ( myDevice instanceof VcVirtualDisk )
{
if ( myDevice.deviceInfo.label == "Hard disk 1" ) // any identifier you want Destination use Destination get your disk
{
mySourceVirtualDisk = myDevice;
break;
}
}
}
var myDestinationDatastore = myDestinationVirtualMachine.datasDestinationre;
var mySourcePath           = mySourceVirtualDisk.fileName;
var myDestinationPath      = "\[" + myDestinationDatastore.name + "] " + myDestinationVirtualMachine.name + "/" + myDestinationVirtualMachine.name + "_99.vmdk";
myTask = myVirtualDiskManager.copyVirtualDisk_Task(mySourcePath, mySourceDatacenter, myDestinationPath, myDestinationDatacenter, null, true);

Maybe it helps you find a solution.

Regards,

Chris

cos11
Contributor
Contributor

thank you for your response,

basically im looking to backup a virtual machine that has multiple disks and due to being too large, we would like to back it up ussing snapshots, but it would take too much to back it all up at one time, so were looking in to breaking it up in to multiple jobs that would copy lets say 10 disks out of 20

0 Kudos
ChristianWehner
VMware Employee
VMware Employee

How about cloning the VM and then backing up the clone?

cos11
Contributor
Contributor

so thats the plan... but it takes too long to backup the whole machine... so was thinking about just doing like 10 disks to reduce the time to around 6 hours and then the other 10 disks the next day...

can do it from CLI... so im looking to do the same thing through vco...

0 Kudos