VMware Cloud Community
aiea96701
Enthusiast
Enthusiast
Jump to solution

rename a vmdk file and move it

situation:  A VM guest O/S is corrupt.  The VM has a second VMDK file that contains the data.   Need to build a new VM with the same naming convention.   Powered down the original VM with corrupt system virtual disk.  Removed it from inventory.   Then, I recreated another VM with a good guest O/S.   Now, I need to attach the Data disk but the label for this VMDK is exactly the same as the original system disk.   So, the question is:  can I rename the original Data VMDK file and move it to the Newly created VM as a second virtual disk without issues?   Thanks.

0 Kudos
1 Solution

Accepted Solutions
a_p_
Leadership
Leadership
Jump to solution

Each virtual disk consist of two files, the small header/descriptor .vmdk file and the data file (flat or delta file). For the rename command you'll need to provide the descriptor file name only.

André

View solution in original post

0 Kudos
9 Replies
a_p_
Leadership
Leadership
Jump to solution

The proper way to rename a virtual disk (header and data file) is using vmkfstools from the command line

vmkfstools --renamevirtualdisk old.vmdk new.vmdk

Please make sure the virtual disk does not have any active snashots!

André


aravinds3107
Virtuoso
Virtuoso
Jump to solution

It is possible to rename he VMDK file, Use VMKFSTOOL -E <old.vmdk> <new.vmdk>

To know more about the option Check KB1002491

If you find this or any other answer useful please consider awarding points by marking the answer correct or helpful |Blog: http://aravindsivaraman.com/ | Twitter : ss_aravind
aiea96701
Enthusiast
Enthusiast
Jump to solution

I see 2 files with the same label except one has the -flat label also.  Do I rename both?

0 Kudos
a_p_
Leadership
Leadership
Jump to solution

Each virtual disk consist of two files, the small header/descriptor .vmdk file and the data file (flat or delta file). For the rename command you'll need to provide the descriptor file name only.

André

0 Kudos
aiea96701
Enthusiast
Enthusiast
Jump to solution

Thanks very much.

0 Kudos
aiea96701
Enthusiast
Enthusiast
Jump to solution

all went well. many thanks.

0 Kudos
aiea96701
Enthusiast
Enthusiast
Jump to solution

One last question:   I'll probably delete the old VM from disk.  Should I copy the flat file somewhere for safe keeping or when I renamed the descriptor file did it create a new disk in the other VM?

0 Kudos
a_p_
Leadership
Leadership
Jump to solution

Renaming using vmkfstools should have renamed the flat file too!? When you delete a VM from disk, only the files associated to the VM will be deleted and since the new name isn't mentioned anywhere in the old VM's configuration file, the renamed .vmdk files should not get touched/deleted. Anyway, I'd consider to move the renamed files to the new VM's folder and attach it to the VM from there.

André

0 Kudos
aiea96701
Enthusiast
Enthusiast
Jump to solution

you're correct.  I checked again.  Both the flat file and descriptor file have been moved to the new VM and renamed.   Thanks again.  Appreciate the help

0 Kudos