An Example of Adding a Peripheral


In this section, we'll construct a device file for a tape drive. Chapter 8 covers the process of using device files and all Logical Volume Manager commands for adding disk devices that you may want to view as well. Before we construct a device file, let's view two existing device files on a workstation (what we used to call a Series 700) and see where some of this information appears. The first long listing is that of the tape drive, and the second is the disk, both of which are on the workstation in the earlier listings.

( on workstation)

 $  ll /dev/rmt/0m  crw-rw-rw- 2 bin bin 205 0x003000 Feb 12 03:00 /dev/rmt/0m 

( on workstation)

 $  ll /dev/dsk/c0t1d0  brw-r----- 1 bin sys 31 0x001000 Feb 12 03:01 /dev/dsk/c0t1d0 

The tape drive device file, /dev/rmt/0m , shows a major number of 205 corresponding to that shown for the character device driver stape from lsdev . The disk drive device file, /dev/dsk/c0t6d0 , shows a major number of 31 corresponding to the block device driver sdisk from lsdev . Since the tape drive requires only a character device file and no major number exists for a block stape device, as indicated by the -1 in the block column of lsdev , this file is the only device file that exists for the tape drive. The disk, on the other hand, may be used as either a block device or a character device (also referred to as the raw device ). Therefore, we should see a character device file, /dev/rdsk/c0t6d0 , with a major number of 188 , as shown in lsdev for sdisk .

( on workstation)

 $  ll /dev/rdsk/c0t0d0  crw-r-----  1   root   sys   188   0x001000   Feb   12   03:01 /dev/rdsk/c0t1d0 

We can now create a device file for a second tape drive, this time at SCSI address 2, and a disk device file for a disk drive at SCSI address 5, using the mksf command. You can run mksf in two different ways. The first form of mksf requires you to include less specific information, such as the minor number. The second form requires you to include more of this specific information. Some of these arguments relate only to the specific form of mksf you use.

-d

Use the device driver specified. A list of device drivers is obtained with the lsdev command.

-C

The device specified belongs to this class. The class is also obtained with the lsdev command.

-H

Use the hardware path specified. Hardware paths are obtained with the ioscan command.

-m

The minor number of the device is supplied.

-r

Create a character, also known as a raw device file. The default is to create a block file.

-v

Use verbose output, which prints the name of each special file as it is created.

We will now create the device files for a disk drive. Both a block and a character device file are required. The 0x005000 in the example corresponds to the address of 5 on the disk drive. This number, used in both the block and character device files, is unique for every disk drive created.

We can now create a block device file for a disk at SCSI address 5 using the following mksf command:

( on workstation)

 $  /sbin/mksf -v -C disk -m 0x005000 /dev/dsk/c0t5d0  making /dev/dsk/c0t5d0 b 31 0x005000 

Similarly, we can now create a character device file for a disk at SCSI address 5 using the second form of mksf :

( on workstation)

 $  /sbin/mksf -v -r -C disk -m 0x005000 /dev/dsk/c0t5d0  making /dev/rdsk/c0t5d0 c 188 0x005000 

The -v option used in these examples prints out each device file as it is created. If you wanted to add a second tape drive at SCSI address 2 to your system in addition to the existing tape drive ( /dev/rmt/0m ), you might use the following mksf command:

( on workstation)

 $  /sbin/mksf  -v -C tape -m 0x002000 /dev/rmt/1m  making /dev/rmt/1m c 205 0x002000 

Character devices are automatically produced for tape drives , since no block device drivers are required. This fact was found in the output from the lsdev command, as indicated by a -1 in the "Block" column.

With this level of device file background, you should have a good understanding of the device files that SAM will build for you when you add peripherals. By the way, printer device files look very different from the device files I covered here, but all the same principles apply.



HP-UX 11i Systems Administration Handbook and Toolkit
HP-UX 11i Systems Administration Handbook and Toolkit (2nd Edition)
ISBN: 0131018833
EAN: 2147483647
Year: 2003
Pages: 301

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net