| 跳过导航链接 | |
| 退出打印视图 | |
|
Oracle Solaris 11.1 管理:设备和文件系统 Oracle Solaris 11.1 Information Library (简体中文) |
以下各节提供关于管理 Oracle Solaris 中的设备所用功能的概述信息:
有关访问设备的信息,请参见访问设备。
您可以使用设备检测工具确定本 Oracle Solaris 发行版中是否支持 x86 硬件。有关更多信息,请转至 http://www.oracle.com/webfolder/technetwork/hcl/hcts/device_detect.jsp。
一台计算机通常会使用大量外围设备和海量存储设备。例如,您的系统可能装有磁盘驱动器、键盘和鼠标,以及某种 DVD 刻录器。
其他常用的设备包括以下各项:
DVD 驱动器
打印机和绘图仪
光笔
触控式屏幕
数字化仪
图形输入板和笔尖对
Oracle Solaris 软件并不直接与所有这些设备进行通信。每种类型的设备都要求不同的数据格式、协议和传输率。
设备驱动程序是一种底层程序,通过它操作系统可与特定硬件通信。驱动程序可用作操作系统对该硬件的“解释程序”。
在 Oracle Solaris 11 发行版中,驱动程序定制在 /etc/driver/drv 目录中,而非 /kernel 目录,与以前的发行版一样。此改进意味着在系统升级时,您的驱动程序定制不会被覆盖。在升级期间保留 /etc/driver/drv 目录中的文件。
对驱动程序配置进行定制通常意味着添加或修改每设备参数或者添加或修改影响所有设备的全局属性。
# cp /kernel/drv/sd.conf /etc/driver/drv/sd.conf
例如,sd.conf 包括目标 0,lun 0 处的 sd 设备的以下条目:
name="sd" class="scsi" target=0 lun=0;
若要为该设备添加 retries 参数,请按照以下所示修改现有的条目:
name="sd" class="scsi" target=0 lun=0 retries=4;
# prtconf -vu
sd, instance #1
Admin properties:
name='retries' type=int items=1
value=00000004内核包含一个小的通用核心,其中带有一个平台特定的组件和一组模块。在本 Oracle Solaris 发行版中,内核是自动配置的。
内核模块是用于在系统上执行特定任务的一个软件组件。可装入内核模块的一个示例是访问设备时装入的设备驱动程序。
内核模块在下表中介绍。
表 3-2 Solaris 内核模块的说明
|
系统可确定在引导时与其连接的设备。然后,内核会对其自身进行动态配置,将所需的模块装入内存中。此时,在访问磁盘和磁带等设备时就会装入设备驱动程序。此过程称为自动配置,因为所有的内核模块在需要时都会自动装入。
通过修改 /etc/system 文件,可以定制装入内核模块的方式。有关修改此文件的说明,请参见 system(4)。
自动配置的优点如下:
由于模块会在需要时装入,因此可更有效地使用主内存。
向系统中添加新设备时,无需重新配置内核。
可以在不重构内核的情况下装入并测试驱动程序。
向系统中添加新设备(和驱动程序)时会使用自动配置功能。在以前的发行版中,将设备添加到关闭的系统中时,有必要执行重新配置引导。设备配置增强功能使得在将设备添加到关闭的系统中时,无需重新配置引导。
如果系统组件支持热插拔,当系统仍在运行时,可以在 Oracle Solaris OS 中添加、移除或更换设备。有关热插拔设备的信息,请参见第 4 章。
Oracle Solaris 发行版中包括支持各种标准设备所需的设备驱动程序。可以在 /kernel/drv 和 /platform/`uname -m`/kernel/drv 目录中找到这些驱动程序。
但是,如果购买了不受支持的设备,制造商应该提供正确安装、维护和管理设备所需的软件。
该软件至少包括设备驱动程序及其关联的配置 (.conf) 文件。.conf 文件驻留在 drv 目录中。该软件可能还包括定制维护和管理实用程序,因为该设备可能与 Oracle Solaris 实用程序不兼容。
有关不受支持的设备所需内容的更多信息,请与设备制造商联系。
|
有关用于标识系统上设备的设备名称的信息,请参见设备命名约定。
prtconf 和 sysdef 命令可能会显示以下与驱动程序有关的消息:
device, instance #number (driver not attached)
此消息并不总是表示驱动程序不可用于此设备。此消息表示当前没有向设备实例附加任何驱动程序,因为此节点中不存在任何设备或者设备未在使用中。驱动程序是在访问设备时自动装入的。如果设备未在使用中,则会卸载这些驱动程序。
指定的设备在使用中时,用以下实用程序进行检测:
dumpadm
format
mkfs 和 newfs
swap
这些增强功能说明这些实用程序可能会检测以下某些使用情况:
设备是 ZFS 存储池的一部分
设备是转储设备或交换设备
/etc/vfstab 文件中存在设备的已挂载文件系统或某个项
例如,如果尝试使用 format 实用程序访问某个活动的设备,您将看到类似于以下内容的消息:
# format
Searching for disks...done
AVAILABLE DISK SELECTIONS:
0. c1t0d0 <FUJITSU-MAY2073RCSUN72G-0401 cyl 8921 alt 2 hd 255 sec 63>
/pci@0,0/pci1022,7450@2/pci1000,3060@3/sd@0,0
/dev/chassis/SYS/HD0/disk
1. c1t1d0 <FUJITSU-MAY2073RCSUN72G-0401-68.37GB>
/pci@0,0/pci1022,7450@2/pci1000,3060@3/sd@1,0
/dev/chassis/SYS/HD1/disk
Specify disk (enter its number): 0
selecting c1t0d0
[disk formatted]
/dev/dsk/c1t0d0s0 is part of active ZFS pool rpool. Please see zpool(1M).
FORMAT MENU:
.
.
.
使用 prtconf 和 sysdef 命令的输出可确定与系统连接的磁盘、磁带和 DVD 设备。这些命令的输出会在设备实例旁边显示 driver not attached 消息。由于这些设备始终受某个系统进程监视,因此 driver not attached 消息通常明确表示该设备实例中不存在任何设备。
使用 sysdef 命令可显示系统配置信息,其中包括伪设备、可装入模块以及选定的内核参数。
例如,SPARC 系统上的以下 prtconf -v 输出确定了与系统连接的磁盘设备。详细的磁盘信息在 Device Minor Nodes 一节介绍。
$ /usr/sbin/prtconf -v | more
Memory size: 32640 Megabytes
System Peripherals (Software Nodes):
SUNW,SPARC-Enterprise-T5220
.
.
.
location: /dev/chassis/SUN-Storage-J4400.0918QAKA24/SCSI_Device__2/disk
Device Minor Nodes:
dev=(27,40)
dev_path=/pci@0/pci@0/pci@8/pci@0/pci@a/LSILogic,sas@0/sd@2,0:a
spectype=blk type=minor
dev_link=/dev/dsk/c4t2d0s0
dev_path=/pci@0/pci@0/pci@8/pci@0/pci@a/LSILogic,sas@0/sd@2,0:a,raw
spectype=chr type=minor
dev_link=/dev/rdsk/c4t2d0s0
Device Minor Layered Under:
mod=zfs accesstype=blk
dev_path=/pseudo/zfs@0
Minor properties:
name='Nblocks' type=int64 items=1 dev=(27,40)
value=0000000074702c8f
name='Size' type=int64 items=1 dev=(27,40)
value=000000e8e0591e00
.
.
.例如,SPARC 系统上的以下 prtconf 输出显示了 /dev/dsk/c4t2d0s0 的 sd 实例编号。
# prtconf -v /dev/dsk/c4t2d0s0 | grep instance sd, instance #5
# prtconf | grep -v not
例如,以下 fuser 命令显示了正在访问 /dev/console 设备的进程。
# fuser -d /dev/console /dev/console: 5742o 2269o 20322o 858o
示例 3-1 显示系统配置信息
基于 x86 的系统会显示以下 prtconf 输出。
# prtconf
System Configuration: Oracle Corporation i86pc
Memory size: 8192 Megabytes
System Peripherals (Software Nodes):
i86pc
scsi_vhci, instance #0
pci, instance #0
pci108e,4843, instance #0
pci8086,25e2, instance #0
pci8086,3500, instance #7
pci8086,3510, instance #9
pci8086,3518, instance #10
pci108e,4843, instance #0
pci108e,4843, instance #1
pci8086,350c, instance #8
pci8086,25e3 (driver not attached)
pci8086,25f8, instance #2
pci108e,286, instance #0
disk, instance #0
disk, instance #2
disk, instance #3
disk, instance #1
pci8086,25e5 (driver not attached)
pci8086,25f9 (driver not attached)
pci8086,25e7 (driver not attached)
pci108e,4843, instance #0 (driver not attached)
pci108e,4843, instance #1
pci108e,4843, instance #2 (driver not attached)
pci108e,4843 (driver not attached)
pci108e,4843 (driver not attached)
pci108e,4843 (driver not attached)
pci108e,4843 (driver not attached)
pci8086,2690, instance #6
pci108e,125e, instance #2
pci108e,125e, instance #3
pci108e,4843, instance #0
pci108e,4843, instance #1
device, instance #0
keyboard, instance #0
mouse, instance #1
pci108e,4843, instance #2
pci108e,4843, instance #3
pci108e,4843, instance #0
storage, instance #0
disk, instance #4
.
.
.
# sysdef
* Hostid
*
29f10b4d
*
* i86pc Configuration
*
*
* Devices
*
+boot (driver not attached)
memory (driver not attached)
aliases (driver not attached)
chosen (driver not attached)
i86pc-memory (driver not attached)
i86pc-mmu (driver not attached)
openprom (driver not attached)
options, instance #0
packages (driver not attached)
delayed-writes (driver not attached)
itu-props (driver not attached)
isa, instance #0
motherboard (driver not attached)
pnpADP,1542, instance #0
asy, instance #0
asy, instance #1
lp, instance #0 (driver not attached)
fdc, instance #0
fd, instance #0
fd, instance #1 (driver not attached)
kd (driver not attached)
kdmouse (driver not attached)
.
.
.
设备弃用机制通过故障管理框架 (fault management framework, FMA) 将设备隔离为有故障。通过该功能,可以安全且自动地禁用故障设备,从而避免数据丢失、数据损坏或紧急情况和系统停机。弃用过程安全地执行,考虑弃用设备后的系统稳定性。
永远不弃用关键设备。如果需要手动更换弃用的设备,除了执行手动更换步骤以外,还应在更换设备后使用 fmadm repair 命令,以便系统知道设备已更换。
有关更多信息,请参见 fmadm(1M)。
有关设备弃用的一般消息显示在控制台上,并写入 /var/adm/messages 文件中,以使您了解弃用的设备。例如:
Aug 9 18:14 starbug genunix: [ID 751201 kern.notice] NOTICE: One or more I/O devices have been retired
可以使用 prtconf 命令来确定特定的弃用设备。例如:
# prtconf
.
.
.
pci, instance #2
scsi, instance #0
disk (driver not attached)
tape (driver not attached)
sd, instance #3
sd, instance #0 (retired)
scsi, instance #1 (retired)
disk (retired)
tape (retired)
pci, instance #3
network, instance #2 (driver not attached)
network, instance #3 (driver not attached)
os-io (driver not attached)
iscsi, instance #0
pseudo, instance #0
.
.
.
使用下面的步骤解决有故障的设备或已弃用的设备。
还可以使用 zpool status 或 fmadm 命令查看 ZFS 设备问题或故障信息。有关 ZFS 设备问题或故障信息,请参见《Oracle Solaris 11.1 管理:ZFS 文件系统》中的第 10 章 "Oracle Solaris ZFS 故障排除和池恢复"。
# fmadm faulty
--------------- ------------------------------------ -------------- ---------
TIME EVENT-ID MSG-ID SEVERITY
--------------- ------------------------------------ -------------- ---------
Jun 20 16:30:52 55c82fff-b709-62f5-b66e-b4e1bbe9dcb1 ZFS-8000-LR Major
Problem Status : solved
Diag Engine : zfs-diagnosis / 1.0
System
Manufacturer : unknown
Name : ORCL,SPARC-T3-4
Part_Number : unknown
Serial_Number : 1120BDRCCD
Host_ID : 84a02d28
----------------------------------------
Suspect 1 of 1 :
Fault class : fault.fs.zfs.open_failed
Certainty : 100%
Affects : zfs://pool=86124fa573cad84e/vdev=25d36cd46e0a7f49/
pool_name=pond/vdev_name=id1,sd@n5000c500335dc60f/a
Status : faulted and taken out of service
FRU
Name : "zfs://pool=86124fa573cad84e/vdev=25d36cd46e0a7f49/
pool_name=pond/vdev_name=id1,sd@n5000c500335dc60f/a"
Status : faulty
Description : ZFS device 'id1,sd@n5000c500335dc60f/a' in pool 'pond' failed to
open.
Response : An attempt will be made to activate a hot spare if available.
Impact : Fault tolerance of the pool may be compromised.
Action : Use 'fmadm faulty' to provide a more detailed view of this event.
Run 'zpool status -lx' for more information. Please refer to the
associated reference document at
http://support.oracle.com/msg/ZFS-8000-LR for the latest service
procedures and policies regarding this diagnosis.# zpool clear pond c0t5000C500335DC60Fd0
如果设备发生间歇错误,但没有更换该设备,则可以尝试清除先前的错误。
# fmadm repaired zfs://pool=86124fa573cad84e/vdev=25d36cd46e0a7f49/ \ pool_name=pond/vdev_name=id1,sd@n5000c500335dc60f/a fmadm: recorded repair to of zfs://pool=86124fa573cad84e/vdev=25d36cd46e0a7f49/ pool_name=pond/vdev_name=id1,sd@n5000c500335dc60f/a
# fmadm faulty
如果错误已被清除,则 fmadm faulty 命令不会返回任何内容。