Exploring amazing Book How Linux Works by Brian Ward I usually have no question. But this one. At the "6.7.0 Shutting Down Your System" there is an ordered list of jobs.
After remount root file system in ReadOnly mode (6) write buffered data by the sync program (7).
How is it possible to write data in a file system after mount in in ReadOnly mode? May be it is an error, correct order is first write buffers (7) then unmount (5) and ro remount (6)?
1. init asks every process to shut down cleanly. 2. If a process doesn’t respond after a while, init kills it, first trying a TERM signal. 3. If the TERM signal doesn’t work, init uses the KILL signal on any stragglers. 4. The system locks system files into place and makes other preparations for shutdown. 5. The system unmounts all filesystems other than the root. 6. The system remounts the root filesystem read-only. 7. The system writes all buffered data out to the filesystem with the sync program. 8. The final step is to tell the kernel to reboot or stop with the reboot(2) system call. This can be done by init or an auxiliary program such as reboot, halt, or poweroff. P.S. The book is amazing it is an only question usolved during several chapters.