# halt.8

REBOOT(8)

REBOOT(8)

FreeBSD System Manager's Manual

REBOOT(8)

## [名称](#__u540D___u79F0_)

`reboot`, `halt`, `fastboot`, `fasthalt` —

停止和重新启动系统

## [概要](#__u6982___u8981_)

`halt` \[`-lNnpq`] \[`-k` kernel] `reboot` \[`-cdlNnpqr`] \[`-k` kernel] `fasthalt` \[`-lNnpq`] \[`-k` kernel] `fastboot` \[`-dlNnpq`] \[`-k` kernel]

## [描述](#__u63CF___u8FF0_)

`halt` 和 `reboot` 实用程序将文件系统缓存刷新到磁盘，向所有正在运行的进程发送一个 `SIGTERM` （随后是一个 `SIGKILL`) ，并分别暂停或重新启动系统。 记录该操作，包括将关闭记录输入用户记帐数据库。

选项如下：

[`-c`](#c)

系统将关闭电源，然后在可能的情况下将其重新打开。 如果断电操作失败，系统将正常停止或重新启动，具体取决于是否调用了 `halt` 或 `reboot` 。 目前，只有 ipmi(4) 驱动程序实现电源循环功能，并且仅在具有支持电源循环的 BMC 的硬件上实现。 与关机不同，支持电源循环的硬件数量很少。

[`-d`](#d)

系统被请求创建故障转储。 此选项仅在重新启动时受支持，除非先前已使用 dumpon(8) 指定了转储设备，否则该选项无效。

[`-k`](#k) kernel

在下次系统引导时引导指定的 kernel 。 如果内核启动成功， *default* 内核将在连续启动时启动，这是一个一次性选项。 如果引导失败，系统将继续尝试引导 kernel ，直到引导过程被中断并引导了一个有效的内核。 这在未来可能会改变。

[`-l`](#l)

暂停或重新启动 *not* 记录到系统日志中。 此选项适用于诸如 shutdown(8) 等调用 `reboot` 或 `halt` 并自行记录的应用程序。

[`-N`](#N)

在初始进程清理期间不会刷新文件系统缓存，但是内核级别的 reboot(2) 仍会使用同步进行处理。 此选项对于在设备可能不可用时执行 “best-effort” 重新启动很有用。 这可能在设备已断开连接时发生，例如使用 iscsi(4) 。

[`-n`](#n)

文件系统缓存未刷新。 可能不应该使用此选项。

[`-p`](#p)

如果可以，系统将关闭电源。 如果断电操作失败，系统将正常停止或重新启动，具体取决于是否调用了 `halt` 或 `reboot` 。

[`-q`](#q)

系统被快速且不正常地停止或重新启动，并且仅执行文件系统缓存的刷新（如果未指定 `-n` 选项）。 可能不应该使用此选项。

[`-r`](#r)

系统终止所有进程，卸载所有文件系统，安装新的根文件系统，并开始通常的启动顺序。 使用 kenv(1) 更改 vfs.root.mountfrom 后，可以使用 reboot `reboot` `-r` 更改根文件系统，同时保留内核状态。 这需要加载 tmpfs(5) 内核模块，因为 init(8) 在卸载旧根之后但在新根就位之前需要一个地方来存储自己。

`fasthalt` 和 `fastboot` 实用程序只不过是 `halt` 和 `reboot` 实用程序的别名。

通常， shutdown(8) 实用程序在系统需要停止或重新启动时使用，提前警告用户即将到来的厄运并彻底终止特定程序。

## [实例](#__u5B9E___u4F8B_)

用从 /dev/ada0s1a 挂载的 UFS 替换当前根文件系统：

kenv vfs.root.mountfrom=ufs\:/dev/ada0s1a reboot -r

这种机制也可以与 NFS 一起使用，但需要注意的是它仅适用于 NFSv4，并且需要一个数字 IPv4 地址：

kenv vfs.root.mountfrom=nfs:192.168.1.1:/share/name reboot -r

## [参见](#__u53C2___u89C1_)

kenv(1), getutxent(3), ipmi(4), boot(8), dumpon(8), nextboot(8), savecore(8), shutdown(8), sync(8)

## [历史](#__u5386___u53F2_)

`reboot` 实用程序出现在 4.0BSD 中。

December 20, 2017

FreeBSD 13.1-RELEASE


---

# Agent Instructions: 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:

```
GET https://man.bsdcn.org/man8/halt.8.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
