Servers
Windows, Linux, and Mac
Cloning a thin disk in ESXi
0Found a great article that saved me a lot of time and headache when copying or “cloning” a .vmdk disk in VMWARE ESXi.
If you copy a vmdk from a ESXi system via ‘cp’ or anything similar, your so called sparse-vmdk, will blow up to the maximum size which was defined.
For example, a VM with a 25G partition shows up with 25G but needs only the space which consumes the data you really have.
The parameter ‘-s’ in the command ‘ls’ presents the really needed space.
ls –slh *.vmdk 140K -rw------- 1 root root 8,0G 3. Aug 14:20 bac-test-flat.vmdk 4,0K -rw------- 1 root root 424 3. Aug 14:22 bac-test.vmdk
The vmdk was freshly created and no operating system was installed. It consumes only 140k instead of the defined 8G.
So far so good, but a copy with ‘cp’ will replace the null-pointer in this file with real zeros. The result is a 8G consuming file with only zeros in it and the storage efficiency is gone.
For copying vmdk files, there is a tool called ‘vmkfstools’ available on the ESXi server.
vmkfstools -i "source.vmdk" -d thin "destination.vmdk"
There should be no snapshot and source and destination are the meta vmdk files. e.g. vmname.vmdk (not flat or delta).
‘thin’ is the secret of keeping the null-pointer in the flat file.
The tool also reverts a vmdk which was blown up, back into a thin file!
For an easier usage i wrote a tiny script to copy like it is with ‘cp’:
1 2 3 4 5 6 7 8 9 10 11 |
#!/bin/bash if [ -n "$1" ] || [ -n "$2" ]; then SRC="$1" DST="$2" else echo "Error: Usage $0 [source] [destination]" echo "Use only vmdk-meta files! no flat or delta allowed!" echo " " exit fi vmkfstools -i "$1" -d thin "$2" |
create a script called ‘vmcp’,
save it in /usr/bin
and set execution rights (chmod +x /usr/bin/vmcp)
Now you can copy with
vmcp source.vmdk destination.vmdk
This worked great!
Why use Vmware Converter?
0I downloaded this (vmare converter) free product during a baremetal conversion to a virtual machine. For small business servers out there this application is a life send. It has the ability to create virtual drives as well the .vmx file from the machine that you are wanting to convert from. This can be done while the server is running! After which, download Vmware Server, another free download, configure it and you are virtualized! Amazing product.
Vmware Server Bridging Problem
0If anyone has ever worked with VMware and virtual servers, you know that some times they can be a pain. I recently had issues with a Bridging problem with a server running windows 2003. I searched all around on the net and finally came across this article.
Which got me thinking about hamachi. I have it installed on the host server. I disabled vmware on the hamachi adapter and all is well!
