Wednesday, January 02, 2008

Old VM's to New ESX server

So for all of us small/medium size guys who are facing problems with old VMs on older servers or moving VM from test into production who don't have Vmotion or any of the cool stuff how do they do it?

I know of two ways. One way is command line and the other is gui. The command line way it more fun LOL but it's long and prone to error. The gui way like everything gui related to short and to the point. I'll go over the command line way first b/c it's good to know these things.

Moving VM's from ESX host to ESX host (method 1)

First you'll have to unregister you VM from the target host. To do this you have to use an ssh tool to console in like putty. SSH into the host where the VM that you want to move is located. Run the command to list your VM's

vmware-cmd -l = lists your VM's

You will notice that VM's show up with long character names followed by the shortcut name which is what you named your datastore within the Infrastructure client.

Now you'll need to unregister your VM that you want to move. To do so you'll use the command

vmware-cmd -s unregister /path/to/datastore (this path should look something like this /vmfs/volumes/datastore name

Now using FastSCP b/c this allows you to SCP into the server with root access (great tool), connect to the target ESX host and destination ESX host. You should see both host on the left side pane.

On the destination host create a folder where your volumes are and call it the datastore name. On the target browse to into the VM folder that you want to move to the new host. You will see about a dozen or so files. Copy all the files ACCEPT the .vmdk files over to the folder you just created in the new host.

Once that copy is done on the destination host create a temp folder where ever you have available space (must be enough to hold the size of the .vmdk files). Now copy the .vmdk files from the target server to this location. This copy takes a while depending on the size of the .vmdk files, 40GB is about 2 hours.

Once the files are copied run the vmkfstools command.

vmkfstools -i /path/of copied vmdk/name.vmdk /path/of where all the other files are/name.vmdk

So you will run this tool against the .vmdk files you just copied to allow the tool to reincorporate the .vmdk files over to the first set of files you copied earlier. So you must have both paths correct of it will fail.

This process takes a little while b/c it has to put everything back together and I think it defrags at the same time.


Moving VM's from ESX host to ESX host (method 2)

Use VMware Converter. LOL thats it. I found out the hard way that this was the easiest way to move VM from host to host. My last post explains how to do it.

VMware is sweeeeeet!

So I've moved forward with VMware full swing. We purchased a new server for our production VM environment. The server specs are as follow;

HP DL580 G5
4 Quad core 3GHz Xeon cpus'
48GB memory
2 72BG 10K rpm HD
2 Qlogic HBA's
connected to our emc SAN

This server is a beast. If you didn't realize that is 16 cores in this one. I can host about 5 VM's per core for a total of 80 VM's give or take depending on resource allocation.

This server could replace pretty much all the servers on my network. And in essence I could have one rack with just this box and my SAN.......but I'm not doing that. I'm just going to consolidate our file servers and our single function servers. No need for those 1U guys anymore that just run IIS.

So why is VMware so sweet. Well b/c it's owned by emc. Really b/c the integration into your environment is almost transparent to the end users. You can literally convert a physical server that dying into a VM in a matter of hours providing you are ideally setup with a SAN and your ESX host is up and running.

Using VMware Converter (free) you can install it on the physical machine you want to convert or if that machine is out of space like most old servers are you can install it on any other server and point to converter to the server you'd like to convert. Once the VMware Converter is installed you run the app and a wizard opens up pretty much asking you what server you want to convery, what volumes (c:, d: and any others), where you'd like to house these volumes (this is best in a SAN environment where you have already carved out a LUN for this server), name change, network config and thats it. Once you hit start the physical server is still online with users connected and it takes a snapshot of the entire server files and all and turns it into a VM. Not only does it do that but it also send the VM over to the ESX host and powers it on (power on is an option if you want no downtime).

The amount of time it takes depends on how much data you will be converting. Remember the converter will be taking that physical server with everything on it that you picked into a VM. So if it's a server with a 40BG database all that has to come over. Thats takes about 2 hours. The converter has an ETA as well.

It's great. I am amazed that emc and VMware have automated this entire process.

Happy New Year!!!

Wishing you all the best in 08.