Chinaunix首页 | 论坛 | 博客
  • 博客访问: 897274
  • 博文数量: 148
  • 博客积分: 10010
  • 博客等级: 上将
  • 技术积分: 3920
  • 用 户 组: 普通用户
  • 注册时间: 2007-06-30 18:17
文章分类

全部博文(148)

文章存档

2008年(148)

我的朋友

分类:

2008-04-10 07:50:29


Disk Slices
磁盘在逻辑上被分为单个的分区叫做Slice. slices 在功能上是用来组织数据的、经cylinder分组所组成的。
Note – Grouping cylinders into slices is done to organize data, facilitate backups, and provide swap space.
一个磁盘能分为8个slice,从0到7。
为了方便,Slice 2 代表整个磁盘。它维持着关于整个磁盘的重要数据。
Table 2-1 Disk Slices
Slice     Name                                    Function
0           /               The root directory’s system files
1           swap               Swap area
2                                                     Entire disk
5           /opt               Optional software
6           /usr               System executables and programs
7           /export/home      User files and directories
Disk Slice Naming Convention
通常一个8字符的串代表一个slice的全名。这个串包括controller number, the target number, the disk number, and the slice number.
Controller number Identifies the host bus adapter (HBA), which controls communications between the system and disk unit. The HBA takes care of sending and receiving both commands and data to the device.
The controller number is assigned in sequential order, such as c0, c1, c2, and so on.
Target number Target numbers, such as t0, t1, t2, and t3, correspond to a unique hardware address that is
assigned to each disk, tape, or CD-ROM. Some external disk drives have an address switch located on the rear panel. Some internal disks have address pins that are jumpered to assign that disk’s target number.
Disk number The disk number is also known as the logical unit number (LUN). This number reflects the number
of disks at the target location.
Slice number A slice number ranging from 0 to 7. The embedded SCSI configuration and the integrated device electronics (IDE) configuration represent the disk slice naming conventions across two different architectures. The disk number is always set to d0 with embedded SCSI disks.
 Introducing Solaris OE Device Naming Conventions
在Solaris中,所有设备由3种不同不同类型的名称所代表,depending on how the device is being referenced:
Logical device names
Physical device names
Instance names
Note – The Berkeley Software Distribution (BSD) device names exist in the Solaris OE if the BSD compatibility packages are installed with the Solaris Developer, Entire Distribution, or Entire Distribution Plus the original equipment manufacturer (OEM) Solaris software group. The BSD device names, for example /dev/sd0a, are typically used for backward compatibility with old scripts.
Logical Device Names
逻辑磁盘设备名称是指向Logical disk device names are symbolic links to the physical device names kept in the /devices 目录下的物理设备名称的符号连接。这种名称在你输入命令时使用。所有的逻辑设备名称保存在/dev 目录下。逻辑名称包括the controller number, target number, disk number, and slice number。
每个磁盘设备在/dev/dsk and /dev/rdsk 目录下分别有对应于块设备和字符设备的条目。To display the entries in the /dev/dsk directory, perform the command:
# ls /dev/dsk
Physical Device Names
物理名称唯一地标识系统上硬件设备的物理地址,并维护在/devices目录下。
A physical device name contains the hardware information, represented as a series of node names, separated by slashes, that indicate the path to the device. To display a physical device name, perform the command:
# ls -l /dev/dsk/c0t0d0s0
在系统启动过程中,kernel 找出设备的物理地址。Kernel关联地址一个node,nodename@address, 它就是物理设备名。
In Figure 2-9, is the direct access disk device at address 0.
Instance Names
实例名是内核给系统上设备所起名称的简写。
An instance name is a shortened name for the physical device name. Two examples are shown:
sdn
where sd is the disk name and nis the number, such as sd0 for the first SCSI disk device.
dadn
where dad (direct access device) is the disk name and nis the number, such as dad0 for the first IDE disk device.
Listing a System’s Devices
In the Solaris OE, there are several ways to list a system’s devices, including:
Using the /etc/path_to_inst file
Using the prtconf command
Using the format command
The /etc/path_to_inst File
对于每个设备,系统记录物理名称和实例名称在/etc/path_to_inst file. These names are used by the kernel to identify every possible device. This file is read only at boot time.
The /etc/path_to_inst file is maintained by the kernel, and it is generally not necessary, nor is it advisable, for the system administrator to change this file.
The following example shows entries in the /etc/path_to_inst file. The text within the parentheses indicates what device is referred to by the entry and does not appear in the actual file.
# more /etc/path_to_inst
The prtconf Command
使用prtconf 命令在显示系统的配置信息,包括总的内存量以及系统外围设备信息。 它列出设备所有可能的实例名称,不管这个设备是否attach或者没有attach到系统。要查看attach到系统的设备,使用下面的命令。
# prtconf | grep -v not
The format Command
Reconfiguring Devices
Using the devfsadm Command
Many systems are running critical customer applications on a 24-hour, 7-day-a-week basis. It might not be possible to perform a reconfiguration boot on these systems. In this situation, you can use the devfsadm command.
The devfsadm command performs the device reconfiguration process and updates the /etc/path_to_inst file and the /dev and /devices directories during reconfiguration events.
The devfsadm command attempts to load every driver in the system and attach all possible device instances. It then creates the device files in the /devices directory and the logical links in the /dev directory. In addition
to managing these directories, the devfsadm command also maintains the /etc/path_to_inst file.
要将To restrict the operation of the devfsadm 的操作限制在特定的设备,使用-c 选项。
devfsadm -c device_class
device_class 可取的值包括disk, tape, port, audio, and pseudo. For example, to restrict the devfsadm command to the disk device class, perform the command:
# devfsadm -c disk
可以一行指定多个设备类型。Use the -c option more than once on the command line to specify multiple device classes. For example, to specify the disk, tape, and audio device classes, perform the command:
# devfsadm -c disk -c tape -c audio
To restrict the use of the devfsadm command to configure only devices for a named driver, use the -i option.
devfsadm -i driver_name The following examples use the -i option.
To configure only those disks supported by the dad driver, perform the command:
# devfsadm -i dad
Partitioning the Hard Disk
Introducing Disk Partition Tables
As the root user, when you use the format utility and select a disk to partition, a copy of the disk’s partition table is read from the label on the disk into memory and is displayed as the current disk partition table.
当你使用format命令时,format将读取这个文件(/etc/format.dat ).这个文件是一个可用 磁盘类型的表和一个预先定义的分区表的集合,你能用它来快速分区磁盘。
Introducing Disk Labels
The disk’s label is the area set aside for storing information about the disk’s controller, geometry, and slices. Another term used to describe a disk label is the volume table of contents (VTOC). The disk’s label or VTOC is stored on the first sector of the disk. 对一个磁盘做label意味着写分区信息到磁盘上。 a disk means to write slice information onto the disk.如果你在slice后没有进行label,分区信息将丢失。磁盘label的一个重要部分是分区表,它定义了磁盘的slice,slice的cylinders的边界和总尺寸。
Using the format Command
The format utility is organized into two tiers of commands.
When you type format on the command line, the first tier of commands appears. This set of commands allow you to, among other functions, select a disk, select a partition, save new disk and partition definitions, and write the label to the disk. The top tier of commands is denoted by the format> prompt. The second tier of commands appears when you type partition from the format> prompt. This set of commands allow you to, among other
functions, define the characteristics of the individual slices, print the existing partition table, and write the partition map and label to the disk. Table 2-2 describes the terminology for disk partitioning.
Table 2-2 Partition Table Terms and Usage
Term                  Description
Part        The slice number. Valid slice numbers are 0 through 7.
Tag         A value that indicates how the slice is being used.
0 = unassigned
1 = boot
2 = root
3 = swap
4 = usr
5 = backup
6 = stand
8 = home
Sun StorEdge? Volume Manager array tags:
14 = public (region)
15 = private (region)
Flag        00 wm = The disk slice is writable and mountable.
01 wu = The disk slice is writable and unmountable. This is the default state
of slices dedicated for swap areas.
10 rm = The disk slice is read-only and mountable.
11 ru = The disk slice is read-only and unmountable.
Cylinders    The starting and ending cylinder number for the disk slice.
Size        The slice size: Mbytes (MB), Gbytes (GB), blocks (b), or cylinders (c).
Blocks      The total number of cylinders and the total number of sectors per slice.
Managing Disk Labels
Every disk in the Solaris OE has a label set aside for storing information about the disk’s controller, geometry, and slices.
Viewing the Disk VTOC
You can use two methods for locating and viewing a disk’s label or VTOC:
(1)Use the verify command from the format utility
(2)Invoke the prtvtoc command from the command line
Reading a Disk’s VTOC Using the verifyCommand
The verify command enables you to view a disk’s VTOC from within the format utility. To read a disk’s VTOC, perform the following steps:
At the format prompt, enter the verify command, and press Return.
format> verify
剩下的步骤省略
Reading a Disk’s VTOC Using the prtvtoc Command
The prtvtoc command enables you to view a disk’s VTOC from the command line. To view a disk’s VTOC from the command line, type the following:
# prtvtoc /dev/rdsk/c1t0d0s2
Relabeling a Disk
使用prtvtoc 命令将将磁盘的VTOC写到文件中。这样你就能使用fmthard 命令来重新label磁盘,比如发生下面的情况:
(1)The VTOC on the disk has been destroyed.
(2)You accidentally changed the partition information on the disk and did not save a backup label in the /etc/format.dat file.
To save a disk’s VTOC to a file, perform the command:
# prtvtoc /dev/rdsk/c1t0d0s2 > /vtoc/c1t0d0
The fmthard Command
To relabel a disk, you can save the output of the prtvtoc command into a file on another disk and use it as the datafile argument to the fmthard command.
fmthard -s datafile /dev/rdsk/c#t#d#s2
Caution – The fmthard command cannot write a disk label on an unlabeled disk. Use the format utility for this purpose. If the need to relabel a disk arises and the VTOC was previously saved to a file, the following options are available:
(1)Run format, select the disk, and label it with the default partition table.
(2)Use the fmthard command to write the desired label information, previously saved to a datafileback to the disk.
# fmthard -s /vtoc/c1t0d0 /dev/rdsk/c1t0d0s2
查看SA 239中本节对应的练习。
阅读(896) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~