This is a way to move the VMDKs for a VM from local storage to the SAN.
First you need to get your SAN hooked in, once you do this, SSH onto the box, under your vmfs directory you’ll find the directories (links) to the LUNs presented from your SAN.
To move from /vmfs/volumes/storage1 to /vmfs/volumes/storage2
1) Create a folder in the new datastore eg:
2) Copy across the hard drives, repeat for each vmdk (Not the -flat files)
vmkfstools -i /vmfs/volumes/storage1/vm_name/diskname.vmdk /vmfs/volumes/storage2/vm_name/diskname.vmdk
(It’s important to use vmkfstools here and not cp in order to avoid fragmentation, also its a lot quicker)
3) Copy across the .vmx file
cp /vmfs/volumes/storage1/vm_name/vmname.vmx /vmfs/volumes/storage2/vm_name/vmname.vmx
4) In the VI Client browse the new datastore, right click on the transferred .vmx file and select “Add to Inventory”
5) Start up new VM and once happy with it, delete the old copy.
Best seen with an example:
vmkfstools -i /vmfs/volumes/datastore1/SERVER01/SERVER01.vmdk /vmfs/volumes/datastore2/SERVER01/SERVER01.vmdk
cp /vmfs/volumes/datastore1/SERVER01/SERVER01.vmx /vmfs/volumes/datastore2/SERVER01/SERVER01.vmx