Vineeth's Blog

Bookmarks. Journal. Blog. Personal.

Archive for the tag “commands”

VMware KB: Moving a single virtual disk using Storage vMotion via the command line

VMware KB: Moving a single virtual disk using Storage vMotion via the command line

KB Article: 1004040

Purpose

By default, Storage vMotion moves the entire home directory of a virtual machine. This article provides the syntax to move a single virtual disk instead.

Resolution

VMware VirtualCenter 2.5

Ensure that you have the VMware vSphere CLI, VMware vSphere Management Assistant, or the VMware Infrastructure Management Assistant deployed in your environment. These tools are available for download under the Drivers and Tools section of the applicable version of ESX and can be deployed on Linux based or Microsoft Windows operating systems.

Run this command to move a virtual machine and its first disk to a new datastore, while leaving its second disk on the old datastore:
svMotion –datacenter=’My DC’ –vm=’[old_datastore] myvm/myvm.vmx:new_datastore’ –disks=’[old_datastore] myvm/myvm.vmdk:new_datastore,[old_datastore] myvm/myvm_1.vmdk:old_datastore’

Note: The type of quotation may vary depending on the platform on which the command is executed. Double quotations may be required in Windows implementations of the vSphere CLI.
This command uses three separate switches. They are:
  • The –datacenter switch that identifies the datacenter in which the virtual machine resides. For example:

    –datacenter= ’My DC’

    In this example, the datacenter identified is My DC .

  • The –vm switch that identifies three parameters:
    • The source datastore
    • The virtual machine
    • The destination datastore

For example:

–vm=’[old_datastore] myvm/myvm.vmx:new_datastore’

In this example, old_datastore represents the source datastore, myvm/myvm.vmx represents the virtual machine on the source datastore, and new_datastore represents the destination datastore.

This switch specifies where the virtual machine configuration files are stored in the destination datastore

  • The –disks switch that identifies six values:
    • The source datastore of first disk ( myvm.vmdk).
    • The virtual machine disk of first disk ( myvm.vmdk).
    • The destination datastore for first disk ( myvm.vmdk).
    • The source datastore of second disk ( myvm_1.vmdk).
    • The virtual machine disk of second disk ( myvm_1.vmdk).
    • The destination datastore for second disk ( myvm_1.vmdk).

For example:

–disks=’ [old_datastore] myvm/myvm.vmdk:new_datastore ,[old_datastore] myvm/myvm_1.vmdk:old_datastore’

In this example, you can see the source, destination, and location of 2 virtual disks separated by a comma.

For the first disk, old_datastore is the source datastore, myvm/myvm.vmdk represents the virtual disk file on the source datastore, and new_datastore represents the destination datastore for the first virtual disk file.

For the second disk, old_datastore is the source datastore, myvm/myvm_1.vmdk represents the virtual disk file on the source datastore, and old_datastore represents the destination datastore for the first virtual disk file.

Note: For the second disk, old_datastore is both the source and the destination datastore. This means that the second virtual disk remains in the original datastore and is not migrated along with the first disk and the virtual machine configuration files.

 
Caution: Any disks which are not explicitly defined in the syntax are migrated to the same location as the vmx file by default. You must specify all of the locations of all of the disks when migrating a subset of all virtual disks, this includes disks that will not be migrated.

 
 

VMware vCenter 4.x 

For more information, see the Migrate a Virtual Machine with Storage vMotion section in the vSphere Basic System Administration Guide.

Note: On step 5 in the procedure provided in the guide, click Advanced. In the Datastore column, select a destination for the configuration file and each virtual disk, and click Next.

Additional Information

 
For information about the VMware vSphere CLI, see the vSphere Command-Line Interface Documentation.

See Also

Linux commands: Using Linux Survival Commands

Linux Survival Commands:

Linux commands: Using Linux Survival Commands
 

Post Navigation