Skip to end of metadata
Go to start of metadata
You are viewing an old version of this page. View the current version. Compare with Current  |   View Page History

How to use the vmadm command in the latest (Dec 13, 2011) release of SmartOS.

Listing VMs

Default fields + sort:

Same, but change the field order and add some more:

Same, but sort by ram in DESCENDING order then by CPU shares in ascending order:

Same but only list those with type=OS and ram=1* (1024 or 128 in this example):

Creating a new VM

alternatively, with the same file we could just use:

Getting a VMs properties

Lookup a VM by IP

same thing, but get an array of json as results:

Looking up all 128M VMs with an alias that starts with 'a' or 'b':

same thing, but json array output:

Updating a VM

Quota for OS VMs updates live without needing a restart:

Set the quota back and adjust the cpu_shares:

You can also do an update from JSON:

Add a NIC to a VM then remove it

First list the nics so you can see what we start with:

Then add a nic:

Show it's there (we'd need to reboot the VM to actually use it though):

change the IP:

list again:

Remove the new NIC:

Back where we started:

Stopping a VM




Starting a VM

(see above for before)


Rebooting a VM

Deleting a VM


delete, then list again:

If you are trying to delete a VM that is stuck in the ready state you will get the following error

Failed to delete d04c89fa-7375-4b6f-9a3b-44b0efb23289: delete failed after 5 attempts. (check the log for details

To fix this you can do the following

  • Find the zoneadmd process associated with this zone (I use ps aux | grep zoneadmd, the start of the UUID is written in the command line)
  • KILL IT WITH FIRE. or kill -9 <zoneadmd-pid>
  • Then get zoneadm to halt the zone: zoneadm -z <uuid> halt
  • vmadm delete <uuid>This has been fixed as of

See also

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.