top | item 46267407

(no title)

kami23 | 2 months ago

I worked with a greybeard that instilled in me that when we were about to do some RAID maintenance that we would always run sync twice. The second to make sure it immediately returns. And I added a third for my own anxiety.

discuss

order

wmf|2 months ago

You need to sync twice because Unix is dumb: "According to the standard specification (e.g., POSIX.1-2001), sync() schedules the writes, but may return before the actual writing is done." https://man7.org/linux/man-pages/man2/sync.2.html

amelius|2 months ago

Then how do you know the writes are done after the second sync?

1718627440|2 months ago

> Unix is dumb

I don't know. Now async I/O is all the rage and that is the same idea.

zabzonk|2 months ago

it's not just a good idea for raid

kami23|2 months ago

Oh definitely not, I do it on every system that I've needed it to be synced before I did something. We were just working at a place that had 2k+ physical servers with 88 drives each in RAID6, so that was our main concern back then.

I have been passing my anxieties about hardrives to junior engineers for a decade now.