Usually, I just do a sudo /sbin/shutdown now when in my VM and wait for it to logout into the bash shell. Then after that I just go to Power > Power Off. Is this the right way to shutdown my CentOS VM?

link|improve this question

71% accept rate
2  
If you see the message on the screen saying something like system has halted, then yes. – Randolph West Jan 16 '11 at 0:33
Wait... you go to Power > Power Off in the shell? – Hello71 Feb 12 '11 at 21:55
No, after issuing the shutdown command via the shell, I wait for the system to halt, and then in the VM player GUI go to Power > Power Off – stevebot Feb 12 '11 at 22:09
feedback

2 Answers

up vote 3 down vote accepted

Presuming VMware: if you have the vmware-tools installed in your VM, you should be able to issue the shutdown -h now command and it will power-off the VM for you. This works for me with C4 and C5 VMs, on Server-1 and -2, Workstation 6.x, and ESX/ESXi.

link|improve this answer
thanks! I haven't tried that before. – stevebot Jan 16 '11 at 3:52
If you are impatient, you can force a few disk flushes and hit the deck: sync;sync;sync;halt – Linker3000 Feb 12 '11 at 22:07
feedback

You're close; the proper command is:

sudo /sbin/shutdown **-h** now
  1. Assuming that the sudo package is installed; otherwise, use su or similar.
  2. Without the asterisks, of course.

This will shutdown then halt the computer.

link|improve this answer
ah, thanks that does help – stevebot Jan 16 '11 at 3:51
unixhelp.ed.ac.uk/CGI/man-cgi?shutdown+8 shutdown manual page... also look at the -r method to restart your computer. These are basic linux commands and really have nothing 'special' to do with a VM – g19fanatic Jan 16 '11 at 4:20
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.