> For the complete documentation index, see [llms.txt](https://book.bsdcn.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://book.bsdcn.org/man/man4/syncer.4.md).

# syncer.4

`syncer` — 文件系统同步器内核进程

## 名称

`syncer`

## 概要

`syncer`

## 描述

`syncer` 内核进程通过将易失的缓存文件系统数据刷新到磁盘，帮助保护磁盘卷的完整性。

内核将所有 [vnode(9)](/man/man9/vnode.9.md) 放入多个队列中。`syncer` 进程以轮转方式处理这些队列，通常每秒处理一个队列。对于该队列中的每个 [vnode(9)](/man/man9/vnode.9.md)，`syncer` 进程强制将其脏缓冲区写入磁盘。

缓冲区变脏与缓冲区被同步之间的常规延迟由以下 [sysctl(8)](/man/man8/sysctl.8.md) 可调变量控制：

| *变量*             | *默认值* | *说明*       |
| ---------------- | ----- | ---------- |
| `kern.filedelay` | 30    | 延迟同步文件的时间  |
| `kern.dirdelay`  | 29    | 延迟同步目录的时间  |
| `kern.metadelay` | 28    | 延迟同步元数据的时间 |

## 参见

sync(2), fsck(8), sync(8), [sysctl(8)](/man/man8/sysctl.8.md)

## 历史

`syncer` 进程是“update”命令的后代，后者出现于 Version 6 AT\&T UNIX，通常在系统进入多用户模式时由 **`/etc/rc`** 启动。内核发起的“update”进程首次出现于 FreeBSD 2.0。

## 缺陷

在某些系统上，sync(2) 与崩溃同时发生可能导致文件系统损坏。参见 fsck(8)。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://book.bsdcn.org/man/man4/syncer.4.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
