There's a bit of superstitious lore amongst old Unix hands. When shutting down a computer you run sync twice, to make sure all bits are flushed to disk.
sync; sync; halt
Why twice? When I learned this bit of lore at Bill's knee in 1990, he shrugged and say "I dunno". Then Kent chimed in to suggest that the first sync exited before the kernel had truly flushed the bits to disk, but the second sync invocation would block until the write was finished. Being 18 and in awe of my Unix gods I took that at face value.

Of course syncing twice is ludicrous; halt itself syncs the disks. And modern filesystems deal pretty well with abrupt shutoffs, say during power failures, so the risk of completely destroying a filesystem is pretty low. But I still run sync twice when I'm concerned about my disks. Silly, but harmless.

I was reminded of this when sitting next to Merlin at the Start conference. He was having trouble with the Wifi and when I looked over he had a full screen console up running fsck. He said this was his superstitious way to fix insolvable computer problems. It's like we belong to opposing factions in the same cargo cult.

  2008-08-16 18:24 Z