الجمعة، 22 مايو 2009

VMware ESX Server 3 Commands Guide 2

The esxcfg- Commands
 
esxcfg-upgrade
esxcfg-upgrade -h --help
-g --convert-grub
-f --convert-fstab
-r --upgrade-pre-vmkernel
-o --upgrade-post-vmkernel


The -g option may only be used with the -r option.
 
esxcfg-vswitch
This command allows you to list, add, modify or delete virtual Ethernet switches on an ESX host. The simplest option with this command is the -l option to list the virtual switches defined on the host.
[root@esx1host root]# esxcfg-vswitch -l
If you are having problems with your ESX server after an in-place upgrade, this tool is invaluable in resolving the problems with service console networking.
The output of this command is initially a little intimidating. It is best to keep in mind the network topology:
Service Console IP Interface (vswif0) ---- connected to ----> Service Console Port on vSwitch ----- up-linked to ----> vmnic
Where a vmnic is a physical Ethernet adapter.
In following screenshot taken from the VI Client, we can see this ESX host has 2 connections to vSwitch0, the service console connection a VMkernel port connection.
 
If we wish to view the same information at the service console command line, we would use the esxcfg-vswitch command with the "-l" switch to list the defined virtual switches.
[root@esx1host root]# esxcfg-vswitch -l
Switch Name    Num Ports   Used Ports  Configured Ports  Uplinks
vSwitch0       32          4           32                vmnic0
  PortGroup Name      Internal ID    VLAN ID  Used Ports  Uplinks
  Service Console     portgroup0     0        1           vmnic0
  NFS access          portgroup1     0        1           vmnic0
If we wanted to add another virtual Ethernet switch, we would use esxcfg-vswitch command with the "-a" switch. Note that the -a is specified in lowercase. Take care to ensure you have specified lowercase because uppercase A performs a different function with this command. So, lets add a new virtual switch to our ESX host called vSwitch1 and then list the switches to check our command has worked ok.
[root@esx1host root]# esxcfg-vswitch -a vSwitch1
[root@esx1host root]# esxcfg-vswitch -l
Switch Name    Num Ports   Used Ports  Configured Ports  Uplinks
vSwitch0       32          4           32                vmnic0
  PortGroup Name      Internal ID    VLAN ID  Used Ports  Uplinks
  Service Console     portgroup0     0        1           vmnic0
  NFS access          portgroup1     0        1           vmnic0
Switch Name    Num Ports   Used Ports  Configured Ports  Uplinks
vSwitch1       64          0           64
  PortGroup Name      Internal ID    VLAN ID  Used Ports  Uplinks
Notice that the number of ports on the virtual switch is 64 on the newly created switch. The original virtual switch has only 32. This difference arises between creating the switch in the VI Client or the command line. Anyway, if you are like me and you can never remember which case of the letter "a" to use when adding a virtual switch, then use the esxcfg-vswitch command with the --add switch when creating a new switch like this:
esxcfg-vswitch --add vSwitch2
which I think is a little clearer to understand.
Now if we want to add a portgroup to the new virtual switch we have created, we can use the esxcfg-vswitch -A command. It does not matter whether you are creating a service console port, a VM port group or a VMkernel port when creating a port group; the way we create the connection to the virtual switch always starts out the same in the command line. Only after creating the port group do we then specify if it is to be anything other than a VM port group. In the following commands, we add a new portgroup called "Production" on the virtual switch vSwitch1.
[root@esx1host root]# esxcfg-vswitch -A "Production" vSwitch1
[root@esx1host root]# esxcfg-vswitch -l
Switch Name    Num Ports   Used Ports  Configured Ports  Uplinks
vSwitch0       32          4           32                vmnic0
  PortGroup Name      Internal ID    VLAN ID  Used Ports  Uplinks
  Service Console     portgroup0     0        1           vmnic0
  NFS access          portgroup1     0        1           vmnic0
Switch Name    Num Ports   Used Ports  Configured Ports  Uplinks
vSwitch1       64          0           64
  PortGroup Name      Internal ID    VLAN ID  Used Ports  Uplinks
  Production          portgroup2     0        0
Alternatively you could use the following command to add a port group to a virtual switch.
[root@esx1host root]# esxcfg-vswitch --add-pg="Production" vSwitch1
This alternative switch of using --ad-pg I think is clearer for understanding what the command is doing. The --add-pg option can clearly be seen to add a portgroup to a virtual switch, and again is simpler to understand than just "-A". The portgroup name in our example is called "Production", but it can be what you want. We recommend adoption of a standard across all your virtual infrastructure. I have seen somnts align their portgroup names with the IP subnets, so you could have a portgroup called something like "192.168.1.0 subnet".
Although we have now created a new virtual switch and have created a VM port group on it, the virtual switch itself does not have any uplinks. Remember that when we bind a physical network adapter to a virtual switch we are uplinking a vmnic to the switch and the switch then "owns" that adapter, i.e. it is not available to be used by any other virtual switches. We perform the uplink by using the esxcfg-vswitch command with the -L switch for link.
[root@esx1host root]# esxcfg-vswitch -L vmnic1 vSwitch1
So in one simple command we have linked the physical network adapter vmnic1 to our new virtual ethernet switch vSwitch1. If we then realised we had used the wrong physical adapter, we can just as easily unlink with -U. In the next example, we swap the uplinked vmnic1 for an alternative adapter vmnic2
[root@esx1host root]# esxcfg-vswitch -U vmnic1 vSwitch1
[root@esx1host root]# esxcfg-vswitch -L vmnic2 vSwitch1
This changing of vmnic bound to a virtual switch is often required post-installation, as we may select the wrong physical adapter to use for the service console during the install and need to correct our configuration before we can connect to our host with VI client!
esxcfg-auth
Configures the service console authentication options including NIS, LDAP, Kerberos and Active Directory.
 
esxcfg-info
Produces an enormous amount of information about the ESX host. You really need to pipe this to a file for closer examination!
[root@esx1host root]# esxcfg-info >esxinfo.txt
 
esxcfg-mpath
Manages storage multi-pathing just as the vmkmultipath utility did in previous versions of ESX Server. In the example below we are using the -l switch to list the storage and paths.
[root@esx1host tools-isoimages]# esxcfg-mpath -l

Disk vmhba0:0:0 /dev/cciss/c0d0 (69459MB) has 1 paths and policy of Fixed
Local 2:1.0 vmhba0:0:0 On active preferred

Disk vmhba1:0:0 (0MB) has 1 paths and policy of Most Recently Used
FC 10:1.0 210000e08b846a72<->5006016930221397 vmhba1:0:0 On active preferred

Disk vmhba1:0:6 /dev/sda (9216MB) has 1 paths and policy of Most Recently Used
FC 10:1.0 210000e08b846a72<->5006016930221397 vmhba1:0:6 On active preferred

Disk vmhba1:0:21 /dev/sdb (10240MB) has 1 paths and policy of Most Recently Used
FC 10:1.0 210000e08b846a72<->5006016930221397 vmhba1:0:21 On active preferred
 
esxcfg-resgrp
Used to manage the new ESX feature called resource groups. This command can add, remove or modify existing resource groups.
 
esxcfg-hbadevs
The esxcfg-vmhbadevs command is used to list the equivalent Linux device names for the visible disk devices that the VMkernel references using vmhba notation.
[root@esx1host root]# esxcfg-vmhbadevs
vmhba0:0:0    /dev/sda
vmhba0:0:1    /dev/sdb
vmhba0:0:2    /dev/sdc
vmhba0:0:3    /dev/sdd
vmhba2:0:0    /dev/sde
vmhba2:1:0    /dev/sdf
If we use this command with the –m switch, then we only list the LUNs which contain VMFS partitions. Alongside the Linux device name, a long unique hexadecimal value is listed. This is the VMFS volume signature assigned by the new logical volume manager (LVM).
[root@esx1host root]# esxcfg-vmhbadevs -m
vmhba0:0:0:1 /dev/sda1 45407607-fbc43ced-94cb-00145e231ce3
vmhba0:0:2:1 /dev/sdc1 455b08a8-8af7fee3-daa9-00145e231e35
vmhba2:0:0:3 /dev/sde3 4559c75f-831d8f3e-bc81-00145e231e35
You can view these volumes in the directory /vmfs/volumes/
 
esxcfg-boot
Used to configure the GRUB options presented at boot time. One thing to note is that the new esxcfg commands will not run if you boot just into Linux. If you just want to query the boot settings, you can use the -q switch but this must be qualified with the keyword boot or vmkmod.
[root@esx1host root]# esxcfg-boot -q boot
272 2:;7:;10:; UUID=847199e4-d3c7-11da-8ef8-930e3d734c03 /vmlinuz-2.4.21-37.0.2.ELvmnix /initrd-2.4.21-37.0.2.ELvmnix.img

[root@esx1host root]# esxcfg-boot -q vmkmod
vmkapimod vmkapimod
vmklinux linux
cciss.o scsi
tg3.o nic
qla2300_7xx.o fc
This is also used if you making modifications to VMkernel device drivers defaults. For example, if you were modifying the queue depth for a fibre HBA, you would likely be using esxcfg-module. Then to rebuild the boot image you would enter
[root@esx1host root]# esxcfg-boot -m
After which, you would do a reboot to test the update to the boot image had worked.




See all the ways you can stay connected to friends and family

ليست هناك تعليقات: