
When Unix Learned to reboot(2) - aquabeagle
https://bsdimp.blogspot.com/2020/07/when-unix-learned-to-reboot2.html
======
wahern
> Linux's sync call is synchronous. You get the same guarantees as you do from
> fsync. This behavior was introduced in 1.3.20, released in 1995. Prior to
> that the same sync dance advice was useful since early versions of Linux
> were more aggressively asynchronous in their handling of disk writes than
> other contemporary systems. While this helped it compete in benchmarks, it
> caused data integrity problems when Linux machines started to be put into
> production (which was one of the reasons motivating the change). Modern
> Linux systems flush out all the dirty buffers as part of the shutdown
> sequence and wait for the flush to complete before proceeding to reboot,
> turning the system off or halting.

I developed a habit (more a tick, really) of invoking sync on Linux. Not just
because of shutdown behavior, but because of crash behavior. The Linux
filesystem didn't recover very gracefully on a crash, so many times I found
myself having to reinstall Linux.

3.5" floppy disks, the media I had to use to install Linux, had a penchant for
corrupting themselves while sitting in my desk drawer. A Slackware disk set
required something like 8 or 10 or more disks, invariably one of which would
have gone bad. I only had a 2400 baud modem, so downloading a replacement disk
took forever, and that's _after_ I was lucky enough to find a free BBC (or
later SLIP/PPP) line. And because you would only discover a corrupted disk
during installation, the process of reinstalling Linux could easily take 1 or
2 sleepless nights given it might happen midway through an install, requiring
a reboot back into Windows for downloading and then restarting the process
from scratch. (I had high school during the day, and part-time work many week
nights.)

So, yeah, a handful of bad experiences and to this day I sync almost
religiously. Until recently I would sync three times in a row, manually,
presumably because I had picked up the mythic BSD advice somewhere.

I was also fortunate to have had my first accidental `rm -fr /` experience
back then, which makes me far more cautious in interactive shell sessions than
many others, sometimes to their impatience. Because I had already learned my
lesson and became reflexively cautious, I absolutely hated Red Hat Linux,
which aliased common commands to request confirmation before destructive
operations.

