Search This Blog

Monday, 24 January 2011

Useful vMA commands




NFS Storage

If you are connecting an NFS share to your ESX(i) server, use the command vicfg-nas

To see what NFS datastores are connected to a host, use

  • vicfg-nas -h esxhostname/ip address -l
  • e.g. vicfg-nas -h esx.test.com -l

To add a datastore to a host

  • vicfg-nas -h ESXhostname/ip address -a "Datastore name" -o NFS Servername/ip address -s sharename
  • vicfg-nas -h esx.test.com -a "NFS datastore" -o nfs.test.com -s /mnt/nfs

To delete a datastore from a host

  • vicfg-nas -h ESXhostname/ip address -d "Datastore name"
  • e.g. vicfg-nas -h esx.test.com -d "NFS datastore"

Virtual Machine vSwitch Configuration

To list vSwitches and portgroups use:

  • vicfg-vswitch -h ESXhostname/ip address -l
  • e.g. vicfg-vswitch -h esx.test.com -l
To create a vSwitch

  • vicfg-vswitch -h ESXhostname/ip address -a vSwitchname
  • e.g. vicfg-vswitch -h esx.test.com -a esxvSwitch

To delete a vSwitch

  • vicfg-vswitch -h ESXhostname/ip address -d vSwitchname
  • e.g. vicfg-vswitch -h esx.test.com -d esxvSwitch

To create a portgroup in a vSwitch
  • vicfg-vswitch -h ESXhostname/ip address -A portgroupname vSwitchname
  • e.g. vicfg-vswitch -h esx.test.com -A portgroup1 esxvSwitch

To configure a portgroup with a VLAN ID (this can't be done when the portgroup is created

  • vicfg-vswitch -h ESXhostname/ip address -v vlanid -p portgroupname vSwitchname
  • e.g. vicfg-vswitch -h esx.test.com -v 32 -p portgroup1 esxvSwitch

To delete a portgroup from a vSwitch

  • vicfg-vswitch -h ESXhostname/ip address -D portgroupname
  • e.g. vicfg-vswitch -h esx.test.com -D portgroup1

vmkernel vSwitch Configuration


The format is very similar to the vicfg-vswitch command
To list vmkernel portgroup details use:

  • vicfg-vmknic -h ESXhostname/ip address -l
  • e.g. vicfg-vmknic -h esx.test.com -l
To create a vmkernel portgroup (i.e. convert the portgroup from a Virtual Machine portgroup to a vmkernel portgroup)

  • vicfg-vmknic -h ESXhostname/ip address -a -i ipaddress -n netmask -p portgroupname
  • e.g. vicfg-vmknic -h esx.test.com -a -i 10.10.10.1 -n 255.255.255.0 -p portgroup1

To delete a vmkernel portgroup (i.e. convert it back to a Virtual Machine portgroup)

  • vicfg-vmknic -h ESXhostname/ip address -d -p portgroupname
  • e.g. vicfg-vmknic -h esx.test.com -d -p portgroup1

To enable a vmkernel portgroup for VMotion

  • vicfg-vmknic -h ESXhostname/ip address -E -p portgroupname
  • e.g. vicfg-vmknic -h esx.test.com -E -p portgroup1

No comments: