Monday, April 12, 2010

Rename VMDK files – else you may have to experience Backup Problems

What if you end up with the same vmdk file name on different datastores?

A simple case scenario that can happens:

A single VM has several hard disk attached to it. The hard disk VMDK files are located on different datastores. When creating a new hard disk which location is on different datastore to a VM, the name given to this VMDK is the same as the first VMDK.

For exemple, you VM has a disk called TS01.vmdk which is located on DATASTORE1, and you create a second disk located on DATASTORE2. This disk takes the same name as the first one…. This is not a problem for VMware, but it is for third party backp products like Symantec Backup Exec 2010. In fact what happens to the backup job wanting to backup a VM like this? The VMDK is marked as a corrupted and the job fails, so it's impossible to restore either.

What's the solution? VMware KB had give me an simple answer what to do in the case like this. You'll have to use vmkfstools via command line to do the job. Don't worry, it's not difficult.

How to:

01. First, make sure that the VM has NO Snapshots. Then power down your VM go to menu Edit Settings.

On the next screen you just go to the hard disk you want to rename. Select the hard disk and click the remove button. The screen change and you have the possibility to check a radio button to delete the disk from datastore. Don't check this radio button. Otherwise your disk gets deleted..

02. Validate your choice on clicking OK.

03. Then you must connect to the console of the ESX server to which the datastore2 is attached to. Use putty or go directly to the server room.

04. Via putty navigate to the folder where the hard disk is located and execute following command:
vmkfstools -E <old_name> <new_name>
So in our case the command looks like this (I'm renaming from ts01.vmdk to ts01_2.vmdk):

vmkfstools -E ts01.vmdk ts01_2.vmdk

05. Then go to your VI client and add the renamed disk back to the virtual machine. In the Inventory browser by right clicking the datastore and where the VM is stored and select "Browse Datastore", select the folder of the VM than right click the vmx file and select "Add to Inventory".

This works fine for ESX 4, but to be able to use it with ESXi 4 you have several choices:

01. You can use the unsupported (Tech Support Mode) to get to the console of ESXi 4 since the CLI tools won't work for writing data in the free version of ESXi 4.

02. If your ESXi 4 is licensed with paid VMware License you can use PowerCLI or VMA to do the job.

Source    :

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.