|
|
/sbin/restart - DO *NOT* USE!!!!
|
|
|
|
Junior Member
Join Date: Oct 1999
Status:
Offline
|
|
I needed to reboot so I jumped for /sbin/restart, which rebooted me rather quickly, but it BLEW AWAY THE FILE SYSTEM!!! Now after loading the kernel and modules, it just hangs there changing the background shades of blue every few minutes, trying to bring up the login screen, but it won't do it.
So, i'm starting up off of the CD and blowing away the file system. Bummer! I had just compiled Samba! Hmm.... maybe that unleashed the windows demons into the drive... where's the computer exorcist!
Dan
|
|
|
|
|
|
|
|
|
Wolverine
|
|
I don't think restart makes any attempt to sync the file system. If you are in a terminal the best way to restart would be 'shutdown -fr now'.
Or just do it through the GUI it's just as easy if you are in front of the machine.
|
|
|
|
|
|
|
|
|
afterimage
|
|
Originally posted by Wolverine:
[B]I don't think restart makes any attempt to sync the file system. If you are in a terminal the best way to restart would be 'shutdown -fr now'.
From "Linux in a Nutshell",
reboot "Close out the file systems, shut down the system, then reboot the system. Because this command immediately stops all processes (programs visible and not), it should be run only in single user mode (if I had to guess, OS X runs in level 2 or 3, which allows networking). If system is (not booting) or (shutting down), reboot calls shutdown -nf.
The -nf flags on shutdown say perform a shutdown w/o talking to the init daemon. f sez reboot fast, by supressing (disc synching) when rebooting.
Which, by my experience, means the following. Anything will quit, clean or dirty. UNIX programs tend not to like that much, as it generates state lock/pid files (that is, the program *may* balk at running after the reboot since it thinks it is already running) Secondly, the system *will* reboot w/o talking to the file system. So, it is highly possible to interrupt a process that's writing to the file system.
In other words, the above post is (almost) correct. I'd suggest 'shutdown -r now'. Does the same think, but the file system doesn't get a pass on checking itself out.
|
|
|
|
|
|
|
|
|
noname
|
|
"shutdown -r now" does indeed hose the filesystem
|
|
|
|
|
|
|
|
|
Wolverine
|
|
Hey noname, 'shutdown -r now' does not hose the file system. Now if you have a file system that is already damaged it won't necessarily fix itself either.
Mac OS X has a live file system that is common in UNIX land, but is probably unfamiliar to Mac OS 9 users. At any time the OS can be reading/writing to the file system so any time the systemgoes down without a proper shutdown there can be damage to the file system.
The OS makes an attempt to make repairs during the boot process, but I always prefer to at least watch the boot in verbose mode or stop in single use mode and do the check myself. I have seen (under other UNIX's) a filesystem require more than one fsck in a row to correct all the problems.
|
|
|
|
|
|
|
|
|
javastein13
|
|
Someone said...
"From "Linux in a Nutshell", "..
MacOS X is *not linux*..
How about "shutdown -y -g5 -i5 "--replacing hard drive--"
|
|
|
|
|
|
|
|
|
Junior Member
Join Date: Jul 1999
Status:
Offline
|
|
Why the heck didn't you just use a GUI command to restart?
Answer : "Where's the fun in that!"
|
|
|
|
|
|
|
|
|
Junior Member
Join Date: Oct 1999
Status:
Offline
|
|
I really should have known better... I ran MacOS X Server 1.2 on that G4 for the last six months.. even bought a UPS system for it (although APC's new "Mac" UPC system doesn't work under 9, x, or anything, the bastards) because after a power failure, I remembered how much unix likes it's filesystem neat and clean.
This is going to be a tough sell for newbies - there was a great apple TIL that exlained if you had trashed a file you wanted back, you could yank the power cord without shutting down and it would appear in the trash can on restart. Cool! And Apple beat that as well!! On the LC 520 (?? maybe Performa?), Apple installed a "Secret partition" on the hard drive with a system folder and some disk utilities - if a user trashed his system and rebooted, the "hidden" partition sprung to life and saved the day. Cool! More of that thinking, Apple!!
Dan
|
|
|
|
|
|
|
|
|
X Freedom
|
|
Mac OS X is unix... and Linux is unix... just keep that in mind
Originally posted by javastein13:
Someone said...
"From "Linux in a Nutshell", "..
MacOS X is *not linux*..
How about "shutdown -y -g5 -i5 "--replacing hard drive--"
------------------
The goal of Project Freedom is to point users to solutions which brings the classic feel of the Mac OS to Mac OS X. (Mac OS X) Project Freedom
|
|
|
|
|
|
|
|
|
Quantum Fusion
|
|
Does anyone here know if there is a way to get to single usermode in OS X???
|
|
|
|
|
|
|
|
|
Fresh-Faced Recruit
Join Date: Sep 2000
Location: Provo, UT USA
Status:
Offline
|
|
Originally posted by X Freedom:
Mac OS X is unix... and Linux is unix... just keep that in mind
Linux IS NOT Unix. It is Unix-like, but that does not mean that it IS Unix. Just keep that in mind...
[This message has been edited by adavidw (edited 09-17-2000).]
|
|
|
|
|
|
|
|
|
Mac Enthusiast
Join Date: Nov 1999
Location: Bensalem, PA
Status:
Offline
|
|
The only real reason Linux IS NOT Unix is because no one will pay the bucks to the Open Group to get it POSIX certified to be called a UNIX. Other than that, you might as well just call it UNIX. It's so damn close I don't really notice a difference.
------------------
Andy Pastuszak
[email protected]
|
Andy Pastuszak
amp68(spammenot)-at-verizon.net
|
|
|
|
|
|
|
|
Senior User
Join Date: Jul 2000
Status:
Offline
|
|
Originally posted by Quantum Fusion:
Does anyone here know if there is a way to get to single usermode in OS X???
On OS X Server you can get into single user mode by simply holding down the 's' key on startup, so it may be the same.
|
|
|
|
|
|
|
|
|
Professional Poster
Join Date: Jan 2000
Status:
Offline
|
|
There is the sync command. I don't know if OS X has that? Someone told me you have to sync 3 times to get the OS to write all data to the disk. I use this command.
>sunc;sync;sync
|
|
|
|
|
|
|
|
|
Locutis
|
|
shutdown is the safest, most considerate, and most thorough way to initiate a halt or reboot, or to return to single-user mode. Unfortunately, the arguments used vary from distribution to distribution, so I won't get into that discussion.
You can ask shutdown to wait a while before bringing down the system. During the waiting period, shutdown sends messages (a la wall) to logged-in users at progressively shorter intervals, warning them of the impending down time.
Most versions of shutdown let you specify if the machine should halt, go to single-user mode, or reboot. Sometimes, you can also specify if you want to fsck the disks after reboot. On modern systems with large disks, a complete fsck can take a long time; you generally skip the checks if you shut the system down cleanly. At the appropriate time, shutdown carefully brings the system down to the requested state.
The halt command performs the essential duties required to bring the system down. It is called by shutdown -h, but can also be used by itself. halt logs the shutdown, kills non-essential processes, executes the sync system call (called by and equivalent to the sync command), waits for filesystem writes to complete, and then halts the kernal.
halt -n prevents the sync call; it's used after repairing the root partition with fsck to prevent the kernal from overwriting repairs with older versions of the superblock. halt-q instigates an almost immediate halt, without synchronization, killing all processes, or writing of logs. This flag is rarely appropriate.
reboot is almost identical to halt, but it causes the machine to reboot from scratch rather than halting. reboot is called by shutdown -r. Like halt, it supports the -n and -q flags. Quick and dirty.
In addition to halt and reboot, some systems provide commands called fasthalt and fastboot. These commands create a file called /fastboot before executing halt or reboot, respectively. The existence of this file tells the startup scripts to skip fsck checks, therefore making the restart much quicker.
The results of killing init are unpredictable and often nasty. When init receives a TERM signal, it usually kills all user processes, daemons, and gettys, and returns the system to single-user mode. This facility is used by shutdown.
"Someone told me you have to sync 3 times to get the OS to write all data to the disk."
Why is sync executed twice (or more)? Essentially this is a bit of UNIX superstition. The sync command schedules, but does not necessarily immediately perform, the required disk writes, even though the UNIX prompt returns immediately. Multiple sync commands raise the probability that the write will take place before you enter another command (or turn off the power) by taking the time needed to complete the operation. However, the same effect can be obtained by waiting a few seconds for disk activity to cease before doing anything else.
Typing sync several times gives you something to do while you're waiting.
Hope this clears the confusion up.
Here's something to try as a practical joke when people are connected to your UNIX server:
shutdown -k
|
|
|
|
|
|
|
|
|
Locutis
|
|
shutdown is the safest, most considerate, and most thorough way to initiate a halt or reboot, or to return to single-user mode. Unfortunately, the arguments used vary from distribution to distribution, so I won't get into that discussion.
You can ask shutdown to wait a while before bringing down the system. During the waiting period, shutdown sends messages (a la wall) to logged-in users at progressively shorter intervals, warning them of the impending down time.
Most versions of shutdown let you specify if the machine should halt, go to single-user mode, or reboot. Sometimes, you can also specify if you want to fsck the disks after reboot. On modern systems with large disks, a complete fsck can take a long time; you generally skip the checks if you shut the system down cleanly. At the appropriate time, shutdown carefully brings the system down to the requested state.
The halt command performs the essential duties required to bring the system down. It is called by shutdown -h, but can also be used by itself. halt logs the shutdown, kills non-essential processes, executes the sync system call (called by and equivalent to the sync command), waits for filesystem writes to complete, and then halts the kernal.
halt -n prevents the sync call; it's used after repairing the root partition with fsck to prevent the kernal from overwriting repairs with older versions of the superblock. halt-q instigates an almost immediate halt, without synchronization, killing all processes, or writing of logs. This flag is rarely appropriate.
reboot is almost identical to halt, but it causes the machine to reboot from scratch rather than halting. reboot is called by shutdown -r. Like halt, it supports the -n and -q flags. Quick and dirty.
In addition to halt and reboot, some systems provide commands called fasthalt and fastboot. These commands create a file called /fastboot before executing halt or reboot, respectively. The existence of this file tells the startup scripts to skip fsck checks, therefore making the restart much quicker.
The results of killing init are unpredictable and often nasty. When init receives a TERM signal, it usually kills all user processes, daemons, and gettys, and returns the system to single-user mode. This facility is used by shutdown.
"Someone told me you have to sync 3 times to get the OS to write all data to the disk."
Why is sync executed twice (or more)? Essentially this is a bit of UNIX superstition. The sync command schedules, but does not necessarily immediately perform, the required disk writes, even though the UNIX prompt returns immediately. Multiple sync commands raise the probability that the write will take place before you enter another command (or turn off the power) by taking the time needed to complete the operation. However, the same effect can be obtained by waiting a few seconds for disk activity to cease before doing anything else.
Typing sync several times gives you something to do while you're waiting.
Hope this clears the confusion up.
Here's something to try as a practical joke when people are connected to your UNIX server:
shutdown -k
|
|
|
|
|
|
|
|
|
afterimage
|
|
Originally posted by javastein13:
Someone said...
"From "Linux in a Nutshell", "..
MacOS X is *not linux*..
You are absolutely correct. However, with experience in several flavors of UNIX, shutdown -r "now" is a fairly consistent command between all of them. Works with Linux, a slightly tweaked version works with Solaris. Exact command works with OpenBSD. OpenBSD is derived from 4.4 BSDLite, as is FreeBSD. Darwin, the core of Mac OS X is derived from FreeBSD.
So, there's a lineage here, and it's a fair guess that since they all tend to use many of the same GNU derived tools, functionality would be very similar.
I was consulting Linux in a Nutshell as a ref on what the command does.
|
|
|
|
|
|
|
|
|
Gee5orce
|
|
Does anybody know how OS X handles a command like 'wall' or 'write' ? Does the GUI display a dialog with the message, or is it just logged somewhere ?
|
|
|
|
|
|
|
|
|
Junior Member
Join Date: Oct 1999
Status:
Offline
|
|
those commands can only be run from the command line, and as of now, only affect the command line. Probably wouldn't be too hard to write a little x daemon that listens for walls from the admin (like in a classroom of netbooted imacs... one can dream), and pop messages on the screen.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Forum Rules
|
|
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
|
|
|
|
|
|