Cain Manor

Your Guide To All Things Cain™

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…

vmk­f­s­tools –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 vol­ume path — AKA sched.swap.derivedName
Reg­is­ter — vmware-cmd reg­is­ter –s /vmfs/volumes/OS_Store/beyond01/beyond01.vmx

Error mes­sage 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 con­cept than my long term plan. Once I got my Beyond TV box vir­tu­al­ized, I used that box as an iSCSI server, using OpenFiler.

Once I had my shared stor­age online, I needed/wanted to move off the local disk. As an aside, I am plan­ning on get­ting another Dell SC1430 so I can play with VMo­tion, etc. Oth­er­wise there is no real rea­son for shared storage.

VMware stores the OS files in a direc­tory that live under some­thing 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 under­neath are gen­er­ally called <VM name>.<some exten­sion>. I’m going to assume you’ve already got your shared stor­age con­fig­ured. Mine is called 47f66e4a-3f40b51e-6de1-00110a641136, which is called OS_Store. Your first step is to cre­ate your des­ti­na­tion folder. Mine is called /vmfs/volumes/OS_Store/x64-1. The first file to trans­fer is your <VM name>.vmdk, which is much like an ISO file. You must use vmk­f­s­tools to do this, and you need to do it as root. The com­mand is…

vmk­f­s­tools –i /<current .vmdk directory>/<VM name>.vmdk / <des­ti­na­tion .vmdk directory>/<VM name>.vmdk

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

cp <cur­rent directory>/<VM name>.nvram /<destination directory>/<VM name>.nvram

cp <cur­rent 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 mid­dle is the path to your stor­age. Change it to your new des­ti­na­tion. Don’t use the soft link name.

Now we reg­is­ter the new VM with your ESX server -

vmware-cmd reg­is­ter –s /vmfs/volumes/<path to shared storage>/<VM name>/<VM name>.vmx

When you go to start your VM, you’ll get ques­tions about your intent. For this exer­cise I used keep.

If you see any errors, or have sug­ges­tions for clar­ity, please let me know.

Comments are closed.