Re: system.map

Miquel van Smoorenburg
2002-01-03T09:44:04Z

In article <200201022039.g02KdPSr022018@svr3.applink.net>,
Timothy Covell <timothy.covell@ashavan.org> wrote:
>On Wednesday 02 January 2002 14:19, Kilobug wrote:
>> > 5. sync;sync;shutdown -r now
>>
>> Is there any particular reason for this double sync ? One isn't enough ?
>> (And is sync even needed with shutdown, all should be synced when
>> filesystems are unmounted or remounted read-only, am I wrong ? )
>
>The double sync is tradition.

The double sync is because traditionally, sync was asyncronous-
it told the kernel 'flush write cache to disk' but it returned
immidiately. That is why people were told to sync 3 times - by
the time you had typed 'sync' for the third time on your 300 baud
lineprinter console the system was done flushing.

sync;sync;sync;reboot is NOT what was used, it was:

# sync
# sync
# sync
# reboot

Anyway, Linux sync is different. It *is* synchronous. However syncing
and then doing a hard reboot is not recommended, you really need to
unmount all filesystems first, and remount root read-only. The
standard shutdown sequence does all of this for you and typing sync
before shutdown -r now is completely useless.

>SysV init scripts should sync things,
>but "sync;sync;reboot" or "sync;sync;halt" are not so nice in how
>they go down; so it's a case of being extra careful. I don't use
>linux all the time, and some of the other unices are less tolerant.
>(For example, on a sun box, I would prefer a double sync before I
>"<stop>-a".)

If you're going to halt or reboot a system *hard* by using the reset
button or <stop>-a without calling shutdown you better sync before
you do that yes, and then you're still not guaranteed free of fs
corruption - at least kill all processes first to prevent some
process writing to disk in between the sync and the halt/reset.

Mike.