> 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/man8/diskinfo.8.md).

# diskinfo.8

`diskinfo` — 获取磁盘设备信息

## 名称

`diskinfo`

## 概要

`diskinfo [-ciStvw] disk ...`

`diskinfo [-l] -p disk ...`

`diskinfo [-l] -s disk ...`

## 描述

`diskinfo` 工具打印有关磁盘设备的信息，并可选择对该设备运行简单的性能测试。

可用选项如下：

**`-c`** 对 I/O 读命令的开销进行简单测量。

**`-i`** 执行简单的 IOPS 基准测试。

**`-l`** 在 `-p` 或 `-s` 模式下，在输出的每一行前面加上设备名称，使用制表符作为分隔符。

**`-p`** 返回磁盘的物理路径。这是一个标识磁盘在存储机柜中物理路径的字符串。

**`-S`** 执行同步随机写入测试（ZFS SLOG 测试），测量写入不同大小的数据块和刷新磁盘缓存所需的时间。大于 128KB 的数据块会使用多个并行操作写入。

**`-s`** 返回磁盘标识，通常为序列号。

**`-t`** 对磁盘的寻道和传输性能执行简单且相当粗糙的基准测试。

**`-v`** 每个字段单独占一行打印，并附带描述性注释。

**`-w`** 允许破坏性写入测试。

如果不给定参数，输出将为每个指定设备一行，包含以下字段：设备名称、扇区大小、媒体大小（字节）、媒体大小（扇区）、条带大小、条带偏移、固件柱面、固件磁头和固件扇区。最后三个字段仅在信息可用时才存在。

## 实例

列出前十个（至多）[da(4)](https://github.com/FreeBSD-Ask/freebsd-man-sc/blob/main/man4/da.4.md) 设备及其对应的序列号：

```sh
diskinfo -ls /dev/da?
```

## 参见

[da(4)](https://github.com/FreeBSD-Ask/freebsd-man-sc/blob/main/man4/da.4.md)

## 历史

`diskinfo` 命令出现于 FreeBSD 5.1。

## 作者

`diskinfo` 工具由 Poul-Henning Kamp <phk@FreeBSD.org> 编写。

## 缺陷

按严重程度递增顺序排列如下：谎言、该死的谎言、统计数据和计算机基准测试。


---

# 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/man8/diskinfo.8.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.
