esxi ssh操作

esxi6.5服务器更换硬盘后,在web里原硬盘目录下的虚拟机为无效状态,在web里却无法删除。这个操作可以在ssh里操作。

首先打开服务器的ssh服务。登陆进去后,使用命令

vim-cmd? vmsvc 操作,首先,看看vmsvc有哪些功能:vim-cmd? vmsvc -help

vim-cmd vmsvc -help
Commands available under vmsvc/:
acquiremksticket                 get.snapshotinfo                 
acquireticket                    get.spaceNeededForConsolidation  
createdummyvm                    get.summary                      
destroy                          get.tasklist                     
device.connection                getallvms                        
device.connusbdev                gethostconstraints               
device.ctlradd                   message                          
device.ctlrremove                power.getstate                   
device.disconnusbdev             power.hibernate                  
device.diskadd                   power.off                        
device.diskaddexisting           power.on                         
device.diskextend                power.reboot                     
device.diskremove                power.reset                      
device.getdevices                power.shutdown                   
device.nvdimmadd                 power.suspend                    
device.nvdimmremove              power.suspendResume              
device.toolsSyncSet              queryftcompat                    
devices.createnic                reload                           
get.capability                   setscreenres                     
get.config                       snapshot.create                  
get.config.cpuidmask             snapshot.dumpoption              
get.configoption                 snapshot.get                     
get.datastores                   snapshot.remove                  
get.disabledmethods              snapshot.removeall               
get.environment                  snapshot.revert                  
get.filelayout                   snapshot.setoption               
get.filelayoutex                 tools.cancelinstall              
get.guest                        tools.install                    
get.guestheartbeatStatus         tools.upgrade                    
get.managedentitystatus          unregister                       
get.networks                     upgrade                          
get.runtime

虚拟机的一些操作都在这里了。?vim-cmd? vmsvc/getallvms 列出所有虚拟机。

vim-cmd vmsvc/getallvms
Skipping invalid VM '6'
Skipping invalid VM '7'
Vmid    Name               File                    Guest OS          Version   Annotation
1      win7-1    [SSD] win7-1/win7-1.vmx     windows7Guest           vmx-13              
2      win7-2    [SSD] win7-2/win7-2.vmx     windows7Guest           vmx-13              
3      xp        [SSD] xp/xp.vmx             winXPProGuest           vmx-13              
4      Win2003   [SSD] Win2003/Win2003.vmx   winNetEnterpriseGuest   vmx-13              
8      ikuai     [DISK] ikuai/ikuai.vmx      otherGuest              vmx-13              
9      fsgui     [DISK] fsgui/fsgui.vmx      centosGuest             vmx-13              

6、7是无效的,使用

vim-cmd vmsvc/unregister 6

OK,删除了!

此条目发表在待分类分类目录。将固定链接加入收藏夹。