On Sun, Feb 21, 2010 at 02:03:29PM +1100, Martin Visser wrote: > I don't get how sync will write anything to a "ro" filesystem. That seems to > be to break a fundamental kernel and filesystem principle.
It won't change anything on the file system as to how it existed in RAM/DISK at the time of the remount. > I would have thought either the "remount" would either force a flush of > dirty blocks before it switches to "ro", or alternatively those blocks still > dirty at the time of the "remount" end up in the bit bucket. The remount doesn't flush the kernel buffer cache. Neither does unmount at least this is what my past experience and a bit of googling tell me. So the sync is necessary. Doing it 3 times is just paranoia, I don't think the sync returns till the disk itself has indicated the blocks are written. This has happened to me everytime I change a root password in single user mode. My usual process is linux init=/bin/sh mount -o remount,rw / vi /etc/passwd reboot # Bugger linux init=/bin/sh mount -o remount,rw / vi /etc/passwd mount -o remount,ro / reboot # Bugger linux init=/bin/sh mount -o remount,rw / vi /etc/passwd mount -o remount,ro / sync reboot # Hurray Cheers, John > > Also I have seen this 3 sync incantation before. It seems to me that all you > are doing playing snap with processes that might have stuff to write but > hasn't been flushed. After any sync and before the final shutdown I presume > any running process is at liberty to create new dirty blocks that may or may > not make it to disk in time. > > Jeremy Visser <jer...@visser.name> writes: > > > On 19/02/10 13:41, Daniel Pittman wrote: > > > > > >> ] mount / -o remount,rw > > >> ] passwd root # ...and give it a good password > > >> ] mount / -o remount,ro > > >> ] sync; sync; sync > > >> # wait thirty seconds, because paranoia never hurts > > >> ] sync; sync; sync; reboot > > > > > >> Just be aware that you don't get a lot of nice things like, oh, some > > >> of the "flush on shutdown" behaviour that you do in a normal boot. > > > > > > Shutting down from the GUI, or typing 'halt' isn't magic. It doesn't > > > magically do anything that sync doesn't. How else do you think that the > > > logic works when you shut down? > > > > ...perhaps my working wasn't clear, as you seem to be restating my point? > > > > Daniel > > > > -- > > ✣ Daniel Pittman ✉ dan...@rimspace.net ☎ +61 401 155 > > 707 > > ♽ made with 100 percent post-consumer electrons > > -- > > SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ > > Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html > > > -- > SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ > Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html -- John Blog http://www.inodes.org LCA2010 http://www.lca2010.org.nz -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html