Digital Unix Device Files |
Device File Creation
Before a device file is created, the OS kernel has to support the device
in question. If you are talking about disk or tape devices, this is
mostly a matter of having the kernel built to know about the SCSI
controller that the disk or tape drive is attached to. If you are
adding a disk or tape drive to an existing controller, you should not have
to rebuild the kernel. For more details on building kernels, see the
"Building Kernels" page in this site, or look at the online html
documentation from Digital.
Device files are generally created automatically at system boot up time
by the /dev/MAKEDEVS script. If you need to run this script
manually, you simply run the script as root and specify what type of
device you are installing and what it's SCSI target id is.
For example, to create a disk device for a SCSI disk on controller 0,
target 0, and a tz tape drive on target 5:
# cd /dev
# ./MAKEDEV rz0
# ./MAKEDEV tz5
I will explain the tape drive and disk drive names that are created
next.
Disk and Tape Drive Naming Conventions:
As with most Unixs, disk and tape device file names can be a little
obscure. But once you know the logic behind them, Digital Unix's
names are fairly straight forward.
For disk drives, the name is a combination of the type of type of
disk, the SCSI controller the disk is on, and the disk's target and LUN
numbers. This naming convention holds true whether the disk is
directly attached, or if it is in a RAID device such as an EMC Symmetrix.
In the case of a RAID array, the "disk" is likely to be a
logical device that is presented to the host rather than a physical disk.
Disk name format:
/dev/<device type><logical unit><target/controller
number><disk slice>
- <device type> refers to whether the device file is a block or
character device. Character devices are usually refereed to as "raw"
devices. This this the type of device that Sybase typically uses.
Raw devices have a leading "r", block devices have no leading
letter. SCSI disks usually start with "rz" (rrz0 for
raw), but I have also seen "re" (rre for raw) as a valid
prefix for disk name.
- <logical unit> This letter specifies the "logical
unit number" or "LUN" of the SCSI disk. This number
is usually 0 for normal disk drives. But RAID arrays often use
different LUNs on their logical disk drives as a way to increase the
number of logical disks that can be configured on a single SCSI
controller. LUN numbers range between 0-7. A LUN of 0 has no
additional letter in this position. Starting with LUN 1, the LUN
numbers 1-7 correspond to the letters b-h.
- <target/controller number> This number is computed by
using the formula "(SCSI Bus number * 8) + disk target number"
Where SCSI Buses start at 0, and SCSI target numbers are in the range of
0-7. Target number 7 is usually reserved for the SCSI controller
itself. The SCSI bus number assigned to a SCSI controller is
determined by the entries used in the kernel configuration file when it
was built.
- <disk slice letter> This is a letter from a-h. A
SCSI disk can be partitioned or sliced into 8 pieces, with partition "c"
being reserved to represent the entire disk. There will be disk
device files for each of the possible slices on the disk, "a-h",
even if a given disk partition is of 0 size and is not in use.
Slice "a" is where the root file system lives on a disk if it
is a boot disk. Slice "b" is the default swap partition
on the boot disk. If the disk is not a system boot disk, you can
use these partition letters for other purposes.
For each given physical or logical disk, there will be a total of 16
device files. One for each block device disk partition, and one for
each character (raw) disk partition.
Example: /dev/rz0a
- "rz" - specifies disk name is the block device for a SCSI
disk.
- Because there is no letter between the "rz" and the "0",
the LUN for the drive is "0".
- "0" signifies that this disk is target 0 on SCSI bus 0.
Usually SCSI bus 0 is the SCSI controller built into the system
motherboard.
- "a" This is the first partition on the disk.
Example 2: /dev/rrze17e
- "rz0" - specifies that the disk name is for the character
(raw) device of a SCSI disk.
- "e" - specifies that this disk has a LUN
of 5.
- "17" - 17 DIV 8 = 2, remainder 1. This
means that the disk is disk target 1, on SCSI bus number 2. (The third
bus)
- "e" - Disk partition letter e. "e"
is not designated as having any special purpose.
Tape Device names
Tape devices follow a different naming convention than disks.
You cannot tell what the target number and SCSI bus number is for a tape
device given just its name. The device name will also have other
modifiers that determine things like whether the tape rewinds after use,
and what density and compression settings are used on the tape.
/dev/<device type><device number><density/compression
flag>
- <device type> This will be "rmt" or "nrmt"
for tape drives. When the "rmt" device is used, the tape
drive will rewind the tape after use. When the "nrmt"
device is used, the tape will stay positioned in the middle of the tape
after use. This second behavior is used to place multiple file
marks on a tape.
- <device number> Tape device numbers start at 0. They only
signify what order the device files were created in, not what SCSI bus
they are attached to, or what their target id is.
- <density / compression flag> Tape drives are capable of
writing at multiple byte per inch densities, and some of them can use
data compression hardware to compress the data before it is written to
the tape. "h" is typically the high density/ compressing
device. Writing compressed data can result in better tape
utilization. Drive vendors typically quote a 100% additional
capacity figure, but real world values typically result in 50% more
capacity for mixed data. Writing to compression enabled devices
will typically be faster than writing to non compression devices.
This is because the bottleneck for a tape drive is typically the speed
at which the tape spins. By getting more data per inch of tape,
your writes go faster.
Example: /dev/nrmt1h
- "nrmt" this is the non-rewinding device name for the tape
drive.
- "1" This is the second tape drive on the system.
- "h" The tape drive is using it's highest density bpi
setting, and will use hardware data compression on the data as it is
sent to the tape.