reboot vs init 6 in Unix and Linux

Last Updated on July 18, 2023 by Dave Farquhar

Unix and Unix-like operating systems like Linux have a command called reboot. Like the name says, it reboots the system. Veteran Unix administrators insist the correct way to reboot a Unix system is to use a cryptic command called init 6. Are they just showing off, or is there a good reason for this? It turns out there is indeed a reason why one should worry about reboot vs init 6, and using the init 6 command can protect your system.

reboot vs init 6

reboot vs init 6
On some Unix systems, using that restart command is the same as mashing the reset button on this crusty old PC case. In Linux, it’s not quite that bad but it’s still better to use init 6.

First things first: In the versions of Linux that I’ve used such as Redhat, you can get away with the reboot command. It unmounts the filesystems but doesn’t run any shutdown scripts. It’s easier to remember reboot, and you can complete it with the tab key without having to type anything else.

It’s risky if you run a database server though. I’ve corrupted some mysql databases before; using the reboot command may very well have been the reason.

But in proprietary Unix, such as Solaris, there often is one other major difference. When you type init 6, the system syncs the disks, cleans up after itself, and then restarts itself. It’s a clean reboot. When you type reboot, it’s no different from hitting the reset button on the panel. The system just drops everything and reboots. So when the system comes back up, there’s a long delay as the system runs a filesystem check. There’s a good reason why Unix administrators use the command for filesystem check (fsck) as a swear word. It takes forever and can result in data loss.

So if you want to distinguish yourself as a Unix system administrator, as opposed to a guy who learned Unix by installing Linux on an old box in a spare bedroom like me, this is a good thing to know. While I’ve had logins on proprietary Unix systems like Digital Unix, AIX, and Solaris at various times during my career, it occurs to me I never had to reboot any of them. So I never had to learn the difference the hard way.

I wouldn’t be surprised, though, to see this question come up in a job interview for a production Unix sysadmin.

I’ve never been a first-string Unix guy. But as a security guy, I do care about you not losing data. So remember init 6. If you don’t, you’ll probably wish you did someday.

Why have a reboot command that isn’t safe to use?

This begs the question. Why should a system have a command that isn’t safe to use? For emergencies, basically. Systems can get into a state where they won’t shut down correctly. I’ve seen that happen, and you’ve probably seen it too. Having a reboot command that reboots no matter what gives you an option besides hitting the reset button. If the system isn’t right next to you, being able to remotely do the equivalent of hitting the reset button is helpful. Having administered Windows systems residing in a data center half a world away, I completely understand that need. Windows has an equivalent function in its UI but it’s so buried and poorly documented, almost nobody knows about it. And speaking of the W-word, if you’re curious, Windows has a command to reboot as well.

If you found this post informative or helpful, please share it!