Re: reboot(2) syncing disks (was Re: All the problems with...update)

David Luyer (luyer@ucs.uwa.edu.au)
Thu, 20 May 1999 17:39:40 +0800


> I'm not talking about what happens when you ask init politely to reboot the
> machine. Reboot, the system call, does not flush dirty buffers and unmount
> file systems.

* why bloat reboot? other syscalls do what you want, put the reboot
command which does what you want in userspace.

* what if a SCSI device has died, you've fsync()d everything
on other filesystems, and you really want to reboot remotely?
making the syscall always sync makes it impossible to reboot cleanly
when one SCSI (IDE ESDI SMD whatever) device has died

> The older systems that didn't were severely
> irritating from a sysadmin's point of view.

sync
sync
sync
reboot

what was so hard? [nb. sync;sync;sync;reboot does _not_ do it... the reason
for the 'sync three times' was that sync on certain BSD based systems didn't
really write out blocks, it marked them for immediate writing out which would
be done some time in the next few seconds. you only actually had to type
sync once, and wait a little.]

I still sync before reboot on any system I'm using if I'm using the reboot
command rather than shutdown... it's just a good thing to do.

(or there was always f5[1],g0,b)

> Imagine for a moment that your primary NFS server has trashed its root
> partition and will not even come up in single user mode.

...and you want to reboot your other systems? yes, that's a problem, you've
got a reboot syscall which will sit there waiting to try and unmount the NFS
from it which requires syncing some data to it...

> Ah! fsck is done! Now tell me... do you remember to type `sync' and wait
> thirty seconds before rebooting? Init won't do it for you, there is no
> init on the emergency rescue disk.

Your fault. You should have been using the Debian[1] emergency rescue disk,
which handles control-alt-delete _properly_. Not the kernel's fault, but
whoever made your rescue disk.

Alternatively,
cd /mnt
LD_LIBRARY_PATH=lib
export LD_LIBRARY_PATH
usr/sbin/chroot . /usr/bin/rc [or bash or whatever 'normal' people use]
[use normal happy utilities - including reboot command which sync's unless
told not to]

Really, this is the problem of people who don't know what they're doing
trying to run Linux systems (and in some cases giving Linux a bad rep
as a multi-user Unix system). Learn about the system you're looking after.

David.

[1] break on vt100 IIRC. L1-A on recent Suns. real terminals (f200s,l1s,etc)
had a separate break key.

[2] or other decent distribution, I'd be surprised if RedHat's doesn't do
it but I've never used RedHat's.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/