VMware Cloud Community
BlackBeret20111
Contributor
Contributor

Move-VM leaves old datastore linked with VM

Hi,

I did svMotion with Move-VM to several hundred VMs, the data folders did move to the new

datastore, but to my surprise, the old datastore is still linked with the VM,

e.g Get-Datastore -VM "MyVM" is listing two datastores for the VM, the old one and the new one.

the actual files exist only in the new datastore, so it's more like a cosmetic problem,

but I wonder what have I done wrong and how do I fix it?

Thanks,

BalckBeret

Tags (2)
0 Kudos
6 Replies
LucD
Leadership
Leadership

Could you perhaps show us the code you used for the svMotion ?

What is left on the "old" datastore ? Is there still a folder with the name of the VM ? Any files in there ?

Could it be that you configured your swap files to a specific datastore and not to the VM folder ?


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

0 Kudos
BlackBeret20111
Contributor
Contributor

Hi LucD,

1. The relevant line is: $vm | Move-VM -Datastore $destination_ds_name -ErrorAction Stop

2. Basically, as far as I can see, nothing is left on the old DS

3. The swap files are located in the VM folder

Thanks

0 Kudos
LucD
Leadership
Leadership

Ok, does the vSphere Client also show the "old" datastore for these VMs ?

If not, try a Disconnect-VIServer/Connect-VIServer, followed by a Get-VM.

Do you then still see the old datastore ?

You can also check one of the .vmx files (download it to a local disk) and check if there are entries with the old datastore in there.


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

0 Kudos
BlackBeret20111
Contributor
Contributor

1. Yes, it's listing both the old and new datastore

2. I did Disconnect-VIServer/Connect-VIServer + Get-VM,

and the DatastoreIdList attribute is listing to datastores:

DatastoreIdList         : {Datastore-datastore-39, Datastore-datastore-1861}

3. I can't see anything related to datastore sttings in the vmx file..

BTW, if I'm doing svMotion via vsphere client it works flawlessly.

0 Kudos
Mouhamad
Expert
Expert

I'm having the same issue.

Anyone managed to resolve it?

VCP-DCV, VCP-DT, VCAP-DCD, VSP, VTSP
0 Kudos
LucD
Leadership
Leadership

Do you also see the difference in behaviour when you do the svMotion via the vSOhere Client or via the PowerCLI Move-VM cmdlet ?


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

0 Kudos