VMware esxi 使用esxcli更新补丁以及维护模式切换/启动虚拟机

使用工具上传补丁到datastore, 然后使用ssh登陆进行更新.
首先需要切换到维护模式, 使用vSphere点击切换维护模式, 或者使用一下命令进入维护模式.

# vim-cmd /hostsvc/maintenance_mode_enter

输入一下命令进行更新补丁, 双引号内容为绝对目录路径.

# esxcli software vib install -d "/vmfs/volumes/Datastore/DirectoryName/PatchName.zip"
Where PatchName.zip is the name of the patch file you uploaded to the datastore.

后者如果虚拟机可在线http

# esxcli software vib install -v viburl
Where viburl is the URL to the http depot where VIB packages reside.
For example:
# esxcli software vib install -v https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/esx/vmw/vib20/tools-light/VMware_locker_tools-light_5.0.0-0.7.515841.vib

更新完毕后, 会显示一下参考结果.

Update Result
   Message: The update completed successfully, but the system needs to be rebooted for the changes to be effective.
   Reboot Required: true

然后输入reboot重启服务器.
重启完毕, 重新进去SSH管理, 以下命令离开维护模式.

# vim-cmd hostsvc/maintenance_mode_exit

如果发现虚拟机没有启动, 可以进去vSphere管理启动, 或者使用如下命令行查看和启动所需的虚拟机.

# vim-cmd vmsvc/getallvms

会列出如下例子所有的虚拟机和编号.

~ # vim-cmd vmsvc/getallvms
Vmid    Name                 File                      Guest OS          Version   Annotation
1      FTP      [datastore1] FTP/FTP.vmx         windows7Server64Guest   vmx-08
3      PPTP     [datastore1] PPTP/PPTP.vmx       otherLinuxGuest         vmx-08
9      Ubuntu   [datastore1] Ubuntu/Ubuntu.vmx   ubuntu64Guest           vmx-08

启动所需的编号为9的Ubuntu虚拟机.

~ # vim-cmd vmsvc/power.on 9

至此一般操作已经完成.
参考资料如下.

http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2008939
http://blog.csdn.net/hproc/article/details/7323683
http://yb2010.blog.51cto.com/2805760/1151122
http://blogs.yyes.chc.edu.tw/post/2/4866
http://blogs.yyes.chc.edu.tw/post/2/865
http://derflounder.wordpress.com/2013/09/26/updating-my-esxi-server-from-5-1-to-5-5/
http://www.gaojinbo.com/vmware-esx5-1-命令行启动虚拟机.html
Leave a Reply

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注