VMware Cloud Community
jean-marc_lagac
Contributor
Contributor

Relinking disk to base disk / linked clones

Hi all!

When using linked clones, it seems close to impossible to relocate the parent VM unless you connect through SSH to the host and manually update the

parentFileNameHint attribute of the child's linked vmdk.

I'm sure there is a better way to do it, hopefully through the PowerCli.

I looked through the Set-HardDisk command with no success, same with Get-HardDisk and some not so clever code.

I found that the following command would show me the path to the parent disk... so, my first instinct is to see if i can update that attribute, pointing it to the relocated disks from the Parent VM (the example is made with the assumption my linked/child VM is named "MyVM" and that is only has one disk):

(Get-harddisk -vm MyVM).Extensiondata.Backing.Parent

How would I change the parent to point to the correct/new location without having to go edit the .vmdk file directly?

Thanks in advance!

-


Jean-Marc Lagacé

Senior Software Consultant

BancTec (Canada), Inc.

Message was edited by: jean-marc.lag… to make the title more clear

---- Jean-Marc Lagacé Senior Software Consultant BancTec (Canada), Inc.
Reply
0 Kudos
9 Replies
Xeonel
Enthusiast
Enthusiast

Hi Jean,

What exactly are you trying to achieve by this? Once the pool is deployed the linked clones have no actual connection to their golden image, but to a replica created from the golden image. This means that you can in fact relocate your parent VM, you just need to be aware of this when you do your next recompose. Refresh operations should not be affected as they just discard the deltas.

Regards,

Andrei.

Reply
0 Kudos
jean-marc_lagac
Contributor
Contributor

Essentially I'm trying to reorganize my Datastores

It would seem they still have a link since when I relocate my base virtual machine the linked clone complains that it cannot find the file. If I relocate the base VM to it's original location then the linked clone stops complaining.

It might help specifying that I'm doing this on vSphere Essential 4.0

Regards,






----

Jean-Marc Lagacé

Senior Software Consultant

BancTec (Canada), Inc.

---- Jean-Marc Lagacé Senior Software Consultant BancTec (Canada), Inc.
Reply
0 Kudos
Xeonel
Enthusiast
Enthusiast

Could you be a bit more specific in regards to "relocate my base virtual machine" and "linked clone complains"? What are the exact error messages or warnings you see?

I've tested with several pools that if the pool is already provisioned (persistent or not) and I relocate the master image, I don't notice anything breaking. If I look on the datastores at some linked-clone VMs I see they point at the replica which is created from the master the first time you deploy the pool.

Reply
0 Kudos
jean-marc_lagac
Contributor
Contributor

Hi Andrei,

There are two virtual machines involved. One "base" virtual machine from which I create one of more "linked clones" (done through Powercli using the process described at http://www.vmdev.info/?p=202). Remember I'm using vSphere Essential 4.0, not View or any other product.

What do you mean by "pools" and "master image"? They probably refer to concepts I'm not understanding under vSphere which would most likely help resolve my issue.

Regards,

--

Jean-Marc Lagacé

Senior Software Consultant

BancTec (Canada), Inc.

---- Jean-Marc Lagacé Senior Software Consultant BancTec (Canada), Inc.
Reply
0 Kudos
Xeonel
Enthusiast
Enthusiast

That explains a lot. I thought you were using View. Now if you want to relocate your base image to a different datastore you can't do this without downtime. That's why in View, you've got a master or golden image and when you choose to deploy linked clones from it to certain datastores, it first creates a "replica" of the master to which in turn links the clones. So considering that you've got three datastores, Templates, DS1 and DS2 and your base image GoldenVM, the structure would look like this:

Templates/GoldenVM

DS1/clone01

DS1/clone02

DS1/replica-a61b8c8d-91d0-4b88-a201-

DS2/clone03

DS2/clone04

DS2/replica-646ed7aa-962b-401b-9d8b-

Both replica VMs are full clones of GoldenVM; clone01,clone02 are linked clones of replica-a61b8c8d-91d0-4b88-a201- while clone03, clone04 are linked clones of replica-646ed7aa-962b-401b-9d8b-.

I'll look to see if I can find any means of automatically updating the references once you do move the base image, however, keep in mind it's a disruptive process.

Reply
0 Kudos
Xeonel
Enthusiast
Enthusiast

What powercli version are you using? If you look at the powercli 4.1 release notes (http://www.vmware.com/support/developer/PowerCLI/PowerCLI41/powercli41-201007-releasenotes.html) something interesting comes up under improvements:

- Exposing the

View

object that corresponds to an object
returned by a PowerCLI cmdlet through the object's

ExtensionData

property.

Reply
0 Kudos
hgov
Enthusiast
Enthusiast

Thanks Andrei!

I am indeed using PowerCli 4.1 and found that ExtensionData property... I was thinking that at worst I can always use it to build a report of what will break when I move the template (giving me a list of VMDK files to fix). I'd rather have a PowerCli script that would build the list, make the relocation and make the fix... and I know that, once I understand how to "relink" the linked clone to the base VM, I can make the rest of the script work too.

That being said, I like how they do it on view and might just have to go with that approach in my Development Lab.

--

Jean-Marc

Reply
0 Kudos
Xeonel
Enthusiast
Enthusiast

Jean-Marc,

I just found something. Could you try the following:

get-harddisk -vm yourvm | % {$_.Extensiondata.Backing.Parent}

This should provide you with the currently set vmdk. From here on, you should be able to set it as well.

Good luck,

Andrei.

jean-marc_lagac
Contributor
Contributor

There does not seem to be a complete way of doing this through PowerCli.

best approach seems:

Get the list of parent disks:

get-harddisk -vm yourvm | % {$_.Extensiondata.Backing.Parent}

Then manually edit the .vmdk files to relink them to the newly located parent

---- Jean-Marc Lagacé Senior Software Consultant BancTec (Canada), Inc.
Reply
0 Kudos