ESXi commands
check state
List All VMs on the Host
Get Information for a Specific VM
Get Configuration for a Specific VM
Get Summary for a Specific VM
Get Current Power State of a Specific VM
Power On a Specific VM
Power Off a Specific VM (Hard)
Shutdown a Specific VM
Reboot a Specific VM
List a Specific VM’s Snapshots
Unregister a VM from a ESX Host
Register a VM on a ESX Host
# vim-cmd solo/registervm path/to/.vmx
http://benincosa.org/blog/?p=266
Get IP address
esxcfg-info | grep IPv4
Importing images to ESXi
Use the elastic hosts script to download the disk image (refer to Elastic hosts on this wiki)
Convert the raw disk to vmdk
qemu-img convert -f raw -O vmdk /home/cameron/eh-test /home/cameron/eh-test.vmdk
Copy the vmdk file to the ESXi server's datastore
scp /home/cameron/gax/eh-test.vmdk root@192.168.1.105:/vmfs/volumes/datastore1/
Create the new vm specifying the already configured disk using the custom setup.
Increase disk size
Stop the VM
Log into the ESXi server and stretch the disk
vmkfstools -X 10G /vmfs/volumes/datastore1/eh-test.vmdk
The above will extend the disk to 10 Gigabytes
Start the VM
Log into the guest and resize the filesystem
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/hda 1010M 737M 226M 77% /
[root@localhost ~]# resize2fs -p /dev/hda 10G
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/hda is mounted on /; on-line resizing required
Performing an on-line resize of /dev/hda to 2621440 (4k) blocks.
The filesystem on /dev/hda is now 2621440 blocks long.
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/hda 9.9G 738M 8.7G 8% /
For LVM disks
Follow first step in esxi to stretch the vmdk file.
Add a new partition with fdisk
Add this partition to the volume group
Extend the volume group
Resize partition
pvscan
ls -al /dev/sda*
fdisk /dev/sda
ls -al /dev/sda*
reboot
ls -lah /dev/sda*
pvcreate /dev/sda3
vgextend VolGroup00 /dev/sda3
vgdisplay
lvextend -L +88G /dev/VolGroup00/LogVol00
df -h
resize2fs /dev/VolGroup00/LogVol00
df -h
# vim-cmd vmsvc/getallvms
# vim-cmd vmsvc/get.guest 30
# vim-cmd vmsvc/power.off 30
# vim-cmd vmsvc/get.config 30
# vim-cmd vmsvc/unregister 30
# vim-cmd vmsvc/get.summary 30
# vim-cmd vmsvc/power.reset 30
# vim-cmd vmsvc/power.getstate 30
# vim-cmd vmsvc/power.shutdown 30
# vim-cmd vmsvc/power.on 30
# vim-cmd vmsvc/get.snapshot 30