Thursday, August 5, 2010

Device Management

All the devices are communicated by HP-UX using their device files which are located under /dev directory. Basically each device will have 2 type of device file - block and character(raw) device files. Most of the devices and their device files are configured automatically during the system boot. At the time of boot, HP-UX probes  all devices and executes /sbin/ioinit.rc script to create new device files if needed. If any device file is not created you can always create them manually using some commands.

How to list and identify various devices connected to your system ?

1. To show all the configured devices:
# ioscan -f

2. To list the available disk/CD Drives along with their device file details:
# ioscan -funC disk

3. To list the tape drives:
# ioscan -funC tape

4. To list the lan adapters:
# ioscan -funC lan

5. To show the details of a device file:
# lssf /dev/rmt/c2t0d0BEST

How to configure newly connected devices ?

To configured the recently connected tape drive:

# insf -C tape

Same way to configure newly connected CDrom or disk,
# insf -C disk


This is similar to devfsadm in solaris and cfgmgr in AIX. It will configure new devices but not the already configured devices.

How to create specific device file if you have accidentally deleted any of them ?

1. To create the device file for a CD-ROM which is attached to hardware path 0.2.0 :
# insf -H 0.2.0 -e

2. To create a raw (character) device file for a disk attached to hardware address 1.2.0 :
# mksf -H 1.2.0 -r

3. To create a block device file for a disk attached to hardware addres 1.2.0 :
# mksf -H 1.2.0 -b

4. To create raw device file for a device with major number 243 and minor number 0x040012 :
# mknod /dev/rmt/1m c 243 0x040012

5. To create block device file for a device with major number 243 and minor number 0x040012 :
# mknod /dev/rmt/1m b 243 0x040012