Wow, I wanted to move my vm's from testbed running on esx-i 4.0 to my production servers, which support iscsi.
The trick is to move them quick, without letting them ballon.
To do this you have to move the disk images: *.vmdk and the snapshots using
vmkfstools, plus the .vmx file and the .nvram file.
So as a example:
The original directory:
/vmfs/volumes/4bbda047-6fa7b452-4280-6cf049e2d29a/sin-fs-1 # ls -l -h
-rw------- 1 root root 80.0G May 27 01:37 sin-fs-1-flat.vmdk
-rw------- 1 root root 8.5k May 27 01:37 sin-fs-1.nvram
-rw------- 1 root root 501 May 26 07:14 sin-fs-1.vmdk
-rw------- 1 root root 0 Apr 30 10:07 sin-fs-1.vmsd
-rwxr-xr-x 1 root root 3.2k May 27 01:37 sin-fs-1.vmx
-rw------- 1 root root 263 May 5 01:33 sin-fs-1.vmxf
-rw------- 1 root root 600.0G May 27 01:37 sin-fs-1_1-flat.vmdk
-rw------- 1 root root 504 May 26 07:15 sin-fs-1_1.vmdk
-rw-r--r-- 1 root root 234.7k May 11 09:21 vmware-2.log
-rw-r--r-- 1 root root 135.3k May 12 06:29 vmware-3.log
-rw-r--r-- 1 root root 135.3k May 13 02:55 vmware-4.log
-rw-r--r-- 1 root root 135.3k May 25 04:03 vmware-5.log
-rw-r--r-- 1 root root 132.5k May 25 04:14 vmware-6.log
-rw-r--r-- 1 root root 135.2k May 26 07:07 vmware-7.log
-rw-r--r-- 1 root root 136.5k May 27 01:37 vmware.log
/vmfs/volumes/4bbda047-6fa7b452-4280-6cf049e2d29a/sin-fs-1 #
Note the disk image is 600G. Its actually a sparse file, that is very "thin". So we only want to copy the data, not the empty space. Also VM can have snapshot disk images, so you also have to copy them.
So in this case lets first copy the disk images:
vmkfstools -i /vmfs/volumes/datastore1/sin-fs-1/sin-fs-1.vmdk -d thin sin-fs-1.vmdk
vmkfstools -i /vmfs/volumes/datastore1/sin-fs-1/sin-fs-1_1.vmdk -d thin sin-fs-1_1.vmdk
Now we copy the vmx files:
cp /vmfs/volumes/datastore1/sin-fs-1/sin-fs-1.vmx .
cp /vmfs/volumes/datastore1/sin-fs-1/sin-fs-1.nvram .
You can now use the vSphere client datastore browser to import, or import at the command line.
No comments:
Post a Comment