Safely reboot a Linux system

Contributor Icon Contributed by qmchenry Date Icon October 10, 2003  
Tag Icon Tagged: Linux

The proper method of rebooting a Linux system ensures data integrity by terminating processes and synchronizing the filesystems.


To reboot a Linux system:

shutdown -r

To reboot immediately, specify the command with the now option:

shutdown -r now

Previous recipe | Next recipe |
 
  • Anonymous
    from the shutdown(8) manpage:

    A lot of users forget to give the time argument and are then puzzled by the error message shutdown produces. The time argument is mandatory; in 90 percent of all cases this argument will be the word now.
  • killermookie
    init 6 does the same thing
  • Anonymous
    hi
    when i try to install mandrake 10 it says'you may safely reboot or halt your system'.what is this???
  • Anonymous
    This is just telling you it is okay to reboot or shutdown your system after the install. Most OS installations aren't complete until you've rebooted the system. Follow the instructions in this recipe to reboot and you should have a shiny new Linux box.
  • Anonymous
    Most Distros also have an alias which you can type instead:

    reboot
  • Anonymous
    <ul id="quote">Most Distros also have an alias which you can type instead:

    reboot</ul>

    That is true. On Slackware Linux, both "halt" and "reboot" work. I know this is also true for OpenBSD.

    If you'd like a user to be able to shutdown or reboot a machine, the easiest way to do this is through "sudo".
  • Anonymous
    Other than Slack...n openBSD, the reboot and halt are supported by SuSE, Red Hat as well.
  • Anonymous
    Reboot and halt DO NOT SAFELY shutdown a system. reboot is a symlink to halt and halt nukes the platform.

    shutdown -rn now is how I usually reboot a machine of mine. shutdown -r by it's self will sync the disks, -n forces this (I like to be on the safe side).

    halt just stops the processors and inits the system without syncing disks. You'll more than likely come back with your system running FSCK on your FS, and you better pray your using ext3.
  • Anonymous
    Halt does NOT nuke a system

    If the system is not in run level 0 or 6 halt/reboot/poweroff calls shutdown

    so halt is really just a wrapper for shutdown

    don't believe me? man halt
  • Anonymous
    <ul id="quote"><h6>Anonymous wrote:</h6>Reboot and halt DO NOT SAFELY shutdown a system. reboot is a symlink to halt and halt nukes the platform.

    shutdown -rn now is how I usually reboot a machine of mine. shutdown -r by it's self will sync the disks, -n forces this (I like to be on the safe side).

    halt just stops the processors and inits the system without syncing disks. You'll more than likely come back with your system running FSCK on your FS, and you better pray your using ext3.</ul>

    What type of idiot response is this. Have you ever heard of checking argv[0], it tells you how the process was called. Halt checks this and then runs according to how it was called.

    if ((progname = strrchr(argv[0], '/')) != NULL)
    progname++;
    else
    progname = argv[0];

    if (!strcmp(progname, "reboot")) do_reboot = 1;
    if (!strcmp(progname, "poweroff")) do_poweroff = 1;



    Moral of this story "think before you open your mouth"
blog comments powered by Disqus