One of many hypnotic appeals to leveraging virtual infrastructure is the ability to move workloads around without any downtime. This is certainly true with the VMware vMotion operation that hooked most of us on virtualization the first time we were able to see it work in action. With VMware vMotion you are able to move around the compute resources to different ESXi hosts in a cluster. Another equally cool technology is VMware storage vMotion that allows moving virtual machines to different storage without any downtime. Let’s take a closer look at what is VMware storage vMotion and how it works.
What is VMware Storage vMotion and How It Works
Being able to move virtual machine disk files around between datastores all while the virtual machine is running, affords some incredible flexibility, especially for maintenance. Additionally, storage vMotion holds benefits to a VMware administrator that are not so evident such as the ability to optimize disks for performance and even transform between different disk types, such as from thick to think or vice versa. It also renames all virtual machine files to match the inventory name of the virtual machine. This includes virtual disks, configuration files, snapshots and .nvram files. So to summarize the benefits:
- Moving a virtual machine to a different datastore(s) while it is running
- Allowing redistributing the load across datastores for performance
- Changing the provisioning type of the virtual disk(s)
- Renaming the underlying files of the virtual machine to match the inventory name
A few important requirements to keep in mind with storage vMotion are the following:
- vCenter Server
- Virtual machine disks must not be in non persistent mode – Need to be persistent or RDM
- ESXi 4.0 and later do not require vMotion to be configured to perform storage vMotion
- Host needs to be able to access both the source and the destination datastore(s)
As is documented by VMware, let’s look at the process that is involved with Storage vMotion. It is a six-step process that involves the following:
- Copying the virtual machine home directory to the destination datastore. This includes the config, log, swap, and snapshots contained
- A “shadow” virtual machine is started on the destination datastore
- Virtual machine disk files are copied to the target datastore while changed block tracking keeps up with the changes that are made to the virtual disks during the copy
- Storage vMotion keeps repeating the copy process of changes made to the source over to the destination
- Once the copying of changes gets down to only a few outstanding changed blocks, Storage vMotion performs a “stun” operation to transfer the compute resources over to the shadow virtual machine.
- Once the compute resources are swapped over to the new “shadow” virtual machine that is now the primary virtual machine, the old virtual machine files on the source datastore are deleted
How to Storage vMotion a Virtual Machine
Let’s look at the process to perform a Storage vMotion of a virtual machine. The below screens are from the new HTML5 UI.
The process to move a virtual machine to a different datastore with PowerCLI is extremely easy as well:
Move-VM -VM 'VM Name' -Datastore $datastore
As we have covered the topic – What is VMware Storage vMotion and How It Works – we see that Storage vMotion provides an extremely valuable tool in the toolbox of VMware administrators. It allows relocating virtual machines to completely different storage without so much as a reboot! It also allows reprovisioning the disk type, reclaiming space, evening out performance workloads, renaming the virtual machine files, etc. Administrators can take advantage of this tremendous flexibility by decoupling the requirement of virtual machines living on a certain datastore once they are provisioned there.