VMware Cloud Community
sdibias
Contributor
Contributor
Jump to solution

Renaming datastore files

So I built a VM and decided the name needed to be changed, however the datastore folders/fies do not reflect these changes. Obvioulsy I would like to keep things nice and organized, so my question is how do I rename the datastore files to match the VM name without breaking anything?

Reply
0 Kudos
1 Solution

Accepted Solutions
LarsLiljeroth
Expert
Expert
Jump to solution

Hi

When i need to rename a server and it's data files i do this:

1.Shutdown vm

2. Rename in VC

3. Cold migrate to another storage/LUN ( take som time for a large server)

4. Power up. ...Done

By doing this everything is renamed ( .vmx , .vmfs , folders ) and the risc of doing something wrong is very little.

Maybe see this post-> http://communities.vmware.com/message/1110647#1110647

Best regards

Lars Liljeroth

-


If you found this information useful, please consider awarding points for "Correct" or "Helpful". Thanks!!! Edit

// Lars Liljeroth -------------- *If you found this information useful, please consider awarding points for "Correct" or "Helpful". Thanks!!!

View solution in original post

Reply
0 Kudos
7 Replies
apatel1
Enthusiast
Enthusiast
Jump to solution

There would be a couple of places you'd have to make the update. Rather than dealing with that, if you have the space available, I'd just change the VM's name back to whatever it was, power it down, and cold clone the VM to a new VM with the correct name. The clone's .vmx, .vmdk, and other files will all be consistent with this name. Doing it the other way would involve using the vmkfstools command to rename the .vmdk files, renaming the directory holding the files, and editing the .vmx file in a text editor to reflect these changes. It's not a big deal if you're handy with the CLI, but the "clone" method is much easier.

Hope that helps! Please help me out by marking my response as "helpful" or "correct" if you feel that it was useful!

-Amit

Please help me out by awarding points for a "helpful" or "correct" response if you feel that it was useful! -Amit
Reply
0 Kudos
LarsLiljeroth
Expert
Expert
Jump to solution

Hi

When i need to rename a server and it's data files i do this:

1.Shutdown vm

2. Rename in VC

3. Cold migrate to another storage/LUN ( take som time for a large server)

4. Power up. ...Done

By doing this everything is renamed ( .vmx , .vmfs , folders ) and the risc of doing something wrong is very little.

Maybe see this post-> http://communities.vmware.com/message/1110647#1110647

Best regards

Lars Liljeroth

-


If you found this information useful, please consider awarding points for "Correct" or "Helpful". Thanks!!! Edit

// Lars Liljeroth -------------- *If you found this information useful, please consider awarding points for "Correct" or "Helpful". Thanks!!!
Reply
0 Kudos
sdibias
Contributor
Contributor
Jump to solution

If i were to use the "Relocate a virtual machine" scheduled task would that shutdown the VM and rename the files or do I have to do it manually? I was thinking it would be easier to schedule it for after hours without human intervention. I suppose I could create a "Power Off" task followed by a "Relocate" task?

Reply
0 Kudos
apatel1
Enthusiast
Enthusiast
Jump to solution

That should work. If it is a guest running VMware Tools, you could have it shut down the guest OS gracefully rather than powering it down as well.

Hope that helps! Please help me out by marking my response as "helpful" or "correct" if you feel that it was useful!

-Amit

Please help me out by awarding points for a "helpful" or "correct" response if you feel that it was useful! -Amit
sdibias
Contributor
Contributor
Jump to solution

I thought I would give this a try with one o fmy test VM's running Ubuntu Server 8.10 and it didn't work. If I did something wrong please advise, here is what I did:

1) Shutdown the VM

2) Renamed the VM

3) Clicked on ESX Server>Configuration>Storage and clicked on "Browse Datastore"

4) Right clicked on the VM's folder and clicked "Move to" and moved it to another LUN/datastore.

After all this none of the files in the datastore were renamed... Did I do something wrong?

Reply
0 Kudos
apatel1
Enthusiast
Enthusiast
Jump to solution

Hi sdibias, after renaming the VM and shutting it down, you would right-click on it and select "Migrate" rather than doing it from the datastore browser. During the migration wizard, you'll be prompted to either keep the VM and its files in the current datastore or move them to another datastore. That's where you'd choose the new datastore.

Hope that helps! Please help me out by marking my response as "helpful" or "correct" if you feel that it was useful!

-Amit

Please help me out by awarding points for a "helpful" or "correct" response if you feel that it was useful! -Amit
sdibias
Contributor
Contributor
Jump to solution

I appreciate your help, that worked... I must have misread Lars post on the cold migration part, but that worked like a charm. Thanks for all your help!

Reply
0 Kudos