Device Files in HP-UX 11i

   

HP-UX Virtual Partitions
By Marty Poniatowski

Table of Contents
Chapter 5.  Virtual Partitions and Devices


What could be more confusing in the UNIX world than device files? Fortunately, in HP-UX, device files for the Series 700 and Series 800 are nearly identical, so if you learn one, your knowledge applies to the other. In this section I cover:

  • The structure of device files.

  • Some commands associated with helping you work with device files.

  • Some examples of creating device files.

A device file provides the HP-UX kernel with important information about a specific device. The HP-UX kernel needs to know a lot about a device before I/O operations can be performed. With HP-UX 11i, the device file naming convention is the same for workstations and server systems. Device files are in the /dev directory. There may also be a subdirectory under /dev used to further categorize the device files. An example of a subdirectory would be /dev/dsk, where disk device files are usually located, and /dev/rmt, where tape drive device files are located. Figure 5-7 shows the HP-UX 11i device file-naming convention.

Figure 5-7. HP-UX 11i Device File Naming Convention

graphics/05fig07.gif

There are a number of commands you can use as you go about creating device files. The ioscan command is the first of these. Some of the examples in this section were used in Chapter 3, when building a kernel was covered. The following is an ioscan output of the same Series 700 for which sysdef was run when describing how a kernel is created in Chapter 4. (Using -f with ioscan would have created a full listing; you should try it with and without -f.) I included four ioscan outputs so that you could see examples from a variety of different systems. The last listing is from a large V-Class system used in some of the examples in Chapter 9, where disks and filesystems are covered.

(on Series 700)

 $ /usr/sbin/ioscan  H/W Path     Class             Description  ============================================================               bc  1            graphics          Graphics  2            ba  2/0          unknown  2/0/1           ext_bus        Built-in SCSI  2/0/1.1            target  2/0/1.1.0            disk      HP      C2247  2/0/1.2            target  2/0/1.2.0            disk      TOSHIBA CD-ROM XM-3301TA  2/0/1.6            target  2/0/1.6.0            disk      HP      C2247  2/0/2           lan            Built-in LAN  2/0/4           tty            Built-in RS-232C  2/0/6           ext_bus        Built-in Parallel Interface  2/0/8           audio          Built-in Audio  2/0/10          pc             Built-in Floppy Drive  2/0/10.1           floppy      HP_PC_FDC_FLOPPY  2/0/11          ps2            Built-in Keyboard  8            processor         Processor  9            memory            Memory 

The following is an ioscan output from a Series 800 system. Note the four processors shown in this output.

(on Series 800)

 $ /usr/sbin/ioscan  H/W Path     Class             Description  ============================================================               bc  8            bc                I/O Adapter  10           bc                I/O Adapter  10/0            ext_bus        GSC built-in Fast/Wide SCSI  10/0.3             target  10/0.3.0              disk     HP      C2490WD  10/0.4             target  10/0.4.0              disk     HP      C2490WD  10/0.5             target  10/0.5.0              disk     HP      C2490WD  10/0.6             target  10/0.6.0              disk     HP      C2490WD  10/4         bc                Bus Converter  10/4/0             tty         MUX  10/12        ba                Core I/O Adapter  10/12/0         ext_bus        Built-in Parallel Interface  10/12/5         ext_bus        Built-in SCSI  10/12/5.0          target  10/12/5.0.0           tape     HP       HP35480A  10/12/5.2          target  10/12/5.2.0           disk     TOSHIBA CD-ROM XM-4101TA  10/12/6         lan            Built-in LAN  10//12/7        ps2            Built-in Keyboard/Mouse  32          processor          Processor  34          processor          Processor  36          processor          Processor  38          processor          Processor  49          memory             Memory 

And last is an ioscan output from a V-Class server. Note the eight processors shown in this output.

(on V-Class)

 $ /usr/sbin/ioscan  H/W Path   Class                  Description  =============================================             bc  0          ba                     PCI Bus Bridge - epic  0/0/0             lan             PCI(10110019)  0/1/0             unknown         PCI(107e0008)  2          ba                     PCI Bus Bridge - epic  2/0/0             ext_bus         Ultra Wide SCSI  2/0/0.5              target  2/0/0.5.0             disk        SEAGATE ST34371W  2/0/0.6              target  2/0/0.6.0             disk        SEAGATE ST34371W  2/0/0.7              target  2/0/0.7.0               ctl       Initiator  2/1/0             lan             PCI(10110019)  4          ba                     PCI Bus Bridge - epic  4/1/0              fc             HP Fibre Channel Mass                                      Storage Adapter  4/1/0.5         lan               HP Fibre Channel Mass                                      Storage Cntl  4/1/0.8              fcp          FCP Protocol Adapter  4/2/0             ext_bus         Ultra Wide SCSI  4/2/0.0              target  4/2/0.0.0               disk      TOSHIBA CD-ROM XM-5701TA  4/2/0.1              target  4/2/0.1.0               tape      HP C1537A  4/2/0.7              target  4/2/0.7.0               ctl       Initiator  6          ba                     PCI Bus Bridge - epic  8          memory  15         ba                     Core I/O Adapter  15/1           tty                Built-in Serial Port DUART  15/2           tty                Built-in Serial Port DUART  15/3           unknown   Unknown  17         processor     Processor  19         processor     Processor  20         processor     Processor  22         processor     Processor  25         processor     Processor  27         processor     Processor  28         processor     Processor  30         processor     Processor 

The following is a full ioscan output from a V-Class server. This server has a large disk unit attached to it (XP 256), which resulted in a very long output that I had to abbreviate in the place where the three dots are shown.

(on V-Class)

 # ioscan -f  Class       I H/W   Path             Driver      S/W State   H/W Type     Description  =====================================================================================  bc          0                        root        CLAIMED     BUS_NEXUS  ba          0 0                      saga        CLAIMED     BUS_NEXUS    saga Bridge  lan        0 0/0/0                btlan6      CLAIMED    INTERFACE    PCI Ethernet (10110019)  ba          1  1                    saga       CLAIMED     BUS_NEXUS    saga Bridge  ext_bus     0  1/0/0               c720       CLAIMED     INTERFACE    Ultra2 Wide LVD SCSI  target      0  1/0/0.4              tgt        CLAIMED     DEVICE  disk        0  1/0/0.4.0            sdisk      CLAIMED     DEVICE       SEAGATE ST318275LW  target      1  1/0/0.5              tgt        CLAIMED     DEVICE  disk        1  1/0/0.5.0            sdisk      CLAIMED     DEVICE       SEAGATE ST318275LW  target      2  1/0/0.6              tgt        CLAIMED     DEVICE  disk        2  1/0/0.6.0            sdisk      CLAIMED     DEVICE       SEAGATE ST318275LW  target      3  1/0/0.7              tgt        CLAIMED     DEVICE  ctl         0  1/0/0.7.0            sctl       CLAIMED     DEVICE       Initiator  target      4  1/0/0.8              tgt        CLAIMED     DEVICE  disk        3  1/0/0.8.0            sdisk      CLAIMED     DEVICE       SEAGATE ST318275LW  ext_bus     1  1/1/0               c720       CLAIMED     INTERFACE    Ultra2 Wide LVD SCSI  target      5  1/1/0.7              tgt        CLAIMED     DEVICE  ctl         1  1/1/0.7.0            sctl       CLAIMED     DEVICE      Initiator  target      6  1/1/0.9              tgt        CLAIMED     DEVICE  disk        4  1/1/0.9.0            sdisk      CLAIMED     DEVICE      SEAGATE ST318275LW  target      7  1/1/0.10             tgt        CLAIMED     DEVICE  disk        5  1/1/0.10.0           sdisk      CLAIMED     DEVICE      SEAGATE ST318275LW  target      8  1/1/0.11             tgt        CLAIMED     DEVICE  disk        6  1/1/0.11.0           sdisk      CLAIMED     DEVICE      SEAGATE ST318275LW  target      9  1/1/0.12             tgt        CLAIMED     DEVICE  disk        7  1/1/0.12.0           sdisk      CLAIMED     DEVICE      SEAGATE ST318275LW  ba          2  2                    saga        CLAIMED     BUS_NEXUS    saga Bridge  fc         0  2/0/0               td         CLAIMED    INTERFACE    HP Tachyon TL/TS Fibre  Channel Mass Storage Adapter  fcp         0  2/0/0.8             fcp         CLAIMED     INTERFACE    FCP Protocol Adapter  ext_bus     7  2/0/0.8.0.0.0        fcparray    CLAIMED     INTERFACE    FCP Array Interface  target     12  2/0/0.8.0.0.0.0      tgt         CLAIMED     DEVICE  disk        9  2/0/0.8.0.0.0.0.0    sdisk       CLAIMED     DEVICE       HP      OPEN-8  disk       77  2/0/0.8.0.0.0.0.1    sdisk       CLAIMED     DEVICE       HP      OPEN-8  disk       78  2/0/0.8.0.0.0.0.2    sdisk       CLAIMED     DEVICE       HP      OPEN-8  disk      105  2/0/0.8.0.0.0.0.3    sdisk       CLAIMED     DEVICE       HP      OPEN-8  disk      106  2/0/0.8.0.0.0.0.4    sdisk       CLAIMED     DEVICE       HP      OPEN-8  disk       10  2/0/0.8.0.0.0.0.5    sdisk       CLAIMED     DEVICE       HP      OPEN-8  disk      107  2/0/0.8.0.0.0.0.6    sdisk       CLAIMED     DEVICE       HP      OPEN-8  disk      108  2/0/0.8.0.0.0.0.7    sdisk       CLAIMED     DEVICE       HP      OPEN-8  target     13  2/0/0.8.0.0.0.1      tgt         CLAIMED     DEVICE  disk       11  2/0/0.8.0.0.0.1.0    sdisk       CLAIMED     DEVICE       HP      OPEN-8  disk      109  2/0/0.8.0.0.0.1.1    sdisk       CLAIMED     DEVICE       HP      OPEN-8  disk      110  2/0/0.8.0.0.0.1.2    sdisk       CLAIMED     DEVICE       HP      OPEN-8  disk      111  2/0/0.8.0.0.0.1.3    sdisk       CLAIMED     DEVICE       HP      OPEN-8  disk      112  2/0/0.8.0.0.0.1.4    sdisk       CLAIMED     DEVICE       HP      OPEN-8  disk      113  2/0/0.8.0.0.0.1.5    sdisk       CLAIMED     DEVICE       HP      OPEN-8  disk      114  2/0/0.8.0.0.0.1.6    sdisk       CLAIMED     DEVICE       HP      OPEN-8  disk      176  2/0/0.8.0.0.0.1.7    sdisk       CLAIMED     DEVICE       HP      OPEN-8  target     14  2/0/0.8.0.0.0.2      tgt         CLAIMED     DEVICE  disk       12  2/0/0.8.0.0.0.2.0    sdisk       CLAIMED     DEVICE       HP      OPEN-8  disk      177  2/0/0.8.0.0.0.2.1    sdisk       CLAIMED     DEVICE       HP      OPEN-8  target     15  2/0/0.8.0.0.0.3      tgt         CLAIMED     DEVICE  disk      13  2/0/0.8.0.0.0.3.0    sdisk      CLAIMED     DEVICE      HP     DISK-SUBSYSTEM  target     16  2/0/0.8.0.0.0.4      tgt         CLAIMED     DEVICE  disk      14  2/0/0.8.0.0.0.4.0    sdisk      CLAIMED     DEVICE      HP     DISK-SUBSYSTEM  target     17  2/0/0.8.0.0.0.5      tgt         CLAIMED     DEVICE  disk      15  2/0/0.8.0.0.0.5.0    sdisk      CLAIMED     DEVICE      HP     DISK-SUBSYSTEM  target     18  2/0/0.8.0.0.0.6      tgt         CLAIMED     DEVICE  disk      16  2/0/0.8.0.0.0.6.0    sdisk      CLAIMED     DEVICE      HP     DISK-SUBSYSTEM  target     19  2/0/0.8.0.0.0.7      tgt         CLAIMED     DEVICE  disk      17  2/0/0.8.0.0.0.7.0    sdisk      CLAIMED     DEVICE      HP     DISK-SUBSYSTEM  target     20  2/0/0.8.0.0.0.8      tgt         CLAIMED     DEVICE  disk       18  2/0/0.8.0.0.0.8.0    sdisk       CLAIMED     DEVICE    HP     OPEN-8  disk       79  2/0/0.8.0.0.0.8.1    sdisk       CLAIMED     DEVICE    HP     OPEN-8  disk       80  2/0/0.8.0.0.0.8.2    sdisk       CLAIMED     DEVICE    HP     OPEN-8  disk      115  2/0/0.8.0.0.0.8.3    sdisk       CLAIMED     DEVICE    HP     OPEN-8  disk      116  2/0/0.8.0.0.0.8.4    sdisk       CLAIMED     DEVICE    HP     OPEN-8  disk      117  2/0/0.8.0.0.0.8.5    sdisk       CLAIMED     DEVICE    HP     OPEN-8  disk      118  2/0/0.8.0.0.0.8.6    sdisk       CLAIMED     DEVICE    HP     OPEN-8  disk      119  2/0/0.8.0.0.0.8.7    sdisk       CLAIMED     DEVICE    HP     OPEN-8  target     21  2/0/0.8.0.0.0.9      tgt         CLAIMED     DEVICE  disk       19  2/0/0.8.0.0.0.9.0    sdisk       CLAIMED     DEVICE    HP     OPEN-8  disk      120  2/0/0.8.0.0.0.9.1    sdisk       CLAIMED     DEVICE    HP     OPEN-8  disk      121  2/0/0.8.0.0.0.9.2    sdisk       CLAIMED     DEVICE    HP     OPEN-8  disk      122  2/0/0.8.0.0.0.9.3    sdisk       CLAIMED     DEVICE    HP     OPEN-8  disk      123  2/0/0.8.0.0.0.9.4    sdisk       CLAIMED     DEVICE    HP     OPEN-8  disk      124  2/0/0.8.0.0.0.9.5    sdisk       CLAIMED     DEVICE    HP     OPEN-8 
 disk      125  2/0/0.8.0.0.0.9.6    sdisk       CLAIMED     DEVICE       HP      OPEN-8  disk      178  2/0/0.8.0.0.0.9.7    sdisk       CLAIMED     DEVICE       HP      OPEN-8  target     22  2/0/0.8.0.0.0.10     tgt         CLAIMED     DEVICE  disk       20  2/0/0.8.0.0.0.10.0   sdisk       CLAIMED     DEVICE       HP      OPEN-8  disk      179  2/0/0.8.0.0.0.10.1   sdisk       CLAIMED     DEVICE       HP      OPEN-8  target     23  2/0/0.8.0.0.0.11     tgt         CLAIMED     DEVICE  disk      21  2/0/0.8.0.0.0.11.0   sdisk      CLAIMED     DEVICE      HP     DISK-SUBSYSTEM  target     24  2/0/0.8.0.0.0.12     tgt         CLAIMED     DEVICE  disk      22  2/0/0.8.0.0.0.12.0   sdisk      CLAIMED     DEVICE      HP     DISK-SUBSYSTEM  target     25  2/0/0.8.0.0.0.13     tgt         CLAIMED     DEVICE  disk      23  2/0/0.8.0.0.0.13.0   sdisk      CLAIMED     DEVICE      HP     DISK-SUBSYSTEM  target     26  2/0/0.8.0.0.0.14     tgt         CLAIMED     DEVICE  disk      24  2/0/0.8.0.0.0.14.0   sdisk      CLAIMED     DEVICE      HP     DISK-SUBSYSTEM                                                                                   memory      0  8                    memory      CLAIMED     MEMORY       Memory  ba          8  15                   bus_adapter CLAIMED     BUS_NEXUS    Core I/O Adapter  tty       0  15/1              consp1     CLAIMED     INTERFACE   Built-in Serial Port DUART  tty       1  15/2              consp1     CLAIMED     INTERFACE   Built-in Serial Port DUART  unknown    -1  15/3                             UNCLAIMED   UNKNOWN      Built-in Ethernet  processor   0  16                   processor   CLAIMED     PROCESSOR    Processor  processor   1  18                   processor   CLAIMED     PROCESSOR    Processor  processor   2  21                   processor   CLAIMED     PROCESSOR    Processor  processor   3  23                   processor   CLAIMED     PROCESSOR    Processor  processor   4  24                   processor   CLAIMED     PROCESSOR    Processor  processor   5  26                   processor   CLAIMED     PROCESSOR    Processor  processor   6  29                   processor   CLAIMED     PROCESSOR    Processor  processor   7  32                   processor   CLAIMED     PROCESSOR    Processor  processor   8  34                   processor   CLAIMED     PROCESSOR    Processor  processor   9  37                   processor   CLAIMED     PROCESSOR    Processor  processor  10  39                   processor   CLAIMED     PROCESSOR    Processor  processor  11  40                   processor   CLAIMED     PROCESSOR    Processor  processor  12  42                   processor   CLAIMED     PROCESSOR    Processor  processor  13  45                   processor   CLAIMED     PROCESSOR    Processor 

The next command that helps you when creating device files is lsdev. lsdev lists the drivers configured into your system. When adding a device file, you need to have the driver for the device configured into the system. If it is not configured into the system, you can use SAM to configure it, or you can use the manual kernel configuration process covered earlier. There are columns for the major number for a character device and block device, the driver name, and the class of the driver. The major number, character device, and other parameters are defined later. The following is an example of running lsdev on the same Series 700 on which ioscan was run:

(on Series 700)

 $ /usr/sbin/lsdev  Character     Block     Driver     Class      0          -1       cn         pseudo      1          -1       ansio0     tty      3          -1       mm         pseudo     16          -1       ptym       ptym     17          -1       ptys       ptys     24          -1       hil        hil     27          -1       dmem       pseudo     46          -1       netdiag1   unknown     52          -1       lan2       lan     64          64       lv         lvm     66          -1       audio      audio     69          -1       dev_config pseudo     72          -1       clone      pseudo     73          -1       strlog     pseudo     74          -1       sad        pseudo     75          -1       telm       strtelm     76          -1       tels       strtels     77          -1       tlctls     pseudo     78          -1       tlcots     pseudo     79          -1       tlcotsod   pseudo    114          -1       ip         pseudo    115          -1       arp        pseudo    116          -1       echo       pseudo    119          -1       dlpi       pseudo    130          -1       rawip      pseudo    136          -1       tcp        pseudo    137          -1       udp        pseudo    138          -1       stcpmap    pseudo    139          -1       nuls       pseudo    140          -1       netqa      pseudo    141          -1       tun        pseudo    142          -1       btlan3     unknown    143          -1       fddi3      unknown    144          -1       fddi0      unknown    145          -1       fcT1_cntl  unknown    156          -1       ptm        strptym    157          -1       ptm        strptys    159          -1       ps2        ps2    164          -1       pipedev    unknown    168          -1       beep       graf_pseudo    169          -1       fcgsc_lan  lan    170          -1       lpr0       unknown    174          -1       framebuf   graf_pseudo    183          -1       diag1      diag    188          31       sdisk      disk    189          -1       klog       pseudo    196          -1       eeprom     da    203          -1       sctl       ctl    205          -1       stape      tape    207          -1       sy         pseudo    216          -1       CentIF     ext_bus    227          -1       kepd       pseudo    229          -1       ite        graf_pseudo    232          -1       diag2      diag 

Next is an example of running lsdev on the same Series 800 on which ioscan was run:

(on Series 800)

 $ /usr/sbin/lsdev  Character     Block     Driver     Class      0          -1       cn         pseudo      1          -1       asio0      tty      3          -1       mm         pseudo     16          -1       ptym       ptym     17          -1       ptys       ptys     28          -1       diag0      diag     46          -1       netdiag1   unknown     52          -1       lan2       lan     64          64       lv         lvm     69          -1       dev_config pseudo     72          -1       clone      pseudo     73          -1       strlog     pseudo     74          -1       sad        pseudo     75          -1       telm       strtelm     76          -1       tels       strtels     77          -1       tlctls     pseudo     78          -1       tlcots     pseudo     79          -1       tlcotsod   pseudo    114          -1       ip         pseudo    116          -1       echo       pseudo    119          -1       dlpi       pseudo    130          -1       rawip      pseudo    136          -1       lpr0       unknown    137          -1       udp        pseudo    138          -1       stcpmap    pseudo    139          -1       nuls       pseudo    140          -1       netqa      pseudo    141          -1       tun        pseuod    142          -1       btlan3     unknown    143          -1       fddi3      unknown    144          -1       fddi0      unknown    156          -1       ptm        strptym    157          -1       ptm        strptys    159          -1       ps2        ps2    164          -1       pipedev    unknown    168          -1       beep       graf_pseudo    174          -1       framebuf   graf_pseudo    188          31       sdisk      disk    189          -1       klog       pseudo    193          -1       mux2       tty    203          -1       sctl       ctl    205          -1       stape      tape    207          -1       sy         pseudo    216          -1       CentIF     ext_bus    227          -1       kepd       pseudo    229          -1       ite        graf_pseudo 

And last, here is an example of running lsdev on the same V-class server on which the first ioscan was run:

(on V-Class)

 $ /usr/sbin/lsdev      Character    Block    Driver          Class          0          -1     cn              pseudo          3          -1     mm              pseudo         16          -1     ptym            ptym         17          -1     ptys            ptys         27          -1     dmem            pseudo         28          -1     diag0           diag         46          -1     netdiag1        unknown         64          64     lv              lvm         69          -1     dev_config      pseudo         72          -1     clone           pseudo         73          -1     strlog          pseudo         74          -1     sad             pseudo         75          -1     telm            strtelm         76          -1     tels            strtels         77          -1     tlclts          pseudo         78          -1     tlcots          pseudo         79          -1     tlcotsod        pseudo        114          -1     ip              pseudo        115          -1     arp             pseudo        116          -1     echo            pseudo        119          -1     dlpi            pseudo        130          -1     rawip           pseudo        136          -1     tcp             pseudo        137          -1     udp             pseudo        138          -1     stcpmap         pseudo        139          -1     nuls            pseudo        140          -1     netqa           pseudo        141          -1     tun             pseudo        142          -1     fddi4           unknown        143          -1     fcT1_cntl       lan        144          -1     fcgsc_lan       lan        145          -1     lpr0            unknown        156          -1     ptm             strptym        157          -1     pts             strptys        164          -1     pipedev         unknown        169          -1     consp1          tty        170          -1     btlan6          lan        171          -1     fcp             fcp        188          31     sdisk           disk        189          -1     klog            pseudo        203          -1     sctl            ctl        205          -1     stape           tape        207          -1     sy              pseudo        227          -1     kepd            pseudo        232          -1     diag2           diag 

From these three lsdev outputs, you can observe some minor differences in the devices. The Series 700, for instance, has such classes as audio and floppy, the Series 800 has a multiplexer, and the V-Class has a BaseTen network card.

You can use ioscan to show the device files for a particular peripheral. Going back to the Series 800 that had four disks and a CD-ROM attached to it, you could issue the following ioscan command to see the device files associated with disk:

(on Series 800)

 $ /usr/sbin/ioscan -fn -C disk  Class I H/W Path   Driver  S/W State  H/W Type   Description  ============================================================  disk  0 10/0.3.0    sdisk   CLAIMED    DEVICE     HP C2490WD                      /dev/dsk/c0t3d0   /dev/rdsk/c0t3d0  disk  1 10/0.4.0    sdisk   CLAIMED    DEVICE     HP C2490WD                      /dev/dsk/c0t4d0   /dev/rdsk/c0t4d0  disk  2 10/0.5.0    sdisk   CLAIMED    DEVICE     HP C2490WD                      /dev/dsk/c0t5d0   /dev/rdsk/c0t5d0  disk  3 10/0.6.0    sdisk   CLAIMED    DEVICE     HP C2490WD                      /dev/dsk/c0t6d0   /dev/rdsk/c0t6d0  disk  3 10/12/5/2/0 sdisk   CLAIMED    DEVICE CD-ROM                      /dev/dsk/c1t2d0   /dev/rdsk/c1t2d0 

You can see from this ioscan all of the device files associated with disk, including the CD-ROM.

You could find out more information about one of these devices with the diskinfo command. Specify the character device you want to know more about, as shown below (using the -v option for verbose provides more detailed information).

 $ diskinfo /dev/rdsk/c0t5d0  SCSI describe of /dev/rdsk/c0t5d0               vendor: HP           product id: C2490WD                 type: direct   access                 size: 2082636  bytes     bytes per sector: 512 

       
    Top
     



    HP-UX Virtual Partitions
    HP-UX Virtual Partitions
    ISBN: 0130352128
    EAN: 2147483647
    Year: 2002
    Pages: 181

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