Fandom

The Sysadmin Wiki

VMware

157pages on
this wiki
Add New Page
Talk0 Share

VMware is a virtual machine. There are both freeware and paid versions available.


Editions Edit

Freeware Edit

Disk tools Edit

Create disk Edit

You can either download a 21 KB zip file with all sorts of ready VMware images or if you want custom sizes, you can create your own with the following command:

qemu-img create -f vmdk harddisk.vmdk 30G

This command results in a 3.9 MB file, which can be expanded to up to 30 GB.

Convert disk Edit

VMware VMDK disks can be converted between the various formats with vmware-vdiskmanager, e.g. to a single growable type VMDK:

vmware-vdiskmanager -r from.vmdk -t 0 to.vmdk


Shrink disk Edit

VMware growable harddrives can end up being bigger than what's on them, especially if it's just converted from a fixed size VMDK, which is why vmware-vdiskmanager can shrink disks:

vmware-vdiskmanager -k disk.vmdk

NB: Doesn't seem to be available on the Linux version.

Expand disk Edit

VMware server 2 Edit

  • Log on to the web management interface
  • Choose the VM on the left hand side
  • Make sure the VM is shut down
  • Click on the disk you want to expand and choose edit
  • Click on increase capacity and choose the size you want
  • Remember to expand the partition on the client, this can e.g. be done on an Ubuntu LiveCD or in Vista it can be done directly in the Disk Management tool

User identification issue Edit

VMware server 2 seems to request user identification repeatedly on some setups. There is a thread on this issue on the VMware forum.

VMware ESXi on a USB disk Edit

You can install VMware ESXi as a USB boot disk and therefore be able to start up an emergency VMware server on any compatible machine without formatting its harddisk. This makes any panic situation alot easier and takes very little effort.

You need to open the ISO file for the VMware installation with something like file-roller (archive manager) for Ubuntu or 7-zip for Windows, then open up install.tgz and in there open /usr/lib/vmware/installer/VMware-VMvisor-big-3.5.0_Update_3-123629.i386.dd.bz2 and extract the .dd file inside it.

You need to image this .dd file onto a USB disk with e.g. dd on Linux by using the command dd if=/home/sysadmin/vmware.dd of=/dev/sdc (if /dev/sdc is your USB disk).

You can then partition the rest of the available space on the USB disk for extra storage. The VMware ESXi server itself requires about 700MB on the USB disk.

Managing ESXi server from Linux Edit

Enable SSH under "Troubleshooting Options" in the dcui or under configuration -> security profile -> 'properties' on both services and firewall and then you can run CLI commands directly on the ESXi server over the network.

ESXi license Edit

See current license info:

vim-cmd vimsvc/license --show

Set license (e.g. the free ESXi license):

vim-cmd vimsvc/license --set "$LICENSE_KEY"

Common host settings Edit

Hostname (2nd command makes sure to register hostname to DNS):

esxcli system hostname set --host=$HOSTNAME
esxcli system settings advanced set -o /Misc/PreferredHostName -s $HOSTNAME

IP address Edit

To see the current NIC settings on the host:

esxcfg-vmknic -l

To set a static IP address for the "Management Network" interface on the host (will immediately switch over, so you need to re-connect on the new IP address afterwards):

esxcfg-vmknic -i 10.0.0.10 -n 255.255.255.0 "Management Network"


Mount NFS share Edit

vim-cmd hostsvc/datastore/nas_create $localname $hostname $remotepath $rwsetting

Settings:

localname: Local (ESXi server) mounted name for share
hostname: Hostname or IP of NFS server
remotepath: Path on NFS server to mount (e.g. /fish)
rwsetting: 0 for RW or 1 for readonly

Creating a VM Edit

  • Create folder (e.g. in datastore1 with folder name newvm)
mkdir /vmfs/volumes/datastore1/newvm
  • Create disk (e.g. 40GB)
vmkfstools -c 40G -a lsilogic /vmfs/volumes/datastore1/newvm/disk0.vmdk
vi /vmfs/volumes/datastore1/newvm/vm.vmx
  • Register the VM
vim-cmd solo/registervm /vmfs/volumes/datastore1/newvm/vm.vmx
  • Verify that it's added
vim-cmd vmsvc/getallvms

Note: Check power state:

vim-cmd vmsvc/power.getstate $vmid
  • Power it on
vim-cmd vmsvc/power.on $vmid

If you've set it up in the .vmx file, you can now connect to it with VNC. Example conf:

RemoteDisplay.vnc.enabled = "True"
RemoteDisplay.vnc.port = "5901"
RemoteDisplay.vnc.password = "Super_secret.passw0rd!,,/"

Keep in mind that VNC is not opened in the vmware proxy by default, so you should either open it or preferrably ssh proxy your way in.

Or you can find the guests IP address, in order to connect directly to the guest, with this command:

vim-cmd vmsvc/get.guest $vmid | grep ipAddress | head -n1


Insert VMware tools Edit

vim-cmd vmsvc/tools.install $vmid

Set NTP settings Edit

To enable NTP, set /etc/ntp.conf with the following contents:

restrict default kod nomodify notrap nopeer
restrict 127.0.0.1
driftfile /etc/ntp.drift

server pool.ntp.org

On ESXi 5.1+ you need to enable the NTP client in the firewall:

esxcli network firewall ruleset list | grep '^ntpClient  *false$' && esxcli network firewall ruleset set -r ntpClient -e true

Then restart the ntp service for it to take effect:

/etc/init.d/ntpd restart

See also Edit

External links Edit

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.