Role of Device Special File in HP-UX

Device Special File Overview

UNIX applications access peripheral devices such as tape drives, disk drives, printers,

terminals, and modems via special files in the /dev directory called Device Special Files

(DSFs). Every peripheral device typically has one or more DSFs.

DSF Attributes

DSF file attributes determine which device a DSF accesses, and how

  • Type: Access the device in block or character mode?
  • Permissions: Who can access the device?
  • Major#: Which kernel driver does the DSF use?
  • Minor#: Which device does the DSF use? And how?
  • Name: What is the DSF name?

Use ll to view a device file’s attributes

# ll /dev/*disk/disk*

brw-r—– 1 bin sys 3 0x000004 Jun 23 00:34 /dev/disk/disk30

brw-r—– 1 bin sys 3 0x000005 Jun 23 00:34 /dev/disk/disk31

crw-r—– 1 bin sys 22 0x000004 Jun 23 00:34 /dev/rdisk/disk30

crw-r—– 1 bin sys 22 0x000005 Jun 23 00:34 /dev/rdisk/disk31

The lsdev command lists the drivers configured in the kernel, and their associated major

numbers.

 

# lsdev

Character Block Driver Class

22 3 esdisk disk

23 -1 estape tape

DSF Types: Legacy vs. Persistent

  • 11i v1 and v2 only support “legacy” DSFs
  • 11i v3 still supports legacy device files, but introduces new “persistent” DSFs

DSF Directories

DSFs are stored in a directory structure under /dev

Persistent DSFs- /dev/disk, /dev/rdisk, /dev/rtape, /dev/rchgr

Legacy DSF- /dev/dsk, /dev/rdsk, /dev/rmt, /dev/rac

Legacy DSF Names

Legacy DSF names are based on a device path’s controller instance, target, and LUN

# ioscan –kf

Class I H/W Path Description

=====================================================

ext_bus 5 1/0/2/1/0.6.1.0.0 FCP Array Interface

disk 3 1/0/2/1/0.6.1.0.0.0.1 HP HSV101  1st path

ext_bus 7 1/0/2/1/0.6.2.0.0 FCP Array Interface

disk 6 1/0/2/1/0.6.2.0.0.0.1 HP HSV101  2nd path

ext_bus 9 1/0/2/1/1.1.2.0.0 FCP Array Interface

disk 9 1/0/2/1/1.1.2.0.0.0.1 HP HSV101  3rd path

ext_bus 11 1/0/2/1/1.1.3.0.0 FCP Array Interface

disk 12 1/0/2/1/1.1.3.0.0.0.1 HP HSV101  4th path

/dev/dsk/c11t0d1options

 

Persistent DSF Names

# ioscan –kfNn

Class I H/W Path Driver S/W State H/W Type Description

=================================================================

disk 30 64000/0xfa00/0x4 esdisk CLAIMED DEVICE HP HSV101

/dev/disk/disk30options

LUN, Disk, and DVD DSF Names

Legacy DSFs(Blcok DSF)

/dev/dsk/c5t0d1

/dev/dsk/c7t0d1

/dev/dsk/c9t0d1

/dev/dsk/c11t0d1

Legacy DSFs(RAW DSF)

/dev/rdsk/c5t0d1

/dev/rdsk/c7t0d1

/dev/rdsk/c9t0d1

/dev/rdsk/c11t0d1

Persistent DSF(Block DSF)

/dev/disk/disk30

Persistent DSF(RAW DSF)

/dev/rdisk/disk30

 

Boot Disk DSF Names

Integrity boot disks are subdivided into three “EFI” disk partitions

  • Each EFI partition requires block and raw DSFs

− Legacy DSFs identify EFI partitions via suffixes s1, s2, s3

− Persistent DSFs identify EFI partitions via suffixes p1, p2, p3

  • Though not shown below, boot disks may be multi-pathed, too

Execute the lvlnboot –v command to determine your boot disk device file

# lvlnboot –v

Boot Definitions for Volume Group /dev/vg00:

Physical Volumes belonging in Root Volume Group:

/dev/disk/diska_p2 — Boot Disk

Boot: lvol1 on: /dev/disk/diska_p2

Root: lvol3 on: /dev/disk/diska_p2

Swap: lvol2 on: /dev/disk/diska_p2

Dump: lvol2 on: /dev/disk/diska_p2, 0

Legacy Block DSF for boot partition

dev/dsk/c0t1d0

/dev/dsk/c0t1d0s1

/dev/dsk/c0t1d0s2

/dev/dsk/c0t1d0s3

Legacy RAW DSF for boot partition

/dev/rdsk/c0t1d0

/dev/rdsk/c0t1d0s1

/dev/rdsk/c0t1d0s2

/dev/rdsk/c0t1d0s3

Persistent Block DSF for boot partition

/dev/disk/disk27

/dev/disk/disk27_p1

/dev/disk/disk27_p2

/dev/disk/disk27_p3

Persistent RAW DSF for boot partition

/dev/rdisk/disk27

/dev/rdisk/disk27_p1

/dev/rdisk/disk27_p2

/dev/rdisk/disk27_p3

 

Tape Drive DSF Names

Feature                                                                        Legacy DSF in /dev/rmt                              Persistent DSF /dev/rtape
Best density, autorewind, AT&T style                     c0t0d0BEST + 0m                                       tape0_BEST
Best density, no autorewind, AT&T style                c0t0d0BESTn + 0mn                                 tape0_BESTn
Best density, autorewind, Berkeley style                c0t0d0BESTb + 0mb                                tape0_BESTb
Best density, no autorewind, Berkeley style           c0t0d0BESTnb + 0mnb                          tape0_BESTnb

 

Listing Legacy DSFs

# ioscan –kfn list all devices and their legacy DSFs

# ioscan -kfnC disk list all disk class devices and their legacy DSFs

# ioscan -kfnC tape list all tape class drives and their legacy DSFs

# ioscan –kfnH 0/0/1/0/0.0.0 list a specific device/path and its legacy DSFs

# ioscan –kfn /dev/rmt/0m list a specific device/path and its legacy DSFs

 

Listing Persistent DSFs

# ioscan –kfnN list all devices and their persistent DSFs

# ioscan -kfnNC disk list all disk class devices and their persistent DSFs

# ioscan -kfnNC tape list all tape class drives and their persistent DSFs

# ioscan –kfnNH 64000/0xfa00/0x0 list a specific device and its persistent DSFs

# ioscan –kfnN /dev/rtape/tape0 list a specific device and its persistent DSFs

Correlating Persistent DSFs with LUNs and lunpaths

# ioscan –m lun

Class I H/W Path Driver SW State H/W Type Health Description

====================================================================

disk 30 64000/0xfa00/0x4 esdisk CLAIMED DEVICE online HP HSV101

1/0/2/1/0.0x50001fe15003112c.0x4001000000000000

1/0/2/1/0.0x50001fe150031128.0x4001000000000000

1/0/2/1/1.0x50001fe15003112d.0x4001000000000000

1/0/2/1/1.0x50001fe150031129.0x4001000000000000

/dev/disk/disk30 /dev/rdisk/disk30

# ioscan –m lun -H 64000/0xfa00/0x4

Class I H/W Path Driver SW State H/W Type Health Description

====================================================================

disk 30 64000/0xfa00/0x4 esdisk CLAIMED DEVICE online HP HSV101

1/0/2/1/0.0x50001fe15003112c.0x4001000000000000

1/0/2/1/0.0x50001fe150031128.0x4001000000000000

1/0/2/1/1.0x50001fe15003112d.0x4001000000000000

1/0/2/1/1.0x50001fe150031129.0x4001000000000000

/dev/disk/disk30 /dev/rdisk/disk30

 

# ioscan –m lun –D /dev/disk/disk30

Class I H/W Path Driver SW State H/W Type Health Description

====================================================================

disk 30 64000/0xfa00/0x4 esdisk CLAIMED DEVICE online HP HSV101

1/0/2/1/0.0x50001fe15003112c.0x4001000000000000

1/0/2/1/0.0x50001fe150031128.0x4001000000000000

1/0/2/1/1.0x50001fe15003112d.0x4001000000000000

1/0/2/1/1.0x50001fe150031129.0x4001000000000000

/dev/disk/disk30 /dev/rdisk/disk30

 

Correlating Persistent DSFs with WWIDs:

View the WWID for all LUNs, or a specific LUN hardware path or DSF

# scsimgr get_attr -a wwid all_lun

SCSI ATTRIBUTES FOR LUN : /dev/rdisk/disk30

name = wwid

current = 0x600508b400012fd20000a00000250000

default =

saved =

SCSI ATTRIBUTES FOR LUN : /dev/rdisk/disk31

name = wwid

current = 0x600508b400012fd20000900001900000

default =

# scsimgr get_attr -a wwid -H 64000/0xfa00/0x4

SCSI ATTRIBUTES FOR LUN : /dev/rdisk/disk30

name = wwid

current = 0x600508b400012fd20000a00000250000

default =

saved =

# scsimgr get_attr -a wwid -D /dev/rdisk/disk30

SCSI ATTRIBUTES FOR LUN : /dev/rdisk/disk30

name = wwid

current = 0x600508b400012fd20000a00000250000

default =

saved =

Recall that you can also use the scsimgr command to obtain a LUN’s LUNID.

# ioscan –m lun –D /dev/disk/disk30

Class I H/W Path Driver SW State H/W Type Health Description

====================================================================

disk 22 64000/0xfa00/0x4 esdisk CLAIMED DEVICE online HP HSV101

1/0/2/1/0.0x50001fe15003112c.0x4001000000000000

1/0/2/1/0.0x50001fe150031128.0x4001000000000000

1/0/2/1/1.0x50001fe15003112d.0x4001000000000000

1/0/2/1/1.0x50001fe150031129.0x4001000000000000

/dev/disk/disk30 /dev/rdisk/disk30

# scsimgr get_attr \

-a lunid \

-H 1/0/2/1/0.0x50001fe15003112c.0x4001000000000000

name = lunid

current =0x4001000000000000 (LUN # 1, Flat Space Addressing)

default =

saved =

 

Correlating Persistent DSFs with Legacy DSFs:

Map all persistent DSFs to corresponding legacy DSFs

# ioscan –m dsf

Map a specific legacy DSF to an associated persistent DSF

# ioscan -m dsf /dev/dsk/c5t0d1

Persistent DSF Legacy DSF(s)

========================================

/dev/disk/disk30 /dev/dsk/c5t0d1

 

Map a specific persistent DSF to associated legacy DSFs:

# ioscan -m dsf /dev/disk/disk30

Persistent DSF Legacy DSF(s)

========================================

/dev/disk/disk30 /dev/dsk/c5t0d1

/dev/dsk/c7t0d1

/dev/dsk/c9t0d1

/dev/dsk/c11t0d1

 

Decoding Persistent and Legacy DSF Attributes:

Decode a legacy DSF’s major and minor numbers

# lssf /dev/rmt/c0t0d0BESTnb

stape card instance 0 SCSI target 0 SCSI LUN 0

Berkeley No-Rewind BEST density

at address 0/0/1/0/0.0.0 /dev/rmt/c0t0d0BESTnb

 

Decode a persistent DSF’s major and minor numbers:

# lssf /dev/rtape/tape0_BESTnb

estape Berkeley No-Rewind BEST density

at address 64000/0xfa00/0x0 /dev/rtape/tape0_BESTnb

 

Managing Device Files

  • HP-UX automatically creates DSFs for most devices during system startup
  • HP-UX 11i v3 automatically creates persistent DSFs for dynamically added LUNs, too
  • HP-UX also provides tools for manually creating and managing device files
  • insf Create default DSFs for auto-configurable devices
  • mksf Create non-default DSFs for auto-configurable devices
  • mknod Create custom DSFs for non-auto-configurable devices
  • rmsf Remove devices and DSFs

Creating DSFs via insf

Scan for new hardware

# ioscan

Create DSFs for newly added devices

# insf –v

insf: Installing special files for stape instance 0 address 0/1/1/1.4.0

insf: Installing special files for estape instance 1 address

64000/0xfa00/0x0

making rtape/tape1_BEST c 23 0x000009

making rtape/tape1_BESTn c 23 0x00000b

making rtape/tape1_BESTb c 23 0x00000c

making rtape/tape1_BESTnb c 23 0x00000d

 

Create DSFs for new devices and re-create missing DSFs for existing devices

# insf –v –e

insf: Installing special files for stape instance 0 address 0/1/1/1.4.0

insf: Installing special files for estape instance 1 address

64000/0xfa00/0x9

making rtape/tape1_BEST c 23 0x000009

making rtape/tape1_BESTn c 23 0x00000b

making rtape/tape1_BESTb c 23 0x00000c

making rtape/tape1_BESTnb c 23 0x00000d

(creates DSFs for all other devices, too)

 

Create or recreate DSFs for a specific hardware path or class

# insf –v –e -H 64000/0xfa00/0x0

insf: Installing special files for estape instance 1 address

64000/0xfa00/0x0

making rtape/tape1_BEST c 23 0x000009

making rtape/tape1_BESTn c 23 0x00000b

making rtape/tape1_BESTb c 23 0x00000c

making rtape/tape1_BESTnb c 23 0x00000d

 

# insf –v –e –C estape

insf: Installing special files for stape instance 0 address 0/1/1/1.4.0

insf: Installing special files for estape instance 1 address

64000/0xfa00/0x0

making rtape/tape1_BEST c 23 0x000009

making rtape/tape1_BESTn c 23 0x00000b

making rtape/tape1_BESTb c 23 0x00000c

making rtape/tape1_BESTnb c 23 0x00000d

 

Creating DSFs via mksf:

Use mksf to configure device files for other unusual combinations of options;

Configure a DDS2, no-rewind DSF for the tape drive at 64000/0xfa00/0x0 :

# mksf –v –H 64000/0xfa00/0x0 –b DDS2 –n

Creating DSFs via mknod

Device File Name Block/Character Major# Minor#

  • If a device isn’t configurable via insf or mksf,

manually create DSFs with custom major/minor numbers using mknod

  • mknod must be used to create LVM volume group DSFs,

and may be necessary to create DSFs for other vendors’ devices

# mknod /dev/vg01/group c 64 0x010000

Removing DSFs via rmsf

List DSFs associated with non-existent “stale” devices (11i v3 only)

# lssf -s

Remove DSFs associated with non-existent “stale” devices (11i v3 only)

# rmsf –v –x

Remove a specific DSF

# rmsf –v /dev/disk/disk1

Remove all of the device files associated with a device, and the device definition

# rmsf –v -a /dev/disk/disk1

Or … specify the device’s hardware path

# rmsf –v –H 64000/0xfa00/0x1

Disabling and Enabling Legacy Mode DSFs

Determine whether legacy mode is currently enabled

# insf -v -L

Disable legacy mode and remove legacy mode DSFs

# rmsf –v –L

Re-enable legacy mode and recreate legacy DSFs

# insf –L

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s