Friday, October 21, 2011

reboot is not the same as init 6


Here’s an interesting Linux tidbit that not many ESX admins realize.
reboot is not the same as init 6
In Linux, the init 6 command gracefully reboots the system running all the K* shutdown scripts first, before rebooting.  The reboot command does a very quick reboot.  It doesn’t execute any kill scripts, but just unmounts filesystems and restarts the system.  The reboot command is more forceful.
So, should I use reboot or init 6?  – neither!  My advice is to use the shutdown command. shutdown will do a similar job to init 6, but it has more options and a better default action.  Along with kicking off an init 6, the shutdown command will also notify all logged in users (logged in at a tty), notify all processes the system is going down and by default will pause  for a set time before rebooting (giving you the chance to cancel the reboot if you realize that you made a mistake).  Jolly civil.
-
How does this advice apply to VMware ESX servers you ask?  Well I’m not a VMware kernel developer so to be honest I’m not the best person to ask (if you do know murky details, then please let us know in the comments).  However I will say this; I will always use shutdown -r first and foremost.  It’s just a better habit to get into.
Is there a difference on an ESX server? Yes, but as I said I’m entirely sure how it affects the VMkernel processes.  The reason I definitely know – a couple of times I’ve had to use the reboot command to force an unresponsive ESX shutdown -r.
P.S. This also applies to init 0 / halt (i.e. use shutdown -h instead).

No comments:

Post a Comment