[CLI]sync

xiaoxiao2021-02-27  284

According to the standard specification (e.g., POSIX.1-2001), sync() schedules the writes, but may return before the actual writing is done. However, since version 1.3.20 Linux does actually wait. (This still does not guarantee data integrity: modern disks have large caches.)

1. 格式:

# sync 

2. 功能:

将所有未写的系统缓冲区写到磁盘中,包含已修改的 i-node、已延迟的块 I/O 和读写映射文件。

sync命令是在关闭Linux系统时使用的。 用户需要注意的是,不能用简单的关闭电源的方法关闭系统,因为Linux象其他Unix系统一样,在内存中缓存了许多数据,在关闭系统时需要进行内存数据与硬盘数据的同步校验,保证硬盘数据在关闭系统时是最新的,只有这样才能确保数据不会丢失。一般正常的关闭系统的过程是自动进行这些工作的,在系统运行过程中也会定时做这些工作,不需要用户干预。 sync命令是强制把内存中的数据写回硬盘,以免数据的丢失。用户可以在需要的时候使用此命令。

转载请注明原文地址: https://www.6miu.com/read-9511.html

最新回复(0)