Friday, September 20, 2013

Devices

Devices

CEC - Central Electronic Complex
it generally refers to a discrete portion of the system containing CPU, RAM, etc. the "IO Drawer" would be a separate unit.

backplane is similar to a motherboard, except motherboard has CPU as well, but a backplane does not have a CPU (on IBM servers we have processor cards). Sysplanar is the same as backplane or "motherboard". sys0 is the AIX kernel device of the system planar.


In order to attach devices (like printer...) to an AIX system, we must tell AIX the characteristics of these devices so the OS can send correct signals to the device.

Physical Devices        Actual hardware that is connected in some way to the system.
Ports                   The physical connectors/adapters in the system where physical devices are attached.
Device Drivers          Software in the kernel that controls the activity on a port. (format of the data that is sent to the device)

/dev                    A directory of the logical devices that can be directly accessed by the user.
                        (Some of the logical devices are only referenced in the ODM and cannot be accessed by users).
Logical Devices         Software interfaces (special files) that present a means of accessing a physical device. (to users and programs)
                        Data transferrred to logical devices will be sent to the appropriate device driver.
                        Data read from logical devices will be read from the appropriate device driver.


Devices can be one of two types:
  - Block device is a structured random access device. Buffering is used to provide a block-at-a-time method of access.
  - Character (raw) device is a sequential, stream-oriented device which provides no buffering.

Most block devices also have an equivalent character device. For example, /dev/hd1 provides buffered access to a logical volume whereas /dev/rhd1 provides raw access to the same logical volume.(The raw devices are usually accessed by the kernel.)

----------------------------------

Major and Minor device numbers:

                        maj.min dev nums
brw-------   1 root     system       32,8192 Nov 03 14:19 hdisk3
brw-------   1 root     system       32,8194 Nov 03 14:19 hdisk4
brw-------   1 root     system       32,8195 Nov 07 07:08 hdisk5

It means: here we have a major device which is 32 and there are minor devices for this major device, which are: 8192,...
More precisely, the major number refers to the software section of code in the kernel which handles that type of device, and the minor number to the particular device of that type.

----------------------------------

cfgmgr - mkdev/rmdev:
The Configuration Manager (cfgmgr) is a program that automatically configures devices on your system during system boot and run time. The Configuration Manager uses the information from the predefined and customized databases during this process, and updates the customized database afterwards.




mkdev either creates an entry in the customized database when configuring a device or moves a device from defined to available. When defined, there is an entry in the customized database already. To move to the available state means the device driver is loaded into the kernel.

rmdev changes device states going in the opposite direction. rmdev without the -d option is used to take a device from the available to the defined state (leaving the entry in the customized database but unloading the device driver). When using the -d option, rmdev removes the device from the customized database.


----------------------------------

LOCATION CODES:

The location code is another way of identifying the physical device. The format is: AB-CD-EF-GH.
Devices with a location code are physical devices. Devices without a location code are logical devices.

physical location code: lscfg | grep hdisk0
AIX location code: lsdev -Cc disk
Both location codes: lsdev -Cc adapter -F "name status physloc location description"

----------------------------------

FRU, VPD:

FRU (Field Replaceable Unit) is the number used by IBM to identify the devices. (sometimes it is called 'Part Number') These are needed forhardware replacement.

VPD  (Vital Product Data) is the basic data (infos) about the device which is stored in the EEPROM of the device and it can be read by the OS. It can be presented by the command 'lscfg' and it contains the FRU as well.

lsdev        shows information about devices from ODM (-C Customized Devices, -P Predefined Devices   
lscfg        display vital product data (VPD) such as part numbers, serial numbers...
lsattr       display attributes and possible values (the information is obtained from the Configuration database (ODM?), not the device)

----------------------------------

INFO ABOUT THE DEVICES:

prtconf                      displays system configuration information
lsdev -PH                    lists supported (predefined) devices (-H shows the header above the column; lsdev -Pc adapter -H)
lsdev -CH                    lists currently defined and configured devices (lsdev -Cc adapter -H)
lsdev -CHF "name status physloc location description" this will show physical location code and AIX location as well
                             (Devices with a location code are physical devices. Diveces without a location code are logical devices.)
lsdev -p fscsi0              displays the child devices of the given parent device (in this case the disks of the adapter)
lsdev -l hdisk0 -F parent    displays the parent device of the given child device (in this case the adapter of the disk)
                             (it is the same: lsparent -Cl hdisk0

mkdev -l hdisk1              put from defined into available state (or creates an entry in customized db if there wasn't any)
rmdev -l hdisk1              put from available into defined state
rmdev -dl hdisk1             permanently remove an available or defined device

rendev -l hdisk5 -n hdisk16  it changes the name of the device (as long as it is not in a vg (in AIX 6.1 TL6))

odmget -q parent=pci0 CuDv   shows child devices of pci0 (in the output look for the "name" lines)
odmget -q name=pci0 CuDv     shows parent of pci0 (in the output look for the "parent" line)

lscfg -v                     displays characteristics for all devices
lscfg -vl ent1               displays characteristics for the specified device (-l: logical device name)
lscfg -l ent*                displays all ent devices (it can be fcs*, fscsi*, scsi*...)

lsattr -El ent1              displays attributes for devices (-l: logical device name, -E:effective attr.)
lsattr -Rl fcs0 -a init_link    displays what values can be given to an attribute
odmget PdAt |grep -p reserve_policy  displays what values can be given to an attribute


lsslot -c pci                lists hot plug pci slots (physical)
lsslot -c slot               lists logical slots
lsslot -c phb                lists logical slots (PCI Host Bridge)

cfgmgr                       configures devices and installs device software (no need to use mdev, rmdev)
cfgmgr -v                    detailed output of cfgmgr
cfgmgr -l fcsX               configure detected devices attached to fcsX (it configures child devices as well)
cfgmgr -i /tmp/drivers       to install drivers which is in /tmp/drivers automatically during configuration

smitty devices
 
---------------------------

Changing state of a device:
    1.lsdev -Cc tape        in normal case it shows: rmt0 Available ...
    2.rmdev -l rmt0         it will show: rmt0 Defined
    3.rmdev -dl rmt0        it will show: rmt0 deleted (the device configuration is unloaded from the ODM)
    Now rmt0 is completely removed. To redetect the device:
    4.cfgmgr                after cfgmgr, the lsdev -Cc tape command shows: rmt0 Available ...


---------------------------

If rmdev does not work because: "... specified device is busy":

1. lsdev -C| grep fcs1             <--check the location (in this case it is 07-00)
2. lsdev -C| grep 07-00            <--check all the devices in this location

3. this will show which process is locking the device

for i in `lsdev -C| grep 07-00 | awk '{print $1}'`; do
fuser /dev/$i               
done

No comments:

Post a Comment