VMware Cloud Community
djenn40
Contributor
Contributor

Reuse VMDK for New Machine ESX 3.5, Possible to Rename Folder and VMDK

We have a 225 GB VMDK that we've taken off 1 machine and have added to a new machine. I'm able to use Veeam and modify the folder name and the vmdk name and add it to the new server. What I'm not able to do is modify the flat file name. Once I modify that name I can no longer add the drive using Virtual Center. I was wondering if I needed to rescan the datastores for the hosts to see the new flat file or will I have to delete it and create a new one?

Reply
0 Kudos
11 Replies
mcowger
Immortal
Immortal

You need to edit the .vmdk file to point to the new name of the -flat.vmdk file.






--Matt

--Matt VCDX #52 blog.cowger.us
Reply
0 Kudos
djenn40
Contributor
Contributor

Thanks for the reply. I should be able to do this from the console using vi? Will try to do it today and see if I can get it sorted out. I think I've done it once before a few months ago.

Reply
0 Kudos
kjb007
Immortal
Immortal

Yes, a direct edit using vi or whatever text editor you're familiar wtih will allow you to do this. On the other hand, moving files from one datastore to another will rename the vm files as well.

-KjB

vExpert/VCP/VCAP vmwise.com / @vmwise -KjB
Reply
0 Kudos
Troy_Clavell
Immortal
Immortal

a simple rename of the VM in vCenter, then shutdown and do a cold migration, as KjB pointed out, will take care of the rename for you.

Reply
0 Kudos
djenn40
Contributor
Contributor

So I can add the vmdk with the wrong name to the new server, shut the server down and do a cold migration to another data store and it will automatically rename the vmdk to reflect the server name? I'll see if I have another datastore with 225 gb of free storage to attempt this.

Reply
0 Kudos
Troy_Clavell
Immortal
Immortal

yes, first do a rename of the vCenter VM, then shudown and choose migrate. That will take care of the rename.

Reply
0 Kudos
djenn40
Contributor
Contributor

Ok. I would have to migrate the storage to a new datastore though correct?

Reply
0 Kudos
Troy_Clavell
Immortal
Immortal

correct.

Reply
0 Kudos
_David
Enthusiast
Enthusiast

I would move it with vmkfstools

SSH into the host

vmkfstools -i /vmfs/volumes/Datstore01/firstvm/firstvm.vmdk /vmfs/volumes/Datastore02/secondvm/secondvm.vmdk

This is no move of the file, it makes a copy of the vmdk to the new location with a name you specify. No need to edit the vmdk file with vi as vmkfstools takes care of that.

If you found this or any other answer useful please consider the use of the Helpful or correct buttons to award points

If you found this or any other answer useful please consider the use of the Helpful or correct buttons to award points
Reply
0 Kudos
djenn40
Contributor
Contributor

_David thanks for the info. The issue is we're hard pressed for storage at this point, don't think we have a datastore with 225 GB of storage available I'll probably be creating a few more 400 GB Luns this week, but need to get a server up today so would need to just reuse that vmdk.

Basically what we have is Server A used to use 2 vmdk, 20 GB OS and a 225 GB Storage drive. I've removed the 225 GB drive from Server A and will be attaching it to Server B, at which point the data will be wiped and the another application installed. I was looking for a way to rename the 225 gb vmdk that will have Server A's name even though it's attached to Server B. If I just rename the flat file and try to browse to it in VI the file isn't found. I have to name it back to ServerA-flat.vmdk and then I'm able to attach it.

Reply
0 Kudos
kjb007
Immortal
Immortal

You should also be able to rename the disk directly, vmkfstools -E srcDisk destDisk, if you don't use the other methods. A simple rename and a vi edit will do the trick as well.

-KjB

vExpert/VCP/VCAP vmwise.com / @vmwise -KjB
Reply
0 Kudos