探索布莱恩·沃德 (Brian Ward) 所著的《Linux 工作原理》这本书,我通常对此毫无疑问。但是这个。在“6.7.0 关闭系统”中有一个有序的作业列表。
以只读模式 (6) 重新挂载根文件系统后,通过同步程序 (7) 写入缓冲数据。
以只读模式挂载后如何在文件系统中写入数据?可能是一个错误,正确的顺序是首先写入缓冲区(7)然后卸载(5)并重新安装(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.
PS 这本书太棒了,这是几个章节中唯一解决的问题。