【 在 qingquan (NeverMind) 的大作中提到: 】
: 标 题: /dev/daX 的顺序在更换硬盘之后是否会变?
: 发信站: 水木社区 (Sat Mar 8 14:03:36 2014), 转信
:
: 用的LSI-SAS2008-IT mode,接了8块希捷的硬盘。前些时候/dev/da3 smartd报有问题,于是用一块WD的硬盘更换。奇怪的是用smartctl察看状态发现WD硬盘被放到了/dev/da7,从序列号判断我更换的硬盘是正确的。为啥设备号会跳来跳去呢?以后更换硬盘是不是还会遇到同样的情况?
: 如何判断,或者如何请系统帮助显示某设备号代表的物理硬盘的位置?
: 多谢!
默认情况下,da(4) 是按照总线探测的顺序来分配设备编号的。如果没有特别
指定,就会按照这个顺序来排列,例如新增的硬盘通常情况下会是 da(N+1)。
具体的代码是 cam 的 camperiphunit()。
如果需要让 da(4) 以确定的方式分配序号(考虑到新版 FreeBSD 上提供了
'diskid' 标签,即 /dev/diskid/* 其中 * 部分是磁盘序列号),另外各类
分区表、文件系统等等都提供了一裤衩子方法来确定磁盘顺序,因此通常并不
需要这样做),可以参见 scsi(4) 中的配置:
Units are wired down by setting kernel environment hints. This is usu-
ally done either interactively from the loader(8), or automatically via
the /boot/device.hints file. The basic syntax is:
hint.device.unit.property="value"
Individual CAM bus numbers can be wired down to specific controllers with
a config line similar to the following:
hint.scbus.0.at="ahd1"
This assigns CAM bus number 0 to the ahd1 driver instance. For con-
trollers supporting more than one bus, a particular bus can be assigned
as follows:
hint.scbus.0.at="ahc1"
hint.scbus.0.bus="1"
This assigns CAM bus 0 to the bus 1 instance on ahc1. Peripheral drivers
can be wired to a specific bus, target, and lun as so:
hint.da.0.at="scbus0"
hint.da.0.target="0"
hint.da.0.unit="0"
This assigns da0 to target 0, unit (lun) 0 of scbus 0. Omitting the tar-
get or unit hints will instruct CAM to treat them as wildcards and use
the first respective counted instances. These examples can be combined
together to allow a peripheral device to be wired to any particular con-
troller, bus, target, and/or unit instance.
When you have a mixture of wired down and counted devices then the count-
ing begins with the first non-wired down unit for a particular type.
That is, if you have a disk wired down as device da1, then the first non-
wired disk shall come on line as da2.
--
[m[1;32m※ 来源:・水木社区 newsmth.net・[FROM: 24.5.244.*][m