Devices In AIX
Objectives for the module
- Understand Pre-Defined and Customized Devices Databases
- Describe the states of a device
- Logical and physical devices
- Understand device location codes
- How to add/change/delete devices
Physical devices: Actual device connected to the system.
Device Drivers: Device drivers are software that resides in the kernel that controls the activities and the data that is sent to the devices.
/dev directory: The directory which contains all of the logical devices that can be directly accessed by the user.
Ports: The physical connectors/adapters in the system which allow
attachment of many different devices are called ports. Ports
are not only a connection point but they are also programmable by the system software.
/dev directory contents
You can get the above output when you execute the command
# ls–l /dev
In the output above, you can see that there are basically two types of devices,
Block devices (b)
Block devices use buffering to provide a block by block access to the device and its data.
Character devices (c )
Character devices are also called raw devices and are stream-oriented i.e. sequential access which provides no buffering.
Usually in the fifth field where we see the size of the file, for a logical device we see a pair of values (for eg19,2). The first value is called the major number and the second value is called the minor number. Major number usually specifies the type of the device that we are working with and the appropriate device driver in the kernel that has to be used to work with the device and the minor number refers to the behavior of the device i.e. particular device of that particular major type.
Predefined and Customized Devices
If you want to use a particular device, it has to be in the available state.
Listing All predefined and Customized Devices
The list of commands to list the predefined and customized devices are here..
•lsdev –Pc disk-> displays all predefined devices of class type “disk”
•lsdev –C –H-> displays all customized devices (configured devices)
•lsattr –EH –l sys0-> display all effective attributes of the logical device sys0
Devices are classified by class, type and subclass where the “Class” indicates what the device does, “Type” indicates what model it is, and “subclass” indicates how it can be attached to the system.
The command lsdev can be used to list the devices.
There are various options available with this command, like:
a. –P -> show the devices from the predefined devices database. (show the supported devices)
b. -H -> Show a heading along with the output
c. -C -> Show the devices from the customized devices database (show the configured devices)
d. -c -> class of the device like disk, tape.
lsattr command can be used to list the attributes for a particular device. This command comes with lots of options like :-
-E -> show only the Effective attributes.
-l -> To specify the logical device name.
The states of the devices are as follows:
Undefined: The device is a supported device on the AIX system. Its present in the predefined devices database.
Defined: The device is present in the customized/configured devices database and the logical device files have been created but at present is un-available for use.
Available: The device information resides in the customized devices database and the device if fully configured and is ready for use.
When the device is for the first time configured by the cfgmgr command, its put into the available state. When you run the command rmdev–l over a available device it slips into Defined stage. When you run the command rmdev–dl over a defined or an available device, it slips into undefined state. Though there is no recognizable state called “Undefined”, it means that the device is just a supported device on your system and is still not configured to work.
How cfgmgr works
cfgmgr(Configuration Manager) command configures all self-configuring devices. While configuring the devices, cfgmgr checks whether the device is a supported device on your AIX system by checking the Predefined database ie PdDv. Once it knows that the information of the device is found in the pre-defined devices database, it uses the information to complete entries into the customized devices database is CuDv. It also loads the appropriate device driver into the AIX kernel and makes the logical device entries under the /dev directory.
Most of the devices are self-configurable except for devices which are connected via parallel or serial ports like printers, ASCII terminals, modems etc.
Working with Devices
You can use the fastpath #smit devices to manage the configuration information about the devices.
Here you have all the options to configure the devices like Terminals, printers and plotters, console, hard disks, CDROMs etc.
•The location code for a device is information about where exactly is that devices connection in your machine.
•It’s a path from the adapter, through the bus and to the device
•Location code is made up of 4 fields of information
As a system administrator sometimes it becomes necessary to have a good understanding of where exactly is a particular device connected to the system. This may be necessary during some troubleshooting scenarios.
The location code would be referred to on the LED whenever there is a hardware failure, making it easy for the administrator to figure out which device has actually failed.
The location code as mentioned above consists of up to 4 fields of information. Certain devices when listed could only show two pairs, that means this device is just an adapter. If a device’s location code is made up of four pairs of values then it’s a physical device attached to an adapter.
Location code for a non scsi device
AB –00 -> devices attached to the processor
01 -> devices attached to the ISA bus
04 -> devices attached to the PCI bus
CD –01-99 -> pluggable cards
A-Z,0 -> integrated adapter cards
EF --> Connector ID
GH -> Port identifier, FRU for the device
ISA –Industry Standard Architecture. These are the bus types. These bus types are used in the RS/6000 to connect devices like the diskette and the keyboard.
PCI –Peripheral Component Interconnect. These are the industry standard buses which are used by RS/6000 to connect other devices.
Integrated adapter cards have electronics for that particular card/adapter built it and integrated in the system planar thus making it impossible to shift to a much better card if need arises. Whereas the advantage of a plug in card is that they are easily removable if there is a newer card available with newer features because the electronics of that card is inbuilt in the card itself.
Example: Non-scsi location code:
The picture is an example of a location code for a non-scsi device. The AIX System has a 128 port Async adapter card with 2 ports on it. To those ports are connected RANs(Remote Async Nodes) which looks like a hub with 16 ports on it. The ASCII terminals are connected to these ports of the RAN.
In the example we have an ASCII terminal connected to one of the ports of the RAN ie port number 11 on the 1stRAN connected to the second port of the 128 port Async adapter card. The adapter is a plug in adapter card connected to a PCI bus (04) and in the slot 5 (05). So the entire location code for the device would be
i.e. on the PCI bus(04) , in the slot number 5 (05), on the port number 2 (2) and RAN number 1 (1) and port number 11 (11) the ASCII terminal is connected.
Location Code Format for SCSI Devices
AB-CD - Identifies the bus and the adapter location Same as with non-SCSI devices
EF - For a single SCSI bus - 00
For a dual SCSI bus:
Internal bus - 00
External bus - 01
G,H G= SCSI address (SCSI ID) of the device
H= Logical unit number of the device
Example: scsi Location codeThe above picture is an example of location code for a scsi device. There is a scsi adapter card plugged into your system on the PCI bus slot number 01. The scsi adapter itself has the scsi id 7 assigned to it. To this scsi adapter, there is an external scsi tape drive attached. The external scsi tape drive is assigned 5 as the scsi id (either by using a jumper setting or by using a dip switch). So the location code for the external tape drive would be 04-01-00-5,0. That is on the scsi adapter whose address is 04-01, there is a scsi device attached to the single scsi bus (00) whose scsi id is 5 and no Logical Unit Number (LUN) (0).
Example 2: Location Code Example for SCSI Device
SCSI Devices (Disk, Tape, CD-ROM)
CuDv Customized Devices
Listing Device Physical Locations
# lsdev -C -H -F "name status physloc location description"
How to add a ASCII terminal
Most of the devices are self-configurable device which can be directly configured by the cfgmgr. Devices which get attached to the parallel port or the serial port like the printer, ASCII terminals, modems etc are not self-configurable devices, so they have to configured separately.
The picture above shows an example of how to configure/add a ASCII terminal to your AIX system.
You can use the fastpath# smit tty to add /configure a ASCII terminal on your system.
Choose the option Add a tty
-> you may have to select the terminal type is rs232 or rs422. rs232 is the most common tty type
-> now you may have to select the parent adapter name ie where exactly is the terminal attached ie serial port 1 (sa0) or serial port 2 (sa1) etc.
Adding a terminal
In this final dialog panel to add a terminal, the only mandatory field for you to enter is the port number. Enter the port number and you can add the ASCII terminal on your system.