VMware Cloud Community
Dunfraggin
Contributor
Contributor

Can I view and manipulate an ESXi host system partition using PowerCLI

I had an ESXi 5.1 host which was having issues performing vMotions and it turns out that the host has run out of free space as it's reporting being unable to write in the /var/log/vmware/journal directory.

Unfortunately when I try to ssh onto the host it does not connect and also a shell console connection to the host hangs and does not even display a command prompt (just the heading).

My option now is to try to connect to the host via vCLI or PowerCLI and view the partitions and manually remove some files to allow me to place the host in maintenance mode so I can move the running VMs off this node to then address the issue permanently.  The trouble is that I'm not familiar with what commands I'd need to use in order to achieve this (if indeed it is possible?).

Does anyone have any pointers for me?

Many thanks in advance!

Reply
0 Kudos
6 Replies
LucD
Leadership
Leadership

You could use the plink.exe tool (from the PuTTY Suite) to connect to the console.

Then use the commands from KB1003564 to investigate the filesystems.


There are several plink.exe samples available in this community


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
Dunfraggin
Contributor
Contributor

Thanks LucD. 

I'm not sure that would work though as plink.exe would require a working ssh connection to the host I believe? (please correct me if that's not right Smiley Happy

At the moment I am unable to get ssh working as ideally if I could I'd just connect with WinSCP and remove files manually that way.

What I am hoping for are some CLI/PowerCLI commands that will let me view system partition free space and also to be able to then list contents of directories and remove files etc to free up enough space to allow either SSH to run or to be able to complete vMotions of the running VMs.

Many thanks.

Reply
0 Kudos
LucD
Leadership
Leadership

Yes, that would require SSH to be enabled. Is it ?

You can enable it with

Get-VMHost -Name MyEsx | Get-VMHostService |

        where {$_.Key -eq "TSM-SSH"} |

        Start-VMHostService -Confirm:$false


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
Dunfraggin
Contributor
Contributor

Yes I can enable SSH through the vcenter and directly on the host via cli but I cannot connect via ssh - it enables then disables, which I think is part of the disk space issue on the host.

I think I'm either stuck with finding a cli option or else a rather ungraceful restart of the host and restarting VMs on other hosts in the cluster.  Trying to avoid this as this host runs around 50 VMs at present so not a trivial process Smiley Happy

Reply
0 Kudos
LucD
Leadership
Leadership

Could it be that you have set UserVars.ESXiShellTimeOut to a very low value ?

You can check with

Get-VMHost | Select Name,
 
@{N="ESXiShellTimeout";E={Get-VMHostAdvancedConfiguration -VMHost $_ -Name UserVars.ESXiShellTimeOut | Select -ExpandProperty Values}}

A value of 0 means there is no timeout.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
Dunfraggin
Contributor
Contributor

The value is set at 0 and yet I am still unable to connect to the host. the firewall port is open also as I have connected to this host only recently via ssh so I am confident that the ssh service was running fine before this issue occurred.

Reply
0 Kudos