SVMotion Syntax

This is nothing earth-shattering; I just needed to record the syntax for the SVMotion command in the Remote CLI so that next time I need it six months from now, I’ll have an easy reference.

Here’s the syntax:

svmotion --datacenter=<DC Name> --url=https://<FQDN of VCMS>/sdk --username=<Username on VCMS> --password=<Password> --vm=[<Source datastore>] <Path to VMX file of VM>:<Destination datastore>

If any parameters have spaces in them—like the datacenter name or the path to the .VMX file—you’ll need to enclose those parameters in single quotes.

Tags: , , ,

  1. Gabriel’s avatar

    Are you sure it’s “smvotion”?

  2. Jase McCarty’s avatar

    I’ve used this before like this:

    A quick way to use this repeatedly, is to put this into a batch file with some wildcards.

    Here’s an example of a batch with some of the items that don’t change:
    svmotion –datacenter= –url=https:///sdk –username=%1 –password=%2 –vm=[%3] %4:%5

    Calling the batch would be something like:
    svmotion.bat username password SOURCEDATASTORE VMXPATH DESTDATASTORE

    Will save you some typing…

  3. Jase McCarty’s avatar

    Well, everthing didn’t take… Your site doesn’t like greater than/less than

    Here’s the contents of the .bat again:
    svmotion –datacenter=DCName –url=https://vcenterserver/sdk –username=%1 –password=%2 –vm=[%3] %4:%5

  4. slowe’s avatar

    Gabriel,

    Doh! Sorry about that. I’ve fixed it. Thanks for pointing that out!

    Jase,

    Thanks for the batch command, it looks quite helpful!

  5. Justin’s avatar

    You can also run svmotion –interactive and just answer the questions as it asks them. If you’re only running it once every 6 months, that’s a pretty easy way to remember what info it needs =)

  6. slowe’s avatar

    Justin,

    True, but when you have several VMs that need to be moved–as I do currently–the interactive process gets tedious and time-consuming.

  7. Chris Neil’s avatar

    Do you use the svmotion plugin from lostcreations? I find it really useful, though if VMware could’ve included it in vClient that would have been nicer. I would post a dload link but I can’t seem to find it right now.

  8. afokkema’s avatar

    Why not use the SVmotion plugin.

    I made a blogpost about this plugin http://ict-freak.nl/2008/11/21/vmware-storage-vmotion-the-easy-way/ (it’s in dutch).

  9. Sean Clark’s avatar

    Scott,
    How many VMs are you comfortable SVmotion-ing at a time per host, per datastore? I’m curious to at what point a performance degrades. I currently only need to do 1 or 2 at a time so I haven’t run into any problems yet.
    -Sean

  10. slowe’s avatar

    Chris and Arne,

    I have used the SVMotion plug-in in the past, but I try not to rely too much on that since I may end up at a customer’s site without it. Plus, I feel geekier when I use the command line…

    Sean,

    This is in a barebones lab environment with hand-me-down equipment, so I only run 1, maybe 2, at a time. It really all depends upon the architecture of your storage; depending on how its organized, you may be able to run more simultaneously.

  11. Blane’s avatar

    Keep in mind that it is recommended to not make more than 1 change at a time on any given LUN (power on VM, clone VM, storage VMotion, VCB backup, -anything that changes VMFS metadata). You can get into some interesting SCSI reservation errors that at best could power off a VM, or at worst ZAP it’s vmdisk or VMFS partition.

    This is a great read if you are worried about SCSI res issues:
    http://www.informit.com/articles/article.aspx?p=1156956&seqNum=2

  12. culbeda’s avatar

    Of course, you could use the new VI Toolkit for powershell. (v1.5)

    http://blogs.vmware.com/vipowershell/

    Some good videos that illustrate some of the changes:

    http://www.vimeo.com/user497641/videos

  13. Mike’s avatar

    I am tring to use SVMotion and I am unsure what my Datacenter name is. Can someone tell me what this field is looking for?

  14. Michael Mohr’s avatar

    Mike: The datacenter name is what you named the your Data Center within your Virtual Center, so it should be near the top of the hierarchy. :)

  15. Simon Mann’s avatar

    I’ve knocked up a vbscript which will svmotion a batch of VM’s and email the outcome of each svmotion

    http://communities.vmware.com/blogs/virtuallysi/2009/09/17/batch-svmotion-vbscript