Moving a .VMKD in VMware ESX 3.5

For those savvy in the ways of Unix and maybe even VMware, here is what you need to do…

vmkfstools -i /<source directory>/<VM name>.vmdk /<destination directory>/<VM name>.vmdk
cp /<source directory>/<VM name>.nvram /<destination directory>/<VM name>.nvram
cp /<source directory>/<VM name>.vmx /<destination directory>/<VM name>.vmx

Edit beyond01.nvram and change the swap volume path – AKA sched.swap.derivedName
Register – vmware-cmd register -s /vmfs/volumes/OS_Store/beyond01/beyond01.vmx

Error message about msg.uuid.moved. Use Keep if you are just moving.

Now for the long answer

When I first set up my new server, I used the local disk (80GB disk also used for the OS.) This was more of a proof of concept than my long term plan. Once I got my Beyond TV box virtualized, I used that box as an iSCSI server, using OpenFiler.

Once I had my shared storage online, I needed/wanted to move off the local disk. As an aside, I am planning on getting another Dell SC1430 so I can play with VMotion, etc. Otherwise there is no real reason for shared storage.

VMware stores the OS files in a directory that live under something like this…

/vmfs/volumes/<soft link to a much longer file name given by ESX>/<VM name>/ for me, they were called

/vmfs/volumes/vmware:storage1/x64-1. vmware:storage was a soft link to 47d1cf7c-b1977786-6f94-001e4fb0071d

The files underneath are generally called <VM name>.<some extension>. I’m going to assume you’ve already got your shared storage configured. Mine is called 47f66e4a-3f40b51e-6de1-00110a641136, which is called OS_Store. Your first step is to create your destination folder. Mine is called /vmfs/volumes/OS_Store/x64-1. The first file to transfer is your <VM name>.vmdk, which is much like an ISO file. You must use vmkfstools to do this, and you need to do it as root. The command is…

vmkfstools -i /<current .vmdk directory>/<VM name>.vmdk / <destination .vmdk directory>/<VM name>.vmdk

This will take a while, as the .vmdk is as large as your Virtual Machine. Once that is done, let’s copy the rest of the files.

cp <current directory>/<VM name>.nvram /<destination directory>/<VM name>.nvram

cp <current directory>/<VM name>.vmx /<destination directory>/<VM name>.vmx

Now edit your .vmx file. Look for your swap file location…

sched.swap.derivedName = “/vmfs/volumes/47f66e4a-3f40b51e-6de1-00110a641136/x64-1/x64-1-026c37e8.vswp”

The long string in the middle is the path to your storage. Change it to your new destination. Don’t use the soft link name.

Now we register the new VM with your ESX server –

vmware-cmd register -s /vmfs/volumes/<path to shared storage>/<VM name>/<VM name>.vmx

When you go to start your VM, you’ll get questions about your intent. For this exercise I used keep.

If you see any errors, or have suggestions for clarity, please let me know.