5 ms·
"sync; sync; sync; shutdown -r now" I remember some sort of magic invocation like that years ago for our medical "device" product we had to manage hundreds of
by spaznode 13y ago
"sync; sync; sync; shutdown -r now"
I remember some sort of magic invocation like that years ago for our medical "device" product we had to manage hundreds of remote node instances of. Something along those lines. I don't remember why the developer (Gabe) came up with sync three times being magic number. Maybe three times was just paranoia. =)
- thejosh 13y ago"sync, sync, sync your file systems gently down the shutdown -r..".
- mikeash 13y agoBack in the bad old days of pre-UNIX Macs, it was a common troubleshooting step to reset your PRAM. This is battery backed up RAM that holds some basic settings, and if it got corrupted somehow it could cause weird problems. You'd reboot while holding down command, option, P, and R, then wait for the boot chime to sound a second time indicating that it had been reset, then release the keys and boot normally. Somehow this advice got mutated so that you'd keep holding the keys until you heard two boot chimes (thus resetting the stuff twice). And then it started to grow. Three was common. Some people would advise more. I'm pretty sure that doing it more than once never helped anything, but there we are. (The cmd-opt-P-R sequence still works on modern Macs and I actually used it to resurrect a machine that wouldn't start up just a month ago, but it's far less frequently needed now.)
- celebril 13y agoIt's the same with the battery stats resetting and the Dalvik cache wiping these days in Android land. You do it three+ times. Or the "Repair permissions" thing in OS X. You do it several times as well. It's like whenever there's this one-step fix thing that a system utility does, the Common Man will interpret it as needing to repeat 3+ times in order for it to be effective.
- slight 13y agoI believe the thinking is because sync isn't instant, especially on older slower hard drives, having to type it again give it time to actually complete.
- halfasleep 13y agosync will block until it completes.
- derekp7 13y agoBack in the day (old Unix), the sync call would return right away, and the kernel would sync in the background. Unless there was a current background sync happening -- then sync would block until the first one finished, which is why you would have two sync's in a row. The third sync was thrown in just for luck.
- deleted 13y ago[deleted]
- nzp 13y agoOne for the Father, one for the Son, and one for the Holy Ghost.
- linker3000 13y agoSomewhere in the dim and distant past I was told (or read) to use: "sync; sync; sync; halt" Presumably so you had thinking time before automatically restarting a possibly sick system.
- jmj42 13y agoThis is likely a sun thing. Halt on (SPARC) Solaris does not shutdown the OS. It issues a reset command to the firmware. The halt command on Solaris is roughly equivalent to pressing the reset button on a PC. When your Sun is particularly hosed we used sync;sync;sync; halt to reset and (hopefully) not lose any data (sync forces OS write buffers to purge)
- indrax 13y agoPossibly related: http://brad.livejournal.com/2116715.html http://brad.livejournal.com/2116715.html >Run it and be amazed how much your disks/raid/OS lie. ("lie" = an fsync doesn't work) >It seems everything from PATA consumer disks to high-end server-class SCSI disks lie like crazy. Yes, that includes SATA there in the middle. I'll discuss fixing your storage components in a second.
- mcguire 13y agoI picked up the "sync three times" thing from an AIX kernel developer, who did it from before AIX had a "shutdown". (Yes, he would do "sync, sync, sync, power-off".) My theory was that using it three times gave the system time to actually sync the data.