VMware Cloud Community
aldagm
Contributor
Contributor

How to rename a VMDK with PowerCLI?

Hi community,

We often have the case, that a VM is distributed across multiple datastores (RAID Arrays). Unfortunately, when I create a new VMDK on a new datastore, it starts again with xxx_1.vmdk.

Imagine the latest VMDK which is attached has the name SERVER01_6.vmdk and a new VMDK will be created on a new datastore. The name should be SERVER01_7.vmdk.

What is the best way to do that?

I found this pretty old article:
https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/How-to-rename-a-VMDK-with-PowerCLI/td-...

Sounds more like a workaround. Is there a better way now with vSphere 7 to rename a VMDK with PowerCLI?

Thank you!
Michael

0 Kudos
3 Replies
LucD
Leadership
Leadership

I'm afraid not.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
aldagm
Contributor
Contributor

What is your recommendation? Using the PSdrive to access the datastore and rename <Server>.vmdk and <Server>-flat.vmdk? Or using the Copy-HardDisk option?

Do you know if it's possible to open a feature request @VMware? For me this is a very basic functionality which should be possible.

Especially when CREATING a disk it should be possible to set a name (instead of create+rename afterwards) - but also no way

0 Kudos
LucD
Leadership
Leadership

Just renaming the 2  files will not work without also editing the header file.
That is technically possible, but I would still prefer the vmkfstools -E command.
That command is supported, while editing and renaming yourself might void your support.

If you can use SSH to at least one ESXi node that has access to the datastore on which the VMDK lives, that can be done with for example the help of the Posh-SSH module. See Use Posh-SSH instead of PuTTY

The other viable option would indeed be Copy-VirtualDisk, but that requires double the required space during the copy.

You can open a Feature Request to VMware, as documented in KB1002123
Personally, I would do this via your companies' TAM though.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos