17.5 Creating Device Files

   

The device files are automatically created when you install HP-UX on your system. After that, every time you boot your system, HP-UX scans all attached devices and creates device files if the device is autoconfigurable. However, you may need to create device files yourself for devices that are not autoconfigurable. One of the following methods is used for creating device files.

Autoconfiguration

At boot time, the kernel probes all hardware devices. It builds a list of the devices and initiates the init process during the boot process. The init process in turn starts the /etc/ioinitrc script. This script executes the ioinit command. This command checks the list of devices in the /etc/ ioconfig file and compares it with the list of devices probed by the kernel. If new devices are found, ioinit executes the insf command, which creates device files for the new devices. This process is called autoconfiguration.

Using the insf Command

The insf command creates device files for new devices. It is automatically executed during the boot process; however, you can also use it later to create additional devices. For example, to create device files for tape drives , you can use the following command.

 insf -C tape 

This command does not create device files for existing devices. If you delete device files accidentally , insf will not recreate the device files at boot time. For creating device files for existing devices, you need to use the command line option -e . For example, if you accidentally delete the device file for your CD-ROM, which is attached to hardware path 0.1.0, use the following command to recreate it.

 insf -H 0.1.0 -e 

The options used with this command are listed in Table 17-3.

Table 17-3. Options Used with the insf Command
Option Description
-d Select device by driver name
-C Select device by class name, such as "disk" and "tape" classe
-H Create device files for a given hardware pat
-I Create device for card instance
-e Reinstall files for existing devices

Using the mksf Command

This command is used to create device files if the system already knows the devices. An existing device is one that already has been assigned an instance number by the system. The mksf command can also create a directory if needed for the device file. It has some built-in options and file naming conventions; however, you can override these options using the command line. Table 17-4 shows command line options that can be used with this command.

Table 17-4. Options Used with the mksf Command
Option Description
-d Select device by driver name
-C Select device by class name, such as "disk" and "tape"
-H Create device files for a given hardware path
-I Create device for card instance
-m Create file with minor number

There are some other options that can be used with this command. For example, if you want to create a character-type (raw) device file for a disk attached at hardware address 2.4.0, the command will be:

 mksf -H 2.4.0 -r 

Using the mknod Command

The mknod command can be used to create character device files, block device files, or files representing named pipes. To create character or block device files, you have to specify major and minor numbers at the command line. To create a character device file for a tape drive with major number 212 and minor number 0x030080, you will use this command.

 mknod /dev/rmt/0m c 212 0x030080 

To create a block device file, replace " c " with " b " on the command line.

Using SAM

You can use the SAM Peripheral Devices area to install device files. This area looks like the window shown in Figure 17-2.

Figure 17-2. SAM Peripheral Devices area for creating new device files.

graphics/17fig02.gif

From here you can select a particular type of device by clicking on one of the icons displayed in the window. You can also list the I/O adapters installed in the system by selecting Device List . When you select this area, a window like the one shown in Figure 17-3 will appear. Here you can see the hardware path of each I/O card and its corresponding driver name. The Description column shows a short description of the adapter.

Figure 17-3. List of adapters installed in the system.

graphics/17fig03.gif

To create a new device file, go to the corresponding area and select Add from the Actions menu.


   
Top


HP Certified
HP Certified: HP-UX System Administration
ISBN: 0130183741
EAN: 2147483647
Year: 2000
Pages: 390
Authors: Rafeeq Rehman

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