check if linux is physical or virtual

with dmesg

dmesg | grep 'Hypervisor detected'

with dmidecode

dmidecode -s system-manufacturer

with lshw

lshw -class system
Advertisements

enable wol in vmware host

list network adapters

esxcli network nic list

check if network adapter supports wake-on-lan and it is enabled

esxcli network nic get -n vmnic0 | grep Wakeon

enable wol in network adapter, add this line before the line init 0 in local.sh file

vi /etc/rc.local.d/local.sh

ethtool -s vmnic0 wol g

change time vmware host

get system clock time

esxcli system time get

get hardware clock time

esxcli hardware clock get

Set the system time to 30 March 2017, 09:25

esxcli system time set -d 30 -M 03 -y 2017 -H 09 -m 25

Set the hardware clock time to 30 March 2017, 09:25

esxcli hardware clock set -d 30 -M 03 -y 2017 -H 09 -m 25

script to recalculate vmware disk size

#!/bin/bash
# Recalculate vmware thin disk size

# Creates zero-block file in all free disk space 
for i in $(df | grep '^/dev/' | awk '{print $6}'); do
  if [ $i == '/' ];then
    echo 'creating a file of blocks zeroed in:' ${i}zerofile
    dd if=/dev/zero of=${i}zerofile bs=4096; rm -f ${i}zerofile
  else
    echo 'creating a file of blocks zeroed in:' $i/zerofile
    dd if=/dev/zero of=$i/zerofile bs=4096; rm -f $i/zerofile
  fi
done

After run the command with the machine turned off in ESXi Host

vmkfstools --punchzero /vmfs/volumes/path-to-disk.vmdk

backup ou copiar vm para outro host vmware

Use o procedimento para fazer backup ou copiar uma VM para um outro host remoto VMware:

Exportar VM

1 – Conecte o vSphere Client no VMware Host 1

2 – Selecione a VM a ser copiada na lista de inventário

3 – No menu click em:

File => Export => Export OVF Template

Escolha um nome para o template, e o local onde o template será gravado.
Em Format selecione: Single file (OVA)

Fazer Deploy/Importar VM

4 – Conecte o vSphere Client no VMware Host 2

5 – No menu click em:

File => Deploy OVF Template

Selecione o arquivo OVA exportado no VMware Host 1 e prossiga com o deploy

6 – No vSphere Client ao ligar a VM importada pela primeira vez diga que foi movida para não ter que reconfigurar IPs

vSphere no Windows XP

vSphere Client no Windows XP não consegue se conectar a ESXHost. O procedimento abaixo resolve o problema.

1 – Entre no ESXHost

2 – Abra o arquivo config.xml

vi /etc/vmware/rhttpproxy/config.xml

3 – Adicione a entrada abaixo dentro ta tag ssl:

<cipherList>ALL</cipherList>
<ssl>
  <doVersionCheck> false </doVersionCheck>
  <useCompression>true</useCompression>
  <libraryPath>/lib/</libraryPath>
  <cipherList>ALL</cipherList>
</ssl>

4 – Reinicie o serviço rhttpproxy

/etc/init.d/rhttpproxy restart