Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

When I was first introduced to Linux, working at Cisco Systems in 2000, I was taught the merits of the sync command, used to flush buffers to disk to prevent filesystem corruption / data loss. I was told not only by coworkers there, but by friends in college to always run sync "a few" or "a bunch" of times, that is, maybe 5 - 10 times, instead of just once.

I've continued this habit ever since, but, is there any merit to this? Has anyone else ever heard this? And most importantly, can anyone provide good rationale / empirical evidence for/against the idea that you need to run sync more than once for it to be effective?

share|improve this question
add comment

1 Answer

up vote 15 down vote accepted

I heard it (sorry, I forget where) as typing the sync command three times (as in: S Y N C Return, wait for the prompt, repeat, repeat). I also read that the origin was a particular system where it would take a couple of seconds for the disk to finish flushing its buffers, even after it had told the operating system everything was fine. Typing the command twice more gave the disk enough time to settle. It seems that over the years, the purpose was forgotten, and the advice was abbreviated as sync; sync; sync which wouldn't have had the desired effect (since the disk had reported the “all clear”, the second and third syncs would complete instantly and the prompt would come back too early).

I have never heard of a system where multiple sync operations have any use, and I am highly skeptical any exist. I consider this an urban legend. On the other hand, I find it highly believable that there would be systems where you should wait a couple of seconds after sync'ing and before powering down.

Googling leads to a few independent concurring analyses, e.g. The Legend of sync. See also Is execution of sync(8) still required before shutting down linux?.

share|improve this answer
    
Awesome, thanks! I should have clarified, while I put sync; sync; sync; sync in the title, and I do sometimes type it that way, I also heard it explained to me the same way, that is, sync, wait, sync again, wait, etc. –  Josh Dec 30 '10 at 22:51
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.