[VMware] How to use PXE deploy ESXi 6.5 or 6.7

Prepare :
1. tftp server , 載點
2. Web server , 我習慣用 hfs , 載點
3. ESXi 6.5 or 6.7 iso source , 載點
PS: 若 Serva也是不錯工具免費版目前最多佈署3個sessions,兼併很多角色Server , 載點

Procedure :

step01. Create tftp root directory (e.g. I create directory at c:\tmp\tftp_root )

step02.
> perform tftpd64.exe > Settings > DHCP ‘Boot File’ 加入一串 mboot.EFI
> 設定DHCP派送IP , IP pool start address (e.g. 我設定是 199.1.1.101開始,最多10組DHCP IP) ;需不需要Gateway再個案設定之. Mask (Opt 1) 設定為 255.255.255.0
tftpd_mboot.efi.jpg

step03. extract ESXi 6.5 or 6.7 ISO put under tftp directory (e.g. c:\tmp\tftp_root\ESXi67 )

step04. 將 ESXi source 目錄 \EFI\BOOT\BOOTX64.EFI 複製到你預設 tftp root directory底下,更名為 mboot.EFI (e.g. c:\tmp\tftp_root\mboot.EFI )

step05. copy ESXi source ‘ EFI\BOOT\BOOT.CFG ‘ put ur tftp root directory (e.g. c:\tmp\tftp_root\BOOT.CFG )

step06. edit BOOT.CFG
PS:刪除此範本所有的 ‘ / ‘ 假若我的安裝source ‘ESXi67’在 c:\tmp\tftp_root\ESXi67 ;我tftp root 錄路徑為 ‘ / ‘ ; 多加一串 ‘prefix=‘ ; 存檔後再複蓋 ESXi source \  底下BOOT.CFG
———————————BOOT.CFG Start———————————————
bootstate=0
title=Loading ESXi installer
timeout=5
prefix=ESXi67
kernel=b.b00
kernelopt=ks=http://199.1.1.1/ks/ks.cfg
modules=jumpstrt.gz — useropts.gz — features.gz — k.b00 — chardevs.b00 — user.b00 — procfs.b00 — uc_intel.b00 — uc_amd.b00 — vmx.v00 — vim.v00 — sb.v00 — s.v00 — ata_liba.v00 — ata_pata.v00 — ata_pata.v01 — ata_pata.v02 — ata_pata.v03 — ata_pata.v04 — ata_pata.v05 — ata_pata.v06 — ata_pata.v07 — block_cc.v00 — bnxtnet.v00 — brcmfcoe.v00 — char_ran.v00 — ehci_ehc.v00 — elxiscsi.v00 — elxnet.v00 — hid_hid.v00 — i40en.v00 — iavmd.v00 — igbn.v00 — ima_qla4.v00 — ipmi_ipm.v00 — ipmi_ipm.v01 — ipmi_ipm.v02 — iser.v00 — ixgben.v00 — lpfc.v00 — lpnic.v00 — lsi_mr3.v00 — lsi_msgp.v00 — lsi_msgp.v01 — lsi_msgp.v02 — misc_cni.v00 — misc_dri.v00 — mtip32xx.v00 — ne1000.v00 — nenic.v00 — net_bnx2.v00 — net_bnx2.v01 — net_cdc_.v00 — net_cnic.v00 — net_e100.v00 — net_e100.v01 — net_enic.v00 — net_fcoe.v00 — net_forc.v00 — net_igb.v00 — net_ixgb.v00 — net_libf.v00 — net_mlx4.v00 — net_mlx4.v01 — net_nx_n.v00 — net_tg3.v00 — net_usbn.v00 — net_vmxn.v00 — nhpsa.v00 — nmlx4_co.v00 — nmlx4_en.v00 — nmlx4_rd.v00 — nmlx5_co.v00 — nmlx5_rd.v00 — ntg3.v00 — nvme.v00 — nvmxnet3.v00 — nvmxnet3.v01 — ohci_usb.v00 — pvscsi.v00 — qcnic.v00 — qedentv.v00 — qfle3.v00 — qfle3f.v00 — qfle3i.v00 — qflge.v00 — sata_ahc.v00 — sata_ata.v00 — sata_sat.v00 — sata_sat.v01 — sata_sat.v02 — sata_sat.v03 — sata_sat.v04 — scsi_aac.v00 — scsi_adp.v00 — scsi_aic.v00 — scsi_bnx.v00 — scsi_bnx.v01 — scsi_fni.v00 — scsi_hps.v00 — scsi_ips.v00 — scsi_isc.v00 — scsi_lib.v00 — scsi_meg.v00 — scsi_meg.v01 — scsi_meg.v02 — scsi_mpt.v00 — scsi_mpt.v01 — scsi_mpt.v02 — scsi_qla.v00 — shim_isc.v00 — shim_isc.v01 — shim_lib.v00 — shim_lib.v01 — shim_lib.v02 — shim_lib.v03 — shim_lib.v04 — shim_lib.v05 — shim_vmk.v00 — shim_vmk.v01 — shim_vmk.v02 — smartpqi.v00 — uhci_usb.v00 — usb_stor.v00 — usbcore_.v00 — vmkata.v00 — vmkfcoe.v00 — vmkplexe.v00 — vmkusb.v00 — vmw_ahci.v00 — xhci_xhc.v00 — elx_esx_.v00 — btldr.t00 — weaselin.t00 — esx_dvfi.v00 — esx_ui.v00 — lsu_hp_h.v00 — lsu_lsi_.v00 — lsu_lsi_.v01 — lsu_lsi_.v02 — lsu_lsi_.v03 — native_m.v00 — qlnative.v00 — rste.v00 — vmware_e.v00 — vsan.v00 — vsanheal.v00 — vsanmgmt.v00 — tools.t00 — xorg.v00 — imgdb.tgz — imgpayld.tgz
build=
updated=0
———————————BOOT.CFG End———————————————-

說明:

prefix=ESXi67
kernel=b.b00  // PS. v6.7僅剩 b.b00 不若之前有 tboot.b00 檔案
kernelopt=ks=http://199.1.1.1/ks/ks.cfg // PS. 若有需要無人值守必要有作KickStart編輯; e.g. 密碼 ,

step07. clock hfs.exe , (e.g. My KickStart directory  hfs root put c:\tmp\tftp_root\ks )

step08. edit ks.cfg
———————————ks.cfg End———————————————-
#
# Sample scripted installation file
#
# Accept the VMware End User License Agreement
vmaccepteula
# Set the root password for the DCUI and Tech Support Mode
rootpw P@ssw0rd!
# Install on the first local disk available on machine
install –firstdisk –overwritevmfs
# Set the network to DHCP on the first network adapter
network –bootproto=dhcp –device=vmnic0

reboot

# A sample post-install script
%post –interpreter=python –ignorefailure=true
import time
stampFile = open(‘/finished.stamp’, mode=’w’)
stampFile.write( time.asctime() )
———————————ks.cfg End———————————————-
PS: About the Default ks.cfg Installation Script 可以參考 ‘ vsphere-esxi-67-installation-setup-guide.pdf page 77

 


Reference :
1. xenappblog – Automatically Install VMware ESXi 6.7 through PXE boot

2. Virtual Reality – Automating Esxi Deployment Using PXE Boot and Kickstart

3. VMware Docs – 使用 TFTP 對 ESXi 安裝程式進行 PXE 開機

4. VMware ESXi 6.7 Installation and Setup – VMware Docs

5. 通过PXE快速部署VMware ESXi 6.5

[VMware] 登入Windows版 vCenter 6.5 vSphere Web Client (Flash-base) 會一直跳出 “發生內部錯誤 – Error #1009″

在客戶升級了5.5U2 > 6.0 > 6.5U2 但居然會出現vCenter 5.5U1 Bug ;但這Bug在5.5U2已修正居然會出現不解啊 ><

情境: 使用 vSphere Web Client (Flash-base) login後會一直跳出 “發生內部錯誤 – Error #1009″ 錯誤訊息。

Workaround :

step01. 進入 C:\programdata\vmware\vCenterServer\data\vSphere Web Client\SerenityDB\

step02. 刪除 serenity 這個整個目錄

delete C:\programdata\vmware\vCenterServer\data\vSphere Web Client\SerenityDB\serenity

step03. 重啟vSphere Web Client服務即可
.\service-control –stop vspherewebclientsvc && .\service-control –start vspherewebclientsvc

step04. 確認服務處於running
.\service-control –status vspherewebclientsvc

Done.


Reference : VMware vSphere Web Client reports an internal error 1009 (2089949)

[VMware] vCenter Server 6.5 @Windows How to restart Web Client or Client

step01. c:\> C:\Program Files\VMware\vCenter Server\bin

step02. .\service-control –list  // check current all VMware service

step03. .\service-control –stop vspherewebclientsvc  // 停止 vSphere Web client 服務

step04. .\service-control –start vspherewebclientsvc // 啟動 vSphere Web client 服務

PS:
* vSphere Web Client 名稱(Flash-base) > vspherewebclientsvc
* vSphere Client 名稱(HTML5) > vsphere-ui

 

vmware-imagebuilder
VMware Image Builder Manager
vmware-cm
VMware Component Manager
vmware-vpxd
VMware vCenter Server
vimPBSM
VMware vSphere Profile-Driven Storage Service
applmgmt
VMware Appliance Management Service
vmware-statsmonitor
VMware Appliance Monitoring Service
vmware-rhttpproxy
VMware HTTP Reverse Proxy
vmware-vapi-endpoint
VMware vAPI Endpoint
lwsmd
Likewise Service Manager
vmafdd
VMware Authentication Framework
vmware-vsm
VMware vService Manager
vmonapi
VMware Service Lifecycle Manager API
vmware-perfcharts
VMware Performance Charts
vmware-updatemgr
VMware Update Manager
vmware-vmon
VMware Service Lifecycle Manager
vmware-vsan-health
VMware VSAN Health Service
vspherewebclientsvc
VMware vSphere Web Client
vmware-vpostgres
VMware Postgres
vmware-eam
VMware ESX Agent Manager
vmcam
VMware vSphere Authentication Proxy
vmware-mbcs
VMware Message Bus Configuration Service
vmware-vcha
VMware vCenter High Availability
vsphere-ui
VMware vSphere Client
vmware-content-library
VMware Content Library Service
vmware-sca
VMware Service Control Agent
vmware-netdumper
VMware vSphere ESXi Dump Collector
vmware-vpxd-svcs
VMware vCenter-Services
vmware-rbd-watchdog
VMware vSphere Auto Deploy Waiter

Reference :

  1.  How to stop, start, or restart vCenter Server 6.x services (2109881)

[VMware] vCSA 6.5 / 6.7 login Web Client no timeout

  • for Flash-Base
    step01 # vi /etc/vmware/vsphere-client/webclient.properties
    step02 找到將其改為0 > session.timeout = 0
    step03 # service-control –stop vsphere-client && service-control –start vsphere-client
  • for HTML5
    step01. # vi /etc/vmware/vsphere-ui/webclient.properties
    step02. 找到將其改為0 > session.timeout = 0
    step03. service-control –stop vsphere-ui && service-control –start vsphere-ui


    Reference :
    1. Increasing the VMware vSphere Web Client session timeout period (2040626)

[VMware] 收集ESXi Log 厭煩老是用WinSCP,能否無需Third-Party Tools取得

厭煩手邊老是忘了準備WinSCP 或還要丟 /var/log/底下到 Datastore 可以看到目錄去收集目錄,其實現在老早就可以用網頁方式直接下載。

Resolution:

step01.
https://ESXi-IP/host

step02.
輸入 root / esxi-password

step03.

esxi.jpg

[VMware] ESXi Configuration Issues “No coredump target has been configured. Host core dumps cannot be saved “

客戶近日二台新機Cisco UCS C200 M4 , ESXi 6.0出現了如下圖所示 Configuration Issues “No coredump target has been configured. Host core dumps cannot be saved "

vmware-configuration-issues-no-coredump-target-has-been-configured.jpg

(極不建議) 若不想要CoreDump則是可以忽略;而忽略方式為
> Host > Configuration > Advanced Settings > UserVars > SuppressCoredumpWarning “1″

 


Reference :

  1. Configuring a diagnostic coredump partition on an ESXi 5.x/6.x host (2004299)
  2. Provirtualzone – VMware: ESXi 5.5 update – No coredump target has been configured. Host core dumps cannot be saved
  3. TUX ROOT – Disable “No Coredump Target has been Configured. Host Core Dumps Cannot be Saved” Error on ESXi host
  4. 9to5it.com – Fix – No coredump target has been configured

[VMware] vCSA 6.5.x how to remove orphaned virtual machine

** ready PowerCLI 6.5 U1 or above **

在管理VM時發現有二台vCSA(orphaned)孤立狀況且無法使用GUI delete or remove .

orphaned-vm-001.jpg

Workaround > use PowerCLI

step01. open PowerCLI

step02.
%:\> Connect-VIserver -Server 10.10.10.200 -User {account} -Password {password}

step03.
%:\> Get-VM | select name | findstr /i “VMware vCenter Server Appliance*"

step04.
%:\> Remove-VM “VMware vCenter Server Appliance (1)"
%:\> Remove-VM “VMware vCenter Server Appliance"

Done.


(未實驗過)
vim-cmd /vmsvc/getallvms // get vmid

vim-cmd /vmsvc/unregister <Vmid>


Reference :

  1. VMware Cmdlet Reference
  2. HEX64 – How To Remove Invalid VMs From ESXi Using CLI
  3. VMware KB:1011468 – Deleting an orphaned virtual machine when the Remove option is not available
  4. ALTARO – How to deal with orphaned virtual machines

[VMware] Reclaim disk space Datastore & VM

若虛擬機器空間使用所謂 ‘ Thin Provisioned ‘ 常會遇到當初劃分500GB空間時,則是慢慢增長加大。當然對該虛擬機器的.vmdk也是正向增長。但會遇到一個問題是明明OS層佔用空間已達400GB時另外刪了將近200GB,卻發現.vmdk還是未減少。這是因為未將OS層作所謂空間回收(Reclaim)動作.

Resolution:

@OS level
[Windows] 下載 SDelete工具
01. cmd.exe
02. sdelete.exe -c –z [driver-letter]
PS:
-c > Clean free space. Specify an option amount of space to leave free for use by a running system.
z > Zero free space (good for virtual disk optimization)

利用vmwar-tools 工具需以administrator最高權限才能執行
01. “C:\Program Files\VMware\VMware Tools\VMwareToolboxCmd.exe" disk shrink c:\ d:\
[Linux]
利用vmwar-tools 工具需以root最高權限才能執行
# vmware-toolbox-cmd disk shrink {mount-point}
-RedHat series
# dd if=/dev/zero of=/[mounted-volume]/zeroes && rm -f /[mounted-volume]/zeroes

# sudo dd if=/dev/zero of=zero.file ; rm -f zero.dat

# cat /dev/zero > zero.dat; rm -f zero.dat

若是VMware Workstation
–GUI–
Disk Utilities > Compact

–CLI–先重組後壓縮

“C:\Program Files\VMware\VMware Workstation\vmware-vdiskmanager.exe" -r  -k D:\VM\test.vmdk -t 0 D:\VM\test-shrink.vmdk // PS: -r 重組 ; -k shrink

@Host level
PS: 可以online
最後在datastore再作個動作即達到整體瘦身囉
* 利用vMotion datastore 轉換過程為 ‘ Thin Provisioned

PS: 需關機才能作動
* ssh esxi
# vmkfstools -K /vmfs/volumes/{datastore-name}/{vm}/{vm}.vmdk

 

@針對LUN是Thin provisioning的話

check#1. esxcli storage core device vaai status get -d {naa.xxxxxxxxxxxxxxxxxxxxxxx} // 查看 Zero Status: support
check#2. esxcli storage core device list -d {naa.xxxxxxxxxxxxxxxxxxxxxxxx} // 查看Thin Provisioning Status:support

ESXi 5.0前用 vmkfstools -y

ESXi5.1~後用 esxcli storage vmfs unmap –volume-label=volume_label | –volume-uuid=volume_uuid (–reclaim-unit=number)
*sample*
# esxcli storage vmfs extent list

# esxcli storage vmfs unmap –volume-label=VM_Datastore
Devices backing volume 560e3db4-a6c9df25-6756-e41f132d2b98 do not support UNMAP
以上來看不支援此storage ;因為在check#1 得知它可能不是thin provisioning format


Reference:

  1. Master Dragon 的 Wiki – VMware Virtual Disk Shrink 將vmdk檔案縮小
  2. D R Y ! -geek~ VMWare 回收磁盘空间
  3. Black Manticore – Reclaim disk space from thin provisioned VMDK files in ESX
  4. vswitchzero – Using SDelete and vmkfstools to Reclaim Thin VMDK Space
  5. VMware Docs – 壓縮虛擬磁碟
  6. How to reclaim VMFS deleted blocks on thin-provisioned LUNs (2014849)
  7. sysadmintutorials.com – How to Reclaim Free Block Space from a Lun with VMware vSphere 5.5 and Netapp Cluster Mode

[VMware] How to install vCSA 6.5 & 6.7 on Workstation

step01. extract vCSA iso , into \vcsa\VMware-vCenter-Server-Appliance-6.7.0.12000-8832884_OVF10.ova

step02. Workstation open %\vcsa\VMware-vCenter-Server-Appliance-6.7.0.12000-8832884_OVF10.ova

step03.
匯入好之後暫不要開機

step04.
編輯 .vmx加入
——————————————————————————————-
guestinfo.cis.appliance.net.addr.family = “ipv4″
guestinfo.cis.appliance.net.mode = “static"
guestinfo.cis.appliance.net.pnid = “vcsa67.homelab.local"
guestinfo.cis.appliance.net.addr = “10.1.110.88″
guestinfo.cis.appliance.net.prefix = “24″
guestinfo.cis.appliance.net.gateway = “10.1.110.253″
guestinfo.cis.appliance.net.dns.servers = “10.1.130.1″
guestinfo.cis.appliance.root.passwd = “P@ssw0rd"
guestinfo.cis.appliance.ssh.enabled = “True"
guestinfo.cis.deployment.autoconfig = “True"
guestinfo.cis.appliance.ntp.servers = “time4.google.com"
guestinfo.cis.vmdir.password = “P@ssw0rd"
guestinfo.cis.vmdir.site-name = “default-site"
guestinfo.cis.vmdir.domain-name = “homelab.local"
——————————————————————————————-
PS: 發現以上有餵食失敗幾行 e.g.
guestinfo.cis.appliance.root.passwd = “P@ssw0rd"
guestinfo.cis.vmdir.password = “P@ssw0rd"
在開機後會發現密碼無法登入需重新reset

step05.Power-on vCSA

step06.Waiting os enter success

step07.Reset root password

step08.登入時看到畫面按下 ‘e’

step09.在 Linux開頭最後面按下 end 跳到後面 加入 rw init=/bin/bash

step10.按下 ‘F10’ boot

step11. // 建議作一下免後重置密碼無效
> ls -sh /var/log/audit
rm /var/log/audit/*.log

step12.
> whoami // check account is root
> passwd

step13.
umount /

step14.
reboot -f

step15.
confirm root account can login

step17.
https://10.1.110.88:5480 // start initiate

step18.
需調入 SSO domain , 最後即需一段時間即完成stage2

Done.


Reference:

  1. vmwarearena – How to Deploy vCenter Server appliance 6.5 on VMware Workstation 14
  2. enterprisedaddy – Deploy VCSA 6.5 on Workstation
  3. VMware KB: 2147144 – How to reset the lost or forgotten root password in vCenter Server Appliance 6.5