Google Groups Home
Help | Sign in
why three syncs?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  Messages 1 - 25 of 36 - Collapse all   Newer >
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Brian Ellis  
View profile
 More options Sep 5 1991, 1:27 am
Newsgroups: alt.folklore.computers, comp.sys.dec
From: el...@rata.vuw.ac.nz (Brian Ellis)
Date: 4 Sep 91 22:57:26 GMT
Local: Wed, Sep 4 1991 6:57 pm
Subject: Re: why three syncs?
In article <1991Sep04.194822.22...@uvmark.uucp>, t...@uvmark.uucp (Tom Rauschenbach) writes:

|> I've noticed that most Un*x folks type the sync command three times before
|> shutting down a system.  Is there a folkloric reason for this ?  A technical
|> one.  I have a guess, and I wonder if it can be confirmed or refuted.

Quoting from sync(2) from the Ultrix 4.1 man pages...

          The sync system call causes all information in memory that should
          be on disk to be written out.  This includes modified super-
          blocks, modified i-nodes, and delayed block I/O.

          Programs that examine a file system, for example, fsck or df, use
          the sync system call.  The writing, although scheduled, is not
          necessarily complete upon return from sync.

The second sentence of the second paragraph suggests why three syncs are
required before shutting down a Unix system.

Brian.

--
Brian Ellis                               Computing Services Centre
Domain: Brian.El...@vuw.ac.nz             Victoria University of Wellington
Bang paths... grrrr!!!!!                  P.O Box 600, New Zealand.
What! - no cute .sig ???


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alan J Rosenthal  
View profile
 More options Sep 5 1991, 1:48 am
Newsgroups: alt.folklore.computers
From: fl...@dgp.toronto.edu (Alan J Rosenthal)
Date: 5 Sep 91 00:01:44 GMT
Local: Wed, Sep 4 1991 8:01 pm
Subject: Re: why three syncs?

t...@uvmark.uucp (Tom Rauschenbach) writes:
>I've noticed that most Un*x folks type the sync command three times before
>shutting down a system.  Is there a folkloric reason for this ?  A technical
>one.

One for me, one for thee, and one for the pot!

As others have remarked, it's not the case that when you get your prompt back,
the disks have been synced.  Old-time unix folks tell me that the correct
method is to type sync once, then listen or watch for the disk, and wait until
it stops.  I suppose that the extra two syncs give you something to do while
waiting.

I heard a theory that the first sync schedules the writing, and that the second
sync won't return until the writing actually scheduled by the first sync is
completed, but I'm very sure that this is false.  It wouldn't explain why
people do three or more, anyway.

ajr

p.s. !@#$%^& a/ux usually gets fsck errors upon the next boot no matter WHAT
you do, but it's abnormal.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dirk Grunwald  
View profile
 More options Sep 5 1991, 1:50 am
Newsgroups: alt.folklore.computers, comp.sys.dec
From: grunw...@foobar.colorado.edu (Dirk Grunwald)
Date: 4 Sep 91 23:54:23 GMT
Local: Wed, Sep 4 1991 7:54 pm
Subject: Re: why three syncs?

i remember seeing a snippet somewhere

        % sync
        % sync
        % sync          ## in case of skidding

i think it's folklore.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tom Rauschenbach  
View profile
 More options Sep 5 1991, 2:01 am
Newsgroups: alt.folklore.computers, comp.sys.dec
From: t...@uvmark.uucp (Tom Rauschenbach)
Date: 4 Sep 91 19:48:22 GMT
Local: Wed, Sep 4 1991 3:48 pm
Subject: why three syncs?
I've noticed that most Un*x folks type the sync command three times before
shutting down a system.  Is there a folkloric reason for this ?  A technical
one.  I have a guess, and I wonder if it can be confirmed or refuted.

--
Tom Rauschenbach              "I see nobody on the road," said Alice.
"I only wish I had such eyes," the King remarked in a fretful tone.  "To be
able to see Nobody !  And at that distance too !"  ..uunet!merk!uvmark!tom


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Frederick M. Avolio  
View profile
 More options Sep 5 1991, 2:13 am
Newsgroups: alt.folklore.computers, comp.sys.dec
From: avo...@decuac.dec.com (Frederick M. Avolio)
Date: 5 Sep 91 02:36:51 GMT
Local: Wed, Sep 4 1991 10:36 pm
Subject: Re: why three syncs?

In article <1991Sep4.235423.4...@colorado.edu> grunw...@foobar.cs.colorado.edu writes:

>i remember seeing a snippet somewhere

>    % sync
>    % sync
>    % sync          ## in case of skidding

>i think it's folklore.

Bah!  I've been typing 3 syncs for...11 or 12 years.  It's not folklore.

                It's Tradecraft.

:-)

F


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Steven M Kosloske  
View profile
 More options Sep 5 1991, 2:13 am
Newsgroups: alt.folklore.computers, comp.sys.dec
From: z...@csd4.csd.uwm.edu (Steven M Kosloske)
Date: 4 Sep 91 21:42:31 GMT
Local: Wed, Sep 4 1991 5:42 pm
Subject: Re: why three syncs?

In article <1991Sep04.194822.22...@uvmark.uucp> t...@uvmark.uucp (Tom Rauschenbach) writes:
>I've noticed that most Un*x folks type the sync command three times before
>shutting down a system.  Is there a folkloric reason for this ?  A technical
>one.  I have a guess, and I wonder if it can be confirmed or refuted.

I'm not sure about other UNIX admin's, but I got started doing three sync
commands because that was what was suggested in the SCO Xenix manual.

In reality, all you should need is one, but better safe then sorry, we
run three.  I've seen some do more than three before a shutdown.  Want to
be sure that everything is closed and written to disk before powering
down a Unix system.

--
  (Steve Kosloske)                  | "A year working in Artificial
------------------------------------|  Intelligence is enough to make
 Internet: z...@csd4.csd.uwm.edu    |  one believe in God." -
 UUCP: uunet!z...@csd4.csd.uwm.edu  |       Alan Perlis


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Greg Lehey  
View profile
 More options Sep 6 1991, 3:04 am
Newsgroups: alt.folklore.computers, comp.sys.dec
Followup-To: alt.folklore.computers
From: g...@mpd.tandem.com (Greg Lehey)
Date: 5 Sep 91 19:40:58 GMT
Local: Thurs, Sep 5 1991 3:40 pm
Subject: Re: why three syncs?

In article <1991Sep5.023651.17...@decuac.dec.com> avo...@decuac.dec.com writes:
>In article <1991Sep4.235423.4...@colorado.edu> grunw...@foobar.cs.colorado.edu writes:
>>i think it's folklore.
>Bah!  I've been typing 3 syncs for...11 or 12 years.  It's not folklore.
>            It's Tradecraft.

It's superstition, mistrust and function of your typing speed. I always do four.

So-nice-so-nice-we-do-it-twice-twice-ing you what
Grog


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tom Ploegmakers  
View profile
 More options Sep 6 1991, 3:04 am
Newsgroups: alt.folklore.computers, comp.sys.dec
From: t...@nikhefk.UUCP (Tom Ploegmakers)
Date: 5 Sep 91 08:01:53 GMT
Local: Thurs, Sep 5 1991 4:01 am
Subject: Re: why three syncs?

In article <1991Sep04.194822.22...@uvmark.uucp> t...@uvmark.uucp (Tom Rauschenbach) writes:
>I've noticed that most Un*x folks type the sync command three times before
>shutting down a system.  Is there a folkloric reason for this ?  A technical
>one.  I have a guess, and I wonder if it can be confirmed or refuted.

The reason i know for doing more  than a single sync is that sync
is  performed  asynchonously  by  the kernel.  When  the  command
returns the  sync operation is not  yet finished. So If  you halt
immediatly after that you  would still have incorrect filesystems
on disk. When memories were small  the sync would be completed by
the time you had typed anything, so why not a second sync?

A second sync would not  make your filesystems any better because
there will not be found any  blocks in the buffer cache that need
syncing.

When  memories,  and  buffer  caches, grew  bigger  this  was  no
guarantee  anymore. I  heard about  a Convex  that spend  tens of
seconds syncing after doing lots of installaion work single user.
Modern unixes,  at least bsd's,  always sync when you  halt them,
even when they  panic. But i still have the  old sync, sync, jalt
on my fingertips.

tom ploegmakers         NIKHEF/K-CSG    (t...@nikhefk.nikhef.nl)    

                        po.box 4395, 1009 AJ Amsterdam, the Netherlands.
                        phone: -31 20 5922035


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jose Pina Coelho  
View profile
 More options Sep 6 1991, 3:04 am
Newsgroups: alt.folklore.computers, comp.sys.dec
From: j...@fct.unl.pt (Jose Pina Coelho)
Date: 5 Sep 91 10:11:09 GMT
Local: Thurs, Sep 5 1991 6:11 am
Subject: Re: why three syncs?

In article <1991Sep4.214231.29...@uwm.edu> z...@csd4.csd.uwm.edu

(Steven M Kosloske) writes:

   I'm not sure about other UNIX admin's, but I got started doing three sync
   commands because that was what was suggested in the SCO Xenix manual.

   In reality, all you should need is one, but better safe then sorry, we
   run three.  I've seen some do more than three before a shutdown.  Want to
   be sure that everything is closed and written to disk before powering
   down a Unix system.

From the ultrix manual pages:

Name:   sync(1) - update the super block
Description:
     The sync command executes the sync system primitive.  The sync
     command can be called to insure all disk writes have been com-
     pleted before the processor is halted in a way not suitably done
     by reboot(8) or halt(8).

     See sync(2) for details on the system primitive.

Name:   sync(2) - update super-block
Description:
     The sync system call causes all information in memory that should
     be on disk to be written out.  This includes modified super-
     blocks, modified i-nodes, and delayed block I/O.

        [...]

#    The writing, although scheduled, is not
#    necessarily complete upon return from sync.

This last paragraph is the important one.  The first sync only asks
the system to start flushing the cache, so, you need a certain time
for the cache to be clear.
The next two syncs are called to give the system time to flush.

--
Jose Pedro T. Pina Coelho   | BITNET/Internet: j...@fct.unl.pt
Rua Jau N 1, 2 Dto          | UUCP: ...!mcsun!unl!jpc
1300 Lisboa, PORTUGAL       | Home phone: (+351) (1) 640767

Sex is not the answer.  Sex is the question.  "Yes" is the answer.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Frank Wortner  
View profile
 More options Sep 6 1991, 3:04 am
Newsgroups: alt.folklore.computers, comp.sys.dec
Followup-To: alt.folklore.computers
From: fr...@croton.nyo.dec.com (Frank Wortner)
Date: 5 Sep 91 13:45:44 GMT
Local: Thurs, Sep 5 1991 9:45 am
Subject: Re: why three syncs?
The sync forces a write to the physical disk, and this takes a certain
amount of time.  Back in the days of ASR33s, it took a fairly significant
amount of time to type "sync" three times because one had to litterally
pound on the tiny cynlindrical keys.  Most people thought that the
amount of time necessary to type three sync commands was sufficient
for the system to flush its buffers to disk.

Either that, or three is just a nice number.  Afterall, there are three
stooges, three (talented) Marx brothers --- few people remember
Zeppo, and even fewer have even *heard* of Gummo ---, three branches
of government in the US, three ...  ;-)

                                        Frank


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Eric Dittman  
View profile
 More options Sep 6 1991, 3:04 am
Newsgroups: alt.folklore.computers
From: ditt...@skbat.csc.ti.com (Eric Dittman)
Date: 5 Sep 91 21:07:19 GMT
Local: Thurs, Sep 5 1991 5:07 pm
Subject: Re: why three syncs?
In article <1991Sep4.200143.13...@jarvis.csri.toronto.edu>, fl...@dgp.toronto.edu (Alan J Rosenthal) writes:

> p.s. !@#$%^& a/ux usually gets fsck errors upon the next boot no matter WHAT
> you do, but it's abnormal.

I used to have this problem with A/UX.  I tracked the problem down to
a bad SCSI cable.  Since replacing the cable, I haven't had any problems
even with one blackout, three resets after panics, and several shutdowns.
--
Eric Dittman
Texas Instruments - Component Test Facility
ditt...@skitzo.csc.ti.com
ditt...@skbat.csc.ti.com

Disclaimer:  I don't speak for Texas Instruments or the Component Test
             Facility.  I don't even speak for myself.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Peter Lamb  
View profile
(1 user)  More options Sep 6 1991, 3:04 am
Newsgroups: alt.folklore.computers
From: p...@iis.ethz.ch (Peter Lamb)
Date: 5 Sep 91 21:10:59 GMT
Local: Thurs, Sep 5 1991 5:10 pm
Subject: Re: why three syncs?