Migrating Virtual Machines with svmotion
Storage vMotion moves a virtual machine’s configuration file, and, optionally, its disks, while the virtual machine is running. You can perform Storage vMotion tasks from the vSphere Client or with the svmotion command.
You can place the virtual machine and all of its disks in a single location, or choose separate locations for the virtual machine configuration file and each virtual disk. You cannot change the virtual machine’s execution host during a migration with svmotion.
Storage vMotion Uses
Storage vMotion has several uses in administering your vSphere environment.
Perform storage maintenance and reconfiguration. You can use Storage vMotion to move virtual machines off a storage device to allow maintenance or reconfiguration of the storage device without virtual machine downtime.
Redistribute storage load. You can use Storage vMotion to manually redistribute virtual machines or virtual disks to different storage volumes to balance capacity or improve performance.
Storage vMotion Requirements and Limitations
You can migrate virtual machine disks with Storage vMotion if the virtual machine and its host meet the following resource and configuration requirements:
Virtual machine disks must be in persistent mode or be raw device mappings (RDMs). For physical and virtual compatibility mode RDMs, you can migrate the mapping file only. For virtual compatibility mode RDMs, you can use the vSphere Client to convert to thick-provisioned or thin-provisioned disks during migration as long as the destination is not an NFS datastore. You cannot use the svmotion command to perform this conversion.
ESX/ESXi 3.5 hosts must be licensed and configured for vMotion. ESX/ESXi 4.0 and later hosts do not require vMotion configuration to perform migration with Storage vMotion.
A particular host can be involved in up to four migrations with vMotion or Storage vMotion at one time. See “Limits on Simultaneous Migrations” in the vCenter Server and Host Management documentation for details.
If you use the vSphere Client for migration with svmotion, the system performs several compatibility checks. These checks are not supported by the svmotion vCLI command.
Running svmotion in Interactive Mode
You can run svmotion in interactive mode using the --interactive option. The command prompts you for the information it needs to complete the storage migration.
svmotion <conn_options> - -interactive
When you use --interactive, all other options are ignored.
Running svmotion in Noninteractive Mode
Important When you run svmotion, --server must point to a vCenter Server system.
In noninteractive mode, the svmotion command uses the following syntax:
svmotion [standard vCLI options] - -datacenter=<datacenter_name>
- -vm <VM config datastore path>:<new datastore>
[- -disks <virtual disk datastore path>:<new datastore>,
<virtual disk datastore path>:<new datastore>]
Square brackets indicate optional elements, not datastores.
The --vm option specifies the virtual machine and its destination. By default, all virtual disks are relocated to the same datastore as the virtual machine. This option requires the current virtual machine configuration file location. See To determine the path to the virtual machine configuration file and disk file.
The --disks option relocates individual virtual disks to different datastores. The --disks option requires the current virtual disk datastore path as an option. See To determine the path to the virtual machine configuration file and disk file.
To determine the path to the virtual machine configuration file and disk file
1
Run vmware-cmd -l to list all virtual machine configuration files (VMX files).
vmware-cmd -H <vc_server> -U <login_user> -P <login_password> -h <esx_host> -l
2
By default, the virtual disk file has the same name as the VMX file but has a .vmdk extension.
3
(Optional) Use vifs to verify that you are using the correct VMDK file.
To relocate a virtual machine’s storage (including disks)
1
2
Run svmotion:
svmotion
- -url=https://myvc.mycorp.com/sdk - -datacenter=DC1
- -vm=”[storage1] myvm/myvm.vmx:new_datastore”
The example is for Windows. Use single quotes on Linux.
To relocate a virtual machine’s configuration file, but leave virtual disks
1
2
Run svmotion, for example:
svmotion
<conn_options>
- -datacenter='My DC'
- -vm='[old_datastore] myvm/myvm.vmx:new_datastore'
- -disks='[old_datastore] myvm/myvm_1.vmdk:old_datastore, [old_datastore] myvm/myvm_2.vmdk: old_datastore'
This command relocates the virtual machine's configuration file to new_datastore, but leaves the two disks (myvm_1.vmdk and myvm_2.vmdk) in old_datastore. The example is for Linux. Use double quotes on Windows. The square brackets surround the datastore name and do not indicate an optional element.