VMware Cloud Community
tdubb123
Expert
Expert

proper way to shutdown esx server

what is the proper way to shutdown a esx server? I moved all vms to another host already

Reply
0 Kudos
9 Replies
ANSA
Expert
Expert

One way is to login to the console an type shutdown now

Reply
0 Kudos
Negatrev
Contributor
Contributor

Before shutting down it's best to switch the ESX host to Maintenance mode (has added benefit of automatically moving all VM's off the host)

vimsh -n -e /hostsvc/maintenance_mode_enter

bounce the ESX host

then bring it out of Maintenance mode with

vimsh -n -e /hostsvc/maintenance_mode_exit

with this method you don't have to start moving VM's back again as it will automate.

Reply
0 Kudos
TomHowarth
Leadership
Leadership

if you have VC then you can shut it down via there,

if you are directly connected to the VM Host via the VIC you can right click the node name and select shutdown or reboot if desired.

Alternatively you can at the console you can issue the following commands

shutdown -h now (this will shutdown the host machine)

shutdown -r now (this will reboot the host machine)

if you are ssh'd in you SU to root and issue the commands as shown above.

If you found this or any other post helpful please consider the use of the Helpfull/Correct buttons to award points

Kind Regards

Tom,

Tom Howarth VCP / VCAP / vExpert
VMware Communities User Moderator
Blog: http://www.planetvm.net
Contributing author on VMware vSphere and Virtual Infrastructure Security: Securing ESX and the Virtual Environment
Contributing author on VCP VMware Certified Professional on VSphere 4 Study Guide: Exam VCP-410
Reply
0 Kudos
tdubb123
Expert
Expert

I entered this command from the console

vimsh -n -e /hostsvc/maintenance_mode_enter

what do i do next? In VC, I still see this host online and not in maintenance mode

Reply
0 Kudos
tdubb123
Expert
Expert

ok after I entered this command

vimsh -n -e /hostsvc/maintenance_mode_enter

I went to the console and did a reboot

I see the vms migrated over to the other esx host.

is there a way for it to do a online migration instead of rebooting the vm?

Reply
0 Kudos
Negatrev
Contributor
Contributor

It usually takes few minutes after switching a server to maintenance mode before it starts vMotion on it's VM's. Either you're not waiting long enough, or more likely you're having a VC not updating issue which quite a few people get.

Only other reason could be you have some how disabled vMotioning off of a host in M-mode.

If it's the updating issue, you may also find some VM's have frozen (or blank) status 'traffic lights'. If you do then at the console of the host do

service mgmt-vmware restart

then

service vmware-vpxa restart

Give this a few minutes to catch up. If still no status, also restart the VC service on VC server. None of this should affect the running of your VM's on the host (unless you're running 3.0.1 and have VM's set to auto power off/power on). If this step brings back you 'traffic lights' then try switching to maintenance mode again (via comand line or in VC).

Reply
0 Kudos
russjar
Enthusiast
Enthusiast

telinit runlevel

VCP,MCSE NT4/W2k/W2k3, MCSA W2k3
Reply
0 Kudos
Schorschi
Expert
Expert

It is much easier on ESX 3.x to just use 'poweroff' it calls init level -6 the same way shutdown does.

Reply
0 Kudos
Lax617
Contributor
Contributor

@ Tom

Thanks, the worked. I have a bad server disconnected from the network. I was able to bring it up, but I am not used to managing the hosts outside of the vCenter GUI. Thanks again.

Reply
0 Kudos