type
status
slug
summary
tags
category
icon
password
new update day
Property
Oct 22, 2023 01:31 PM
created days
Last edited time
Oct 22, 2023 01:31 PM
Linux命令sync强制将内存中的文件缓冲内容写到磁盘
sync用于强制将内存中的文件缓冲内容写到磁盘。linux系统为了提高读写磁盘的效率(buffer:为了解决写磁盘的效率。cache:为了解决读磁盘的效率),会先将数据放在一块buffer中。在写磁盘时并不是立即将数据写到磁盘中,而是先写入这块buffer中了。
在系统关机或者重启时,会自动把缓冲区的内容自动同步到磁盘中,但是如果系统异常关机,会有缓存文件丢失的情况。因此,我们也可以手工去执行sync命令,强制将内存中的文件缓冲内容写到磁盘。
命令分类:磁盘目录管理
语法格式
参数
示例
将缓存内容写入到磁盘中 并且 重启
在这里为了让缓存都写入到磁盘中用了 3 次指令 以防万一 !!
- Author:tangcuyu
- URL:https://expoli.tech/articles/2018/04/27/1564656226487
- Copyright:All articles in this blog, except for special statements, adopt BY-NC-SA agreement. Please indicate the source!
Relate Posts