近来学习了VMWARE ESX下的相关命令,现记录下一些主要的,以便以后可以温故而知新。
man -k esx
man -k vmware
ls /usr/bin | grep vm
ls /usr/sbin | grep vm
find /vmfs \( -name "*.vmdk" -a ! -name "*flat.vmdk" -a ! -name "*-s[0-9][0-9][0-9].vmdk" -a ! -name "*delta.vmdk" \) -exec grep CID {} \;
find /vmfs \( -name "*.vmdk" -a ! -name "*flat.vmdk" -a ! -name "*-s[0-9][0-9][0-9].vmdk" -a ! -name "*delta.vmdk" \) -exec grep -l 61f41183 {} \;
find /vmfs \( -name "*.vmdk" -a ! -name "*flat.vmdk" -a ! -name "*-s[0-9][0-9][0-9].vmdk" -a ! -name "*delta.vmdk" \) | while read line; do
echo $line
grep CID $line
echo
done
esxcfg-vmhbadevs -q
esxcfg-vmhbadevs -m
fdisk -l | grep Disk
cd /vmfs/volumes; for i in `ls -F |grep /$`; do (vmkfstools -P $i; echo); done
esxcfg-mpath -a
esxcfg-mpath -l
esxcfg-vmhbadevs -q
cd /proc/vmware/config; for i in `find . -type f`; do esxcfg-advcfg -g ${i#*.}; done
for i in `awk -F[/\ ] '/adv/ {print "/"$3"/"$4}' /etc/vmware/esx.conf`; do esxcfg-advcfg -g $i ;done
esxcfg-info -o
vm-support
ps -efwww | grep vmx
service mgmt-vmware restart
vmware-cmd /vmfs/volumes/47c460ed-4173699d-e7e4-001b7837984c/99.1.73.148_Web03_Backup/99.1.73.148_Web03_Backup.vmx getconfig ide0:0.deviceType
vmware-cmd /vmfs/volumes/47c460b8-5263ce88-bb3a-001b7837984c/99.1.72.44_BServer/99.1.72.44_BServer.vmx getconfig "ide0:0.deviceType"
for i in `vmware-cmd -l`; do (echo $i; vmware-cmd $i getstate;echo);done
for i in `vmware-cmd -l`; do (echo $i; vmware-cmd $i getheartbeat;echo);done
for i in `vmware-cmd -l`; do (echo $i; vmware-cmd $i getuptime;echo);done
for i in `vmware-cmd -l`; do (echo $i; vmware-cmd $i gettoolslastactive;echo);done
for i in `vmware-cmd -l`; do (echo $i; vmware-cmd $i getguestinfo ip;echo);done
for i in `vmware-cmd -l`; do (echo $i; vmware-cmd $i getproductinfo platform;echo);done
for i in `vmware-cmd -l`; do (echo $i; vmware-cmd $i getproductinfo product;echo);done
for i in `vmware-cmd -l`; do (echo $i; for j in product platform build majorversion minorversion;do vmware-cmd $i getproductinfo $j;done;echo);done
for i in `vmware-cmd -l`; do (echo $i; vmware-cmd $i getresource cpu.number;echo);done
cat 1 | awk '$1~/^cpu/ || $1~/^mem/ || $1~/^disk/ || $1~/^net/ {print $1} END{print "worldid\npid\nuptime"}' |sed -e 's/</${/' -e 's/>/}/'
for i in `vmware-cmd -l`; do
HTL=`vmware-cmd $i getresource disk.HTL 2>/dev/null| awk '{print $NF}'`
HTL=${HTL:=<HTL>}
mac=`vmware-cmd $i getresource net.adapters 2>/dev/null| awk '{print $NF}'`
mac=${mac:=<mac>}
echo $i
for j in `cat <<!
cpu.number
cpu.emin
cpu.extrasec
cpu.syssec
cpu.uptime
cpu.usedsec
cpu.waitsec
cpu.affinity
cpu.htSharing
cpu.max
cpu.min
cpu.shares
mem.active
mem.cpt-tgt
memory
mem.cptread
mem.mctltgt
mem.memctl
mem.overhd
mem.ovhdmax
mem.shared
mem.size
mem.sizetgt
mem.swapin
mem.swapout
mem.swapped
mem.swaptgt
mem.affinity
mem.max
mem.min
mem.shares
disk.HTL
disk.${HTL}.KBread
disk.${HTL}.KBwritten
disk.${HTL}.busResets
disk.${HTL}.cmds
disk.${HTL}.cmdsAborted
disk.${HTL}.reads
disk.${HTL}.writes
disk.${HTL}.shares
net.adapters
net.${mac}.totKBRx
net.${mac}.totKBTx
net.${mac}.totPktsRx
net.${mac}.totPktsTx
worldid
pid
uptime
!
`; do (vmware-cmd $i getresource $j 2>/dev/null || echo $j);done
echo
done
vmware-cmd /vmfs/volumes/47c460ed-4173699d-e7e4-001b7837984c/99.1.73.148_Web03_Backup/99.1.73.148_Web03_Backup.vmx getresource disk.vmhba1:0:3.KBread
esxcfg-boot -h
esxcfg-boot -q vmkmod
esxcfg-boot -q boot
[root@shoistvm07 config]# man -k esx
Hyper-Threading [hyperthreading] (8) - VMware ESX Server Hyper-Threading support
NUMA -- Non-Uniform Memory Access [numa] (8) - VMware ESX Server NUMA support
cpu (8) - VMware ESX Server CPU resource management
diskbw (8) - VMware ESX Server disk bandwidth resource management
esxcfg-advcfg (8) - VMware ESX Server Advanced Configuration Option Tool
esxcfg-auth (8) - VMware ESX Server Network Management Utility
esxcfg-dumppart (8) - VMware ESX Server diagnostic partition configuration tool
esxcfg-firewall (8) - VMware ESX Server Firewall Configuration Tool
esxcfg-info (8) - VMware ESX Server Info tool
esxcfg-module (8) - VMware ESX Server Advanced Configuration Option Tool
esxcfg-mpath (8) - VMware ESX Server multipathing information
esxcfg-nas (8) - VMware ESX Server NAS configuration tool
esxcfg-nics (8) - VMware ESX Server Physical NIC information
esxcfg-resgrp (8) - VMware ESX Server resource group manipulation
esxcfg-route (8) - VMware ESX Server VMkernel IP stack default route Management Tool
esxcfg-swiscsi (8) - VMware ESX Server Software iSCSI configuration Tool
esxcfg-vmhbadevs (8) - VMware ESX Server SCSI HBA tool
esxcfg-vmknic (8) - VMware ESX Server VMkernel NIC configuration Tool
esxcfg-vswif (8) - VMware ESX Server Service Console NIC configuration Tool
esxcfg-vswitch (8) - VMware ESX Server Virtual Switch Configuration tool
esxtop (1) - display ESX Server resource utilization statistics
esxupdate (8) - VMware ESX Server software maintenance tool
mem (8) - VMware ESX Server memory resource management
net (8) - VMware ESX Server network interface management
storageMonitor (1) - Monitors sense errors experienced by storage devices attached to VMware ESX Server
vmkfstools (1) - VMware ESX Server file system management tool
[root@shoistvm07 config]#
[root@SHOISTVMW02 bin]# ls /usr/sbin | grep vm
esxcfg-vmhbadevs
esxcfg-vmknic
vmkchdev
vmkdump
vmkerrcode
vmkfstools
vmkiscsid
vmkiscsi-device
vmkiscsi-iname
vmkiscsi-ls
vmkiscsi-tool
vmkiscsi-util
vmkloader
vmkload_mod
vmklogger
vmkpcidivy
vmkping
vmkuptime.pl
vmres.pl
vmsnap_all
vmsnap.pl
vmware-authd
vmware-hostd
vmware-webAccess
[root@SHOISTVMW02 bin]# ls /usr/bin | grep vm
vmstat
vm-support
vmware
vmware-autostart.pl
vmware-cmd
vmware-config.pl
vmware-watchdog
[root@SHOISTVMW02 bin]#
[root@shoistvm07 D_sna_test]# esxcfg-vmhbadevs -q
vmhba0:0:0 /dev/cciss/c0d0
vmhba1:0:0 /dev/sda
vmhba1:0:1 /dev/sdb
vmhba1:0:2 /dev/sdc
vmhba1:0:3 /dev/sdd
vmhba1:0:4 /dev/sde
[root@shoistvm07 D_sna_test]# esxcfg-vmhbadevs -m
vmhba0:0:0:5 /dev/cciss/c0d0p5 47b9f8ca-593e1c09-973c-001b7837984c
vmhba1:0:0:1 /dev/sda1 47b280f9-6b47fc1d-8b36-001b78374ef4
vmhba1:0:1:1 /dev/sdb1 47b8b14e-8558d815-fc56-001b78374ef4
vmhba1:0:2:1 /dev/sdc1 47c460b8-5263ce88-bb3a-001b7837984c
vmhba1:0:3:1 /dev/sdd1 47c460ed-4173699d-e7e4-001b7837984c
vmhba1:0:4:1 /dev/sde1 47c4605f-d143d860-9320-001b7837984c
[root@shoistvm07 D_sna_test]# fdisk -l | grep Disk
Disk /dev/sda: 549.7 GB, 549755813888 bytes
Disk /dev/sdb: 1099.5 GB, 1099511627776 bytes
Disk /dev/sdc: 1099.5 GB, 1099511627776 bytes
Disk /dev/sdd: 1099.5 GB, 1099511627776 bytes
Disk /dev/sde: 549.7 GB, 549755813888 bytes
Disk /dev/cciss/c0d0: 146.7 GB, 146778685440 bytes
[root@shoistvm07 D_sna_test]# cd /vmfs/volumes; for i in `ls -F |grep /$`; do (vmkfstools -P $i; echo); done
VMFS-3.21 file system spanning 1 partitions.
File system label (if any): CX3_40_LUM100
Mode: public
Capacity 549487378432 (262016 file blocks * 2097152), 309405417472 (147536 blocks) avail
UUID: 47b280f9-6b47fc1d-8b36-001b78374ef4
Partitions spanned:
vmhba1:0:0:1
VMFS-3.21 file system spanning 2 partitions.
File system label (if any): CX3_40_LUM200
Mode: public
Capacity 1098974756864 (1048064 file blocks * 1048576), 374504161280 (357155 blocks) avail
UUID: 47b8b14e-8558d815-fc56-001b78374ef4
Partitions spanned:
vmhba1:0:1:1
vmhba1:0:1:2
VMFS-3.21 file system spanning 1 partitions.
File system label (if any): storage1_96
Mode: public
Capacity 136902082560 (130560 file blocks * 1048576), 25647120384 (24459 blocks) avail
UUID: 47b9f8ca-593e1c09-973c-001b7837984c
Partitions spanned:
vmhba0:0:0:5
VMFS-3.21 file system spanning 1 partitions.
File system label (if any): CX3_40_LUM101
Mode: public
Capacity 549487378432 (262016 file blocks * 2097152), 166394331136 (79343 blocks) avail
UUID: 47c4605f-d143d860-9320-001b7837984c
Partitions spanned:
vmhba1:0:4:1
VMFS-3.21 file system spanning 1 partitions.
File system label (if any): CX3_40_LUM300_backup
Mode: public
Capacity 1099243192320 (262080 file blocks * 4194304), 672502120448 (160337 blocks) avail
UUID: 47c460b8-5263ce88-bb3a-001b7837984c
Partitions spanned:
vmhba1:0:2:1
VMFS-3.21 file system spanning 1 partitions.
File system label (if any): CX3_40_LUM400_backup
Mode: public
Capacity 1099243192320 (262080 file blocks * 4194304), 852563591168 (203267 blocks) avail
UUID: 47c460ed-4173699d-e7e4-001b7837984c
Partitions spanned:
vmhba1:0:3:1
[root@shoistvm07 volumes]#
[root@shoistvm07 etc]# esxcfg-mpath -a
vmhba1 500110a0001714de 14:0.0
[root@shoistvm07 etc]# esxcfg-mpath -l
Disk vmhba0:0:0 /dev/cciss/c0d0 (139979MB) has 1 paths and policy of Fixed
Local 6:0.0 vmhba0:0:0 On active preferred
Disk vmhba1:0:0 /dev/sda (524288MB) has 2 paths and policy of Most Recently Used
FC 14:0.0 500110a0001714de<->5006016141e07dae vmhba1:0:0 On active preferred
FC 14:0.0 500110a0001714de<->5006016941e07dae vmhba1:1:0 Standby
Disk vmhba1:0:1 /dev/sdb (1048576MB) has 2 paths and policy of Most Recently Used
FC 14:0.0 500110a0001714de<->5006016141e07dae vmhba1:0:1 Standby preferred
FC 14:0.0 500110a0001714de<->5006016941e07dae vmhba1:1:1 On active
Disk vmhba1:0:2 /dev/sdc (1048576MB) has 2 paths and policy of Most Recently Used
FC 14:0.0 500110a0001714de<->5006016141e07dae vmhba1:0:2 On active preferred
FC 14:0.0 500110a0001714de<->5006016941e07dae vmhba1:1:2 Standby
Disk vmhba1:0:3 /dev/sdd (1048576MB) has 2 paths and policy of Most Recently Used
FC 14:0.0 500110a0001714de<->5006016141e07dae vmhba1:0:3 Standby preferred
FC 14:0.0 500110a0001714de<->5006016941e07dae vmhba1:1:3 On active
Disk vmhba1:0:4 /dev/sde (524288MB) has 2 paths and policy of Most Recently Used
FC 14:0.0 500110a0001714de<->5006016141e07dae vmhba1:0:4 On active preferred
FC 14:0.0 500110a0001714de<->5006016941e07dae vmhba1:1:4 Standby
[root@shoistvm07 etc]# esxcfg-vmhbadevs -q
vmhba0:0:0 /dev/cciss/c0d0
vmhba1:0:0 /dev/sda
vmhba1:0:1 /dev/sdb
vmhba1:0:2 /dev/sdc
vmhba1:0:3 /dev/sdd
vmhba1:0:4 /dev/sde
[root@shoistvm07 etc]#