vMotion and Storage vMotion (using vCenter)

Finally if you have been following the series we come to the most enjoyable part, vMotion, storage vMotion and Cold Migration. Before we start I just want to recap on my test environment I have two nested ESXi servers connected to a Synology iSCSI SAN which will supply the shared storage, I have created a RedHat VM to show you how to migrate storage using Storage vMotion.

To say we are moving a VM from one ESXi server to another with vMotion is a bit of a lie, we don't actually move the data at all, this stays on the shared storage, it's only the VM's memory contents that are moved from one ESXi server to another. The VM on the first ESXi server is duplicated on to the second ESXi server and then the original is deleted, during vMotion first ESXi server creates an initial pre-copy of memory from the running VM into the second ESXi server, during the copy process, a log file is generated to track all changes during the initial copy phase (it is referred to as a memory bitmap). Once the VM's are practically at the same state, this memory bitmap is transferred to the second ESXi server, before the transfer of the bitmap file the VM on the first ESXi server is put into a quiesced state. This state reduces the amount of activity occurring inside the VM that is being migrated, it allows the bitmap to become so small that it can be transferred very quickly, it also allows for rollback if a network failure occurs, this means that the migration will have to be successful or unsuccessful. When the bitmap has been transferred the user is then switched to the new ESXi server and the original VM is removed from the first ESXi server.

You need the following to perform a vMotion all requirements are for both ESXI servers involved

If one of the above has not been met, then vMotion will fail. I just want to touch on the network quality, I highly recommend that you use a dedicated 1GB network for the vMotion, however I am seeing more companies using 10GB networks and running everything through this (Management, iSCSI, vMotion, etc). Also CPU compatibility is also a show stopper, try to make sure that all your ESXi server that you plan to use vMotion are the same, it is possible to vMotion across different CPU types but it can be a real pain and expensive option only to find out that it does not work, buy for compatibility.

There are a few requirements for the VM's

vMotion requires a VMKernel port group with a valid IP address and subnet mask for the vMotion network. A default gateway is not required (you should really have all ESXi servers that you are going to use with vMotion on the same subnet) but VMware does support vMotion across routers or WAN's.You can create a vMotion port group on an existing vSwitch.

So lets create the vMotion port group

vMotion switch, port group and VMKernel

I have setup a vSwitch with one uplink (vmnic2), I have used the default settings but you could use jumbo frames (MTU 9000), however if you do make sure that that all networking components (including external physical routers/switches) also use Jumbo frames otherwise you will see reduced VM/SAN performance

I then has setup a vMotion port group and attached the vSwitch above

Finally I setup a VMKernel and configure an IP address attaching the vSwitch and port group above, I also made sure that this VMKernel uses the vMotion service

I do this for all ESXi servers that will use the vMotion

Now we use vCenter to manage vMotion, DRS, HA, etc for the whole VMWare environment, so we start but setting up a Data Center folder called Production (in my case) and then we add the ESXi servers to the vCenter this allows the vCenter to manage these ESXi servers in the cluster in a per environment. You will not be able to create any virtual machines until a Datacenter has been created and at least one ESXi server has been added to this Datacenter.

Now we start to add the ESXi servers (hosts), by right-clicking on the Production data center and selecting add host

You are taken to a configuration screen, first enter the ESXi server IP address

Enter the root credentials, to allow the vCenter to login to the ESXi server (make sure the crednetials have admin access)

Then you get a summary screen

Enter any licensing, here I am just using evaluation licences for testing purposes

You can tighten security if you so wish but as this is a test rig i will leave it as default (disabled)

If you have setup multiple data centers you could select a specific data center

Finally we get to the summary screen, double check and click finish to allow the vCenter to control the ESXi server, do this for all ESXi servers you wish to manage by the vCenter

When you refresh the vCenter main screen you can see that we now have control over 2 ESXi servers, once of the ESXi server has a Red Hat 8 configured.

If you login to the ESXi server you can see that it is can also be managed by the vCenter server in several places, the state states that you are connected to the vCenter server and you have a notification in the middle of the screen.

VM vMotion

Now using vCenter we can use vMotion to very easily move VM's from one ESXi server to another

VM migration using vMotion

We start with the redhatns01 VM being hosted on ESXi server (192.168.1.220)

If we right-click on the VM and select migrate we can start the process to migrate the VM to another ESXi server

You are taken to the migrate screen, you have the option to migrate the compute resources only, storage only or both

The next screen allows you to slect the ESXi server to which to migrate the VM too

You have the option to migrate to a different network

Finally you reach the summary screen, click to migrate the VM

Returning to the main vCenter you can see that the VM has migrated to the other ESXi server, also you can see that it was successfully in the recent tasks screen at the bottom

Storage vMotion

It is possible to move the storage of a VM and locate it to another storage area without even powering off, this is ideal when you want to migrate onto a new SAN or iSCSI server, thus upgrading your storage is a breeze, there are a number of other reasons to use Storage vMotion

Like vMotion there are a number of requirements

Migrating the storage is the same process as migrating the VM as seen below, moving the storage Hot (while the VM is running) or Cold (VM is shutdown) is the same

storage vMotion

We start with the VM being stored on datastore dsnested1

We again use migrate to migrate the data to a different datastore

We select the new datastore dsnested2

Check everything before you migrate the data

You can see from the main vCenter screen that the datastore as now changed and that the migrate task was completed successfully