Troubleshooting VMware

From Tuxunix
Jump to: navigation, search

Vma

Machine virtuel fournie par VMware, permettant de centralisé l'administration en ligne de commande de l'ensemble des ESX.

Commandes ESX

Networking

Infos Commandes
Afficher carte physique esxcfg-nics -l
Setter la vitesse et le mode esxcfg-nics -s speed -d duplex vswitch_name
Ajouter un virtual switch esxcfg-vswitch -a vswitch_name:#_ports
Vérifier si un vswitch exists esxcfg-vswitch -c vswitch_name
Ajouter un portgroup esxcfg-vswitch -A portgroup_name vswitch_name
Check si portgroup existe esxcfg-vswitch -C portgroup_name
Lien physique NIC pour un virtual switch esxcfg-vswitch -L vmnic# vswitch_name
Unlink physical NIC from a virtual switch esxcfg-vswitch -U vmnic# vswitch_name
Display virtual switch configuration esxcfg-vswitch -l
Add a VMkernel ports esxcfg-vmknic -a -i IP_addr -n netmask VMkernel_port_name
Display VMkernel ports esxcfg-vmknic -l
Set the VMkernel port gateway esxcfg-route gateway_IP_address
Display the VMkernel default gateway esxcfg-route
Add a service console interface (vswif) esxcfg-vswif -a -i IP_addr -n netmask -p sc_port_name vswif#
Display service console interface (vswif) esxcfg-vswif -l

iSCSI Storage

Infos Commandes
Display iSCSI software adapter settings esxcfg-swiscsi -q
Enable (-e) pr disable (-d) the iSCSI software adapter esxcfg-swiscsi -e OR esxcfg-swiscsi -d
Display the software iSCSI node name vmkiscsi-tool -I -l vmhba40
Display the software iSCSI node alias vmkiscsi-tool -k -l vmhba40
Discover iSCSI targets vmkiscsi-tool -D -a target_IP_address vmhba40
Display discover iSCSI targets vmkiscsi-tool -T -l vmhba40
Rescan for iSCSI LUNs esxcfg-rescan vmhba40
Display iSCSI LUNs vmkiscsi-tool -L -l vmhba40

Manage Datastores

Infos Commandes
List device file names associated with a server's LUNs esxcfg-vmhbadevs
Map VMFS volumes to their LUNs and vmhba name esxcfg-vmhbadevs -m
Create one or more partitions on a LUN fdisk device_file_name
Display the partition table for the specified LUN fdisk -l device_file_name
Create a VMFS volume vmkfstools -C vmfs3 -S VMFS_volume_label partition_address
Map lable names with physical VMFS volumes ls -l /vmfs/volumes
Change the VMFS volume label ln -sf /vmfs/volumes/UUID /vmfs/volumes/new_label_name
Display VMFS volume metadata vmkfstools -P -h /vmfs/volumes/volume_label
Extend a VMFS volume vmkfstools -Z VMFS_extent name_of_existing_VMFS
Remove a VMFS volume extent Recreate the VMFS volume
Display VMFS and service console filesystem usage vdf -h

Configure Services

Infos Commandes
Synchronize the VI Client to reflect command-line changes service mgmt-vmware restart

Configure Service Console Firewall

Infos Commandes
Display the current firewall settings esxcfg-firewall -q
Display the firewall settings for a specific service esxcfg-firewall -q service_name
Enable all incoming (or outgoing) ports esxcfg-firewall -allowIncoming (or -allowOutgoing)
Block all incoming (or outgoing) ports esxcfg-firewall -blockIncoming (or -blockOutgoing)
Enable (-e) or disable (-d) a service in the firewall esxcfg-firewall -e service_name -OR- esxcfg-firewall -d service_name
List all available services esxcfg-firewall -s
Open a port (not required for management use) in the firewall esxcfg-firewall -o port,protocol,direction,name
Close a port in the firewall esxcfg-firewall -c port,protocol,direction

Configure Password Aging

Infos Commandes
Configure password aging using pam_cracklib.so esxcfg-auth -usecrack=retires min_lengh lc uc d oc
Configure password aging using pam_passwdqc.so esxcfg-auth -usepamqc=N1 N2 min_passphrase_length N3 N4 match

Commands to protect your data using VCB

Infos Commandes
List ways to identify the VM to backup vcbVmName <hup> -s ipaddr:VM_IP_address
Perform a full VM backup vcbMounter <hup> -a name:VM_display_name -t fullvm -r directory_to_place_backup
Create a VM snapshot vcbSnapshot <hup> -c moref:moref_value snapshot_name
Get a list of disks in a VM snapshot vcbSnapshot <hup> -l ssid:snapshot_id
Remove a snapshot vcbSnapshot <hup> -d vmid_value ssid_value
Export a virtual disk vcbExport -d exported_virtual_disk_name -s virtual_disk_name
Restore an individual virtual disk vmkfstools -i exported_virtual_disk_name restored_virtual_disk_name
Restore a complete virtual disk (perform on service console only) vcbRestore <hup> -s directory_to_restore_to
Mount a virtual disk file (perform on VCB Proxy only) mountvm -d backed_up_virtual_disk_filename -cycleId mount_point_name
Unmount a virtual disk file (perform on VCB Proxy only) mountvm -u mount_point

Fault analysis tools

Infos Commandes
Restart a service service service_name restart
Display the last time the system was rebooted last reboot
Check IP connectivity ping ip_address_or_hostname
Check IP connectivity using the VMkernel stack vmkping ip_address
Gather debugging information (on ESX Server) vm-support
Gather debugging information (on VirtualCenter Server) cscript vc-support.wsf
Display ESX Server resource utilization esxtop
Capture performance snapshots vm-support -S -i time_between_snapshots -d snapshot_duration
Replay performance snapshots esxtop 6R vm_support_directory_path
Start VirtualCenter Server in standalone mode vpxd -s
Re-initialize VirtualCenter Server's database vpxd -d