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 Web 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.
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:
If you use the vSphere Web 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.