Sunday, 13 January 2013

Lesson - 5 Device Management

Device Terminology
    No of hardware and software devices must interact correctly for the device to function properly.
  1. Physical devices
  2. Ports
  3. Device Drivers
  4. To put a defined device to available
  5. Logical devices (/dev)
Note: Some of the logical devices are accessed only ODM cannot accessed by users

Types of devices
         1.  Primary Devices (RAM,CPU and Motherboard)
         2. Secondary Devices
             Hard disk, floppy disk, tape drive, printers , physical adapters, error special files, null special files etc.,
             a) Block devices: This is the structured random device. Buffering is used to provide a block-at-a-time method of access. This is usually a disk file systems
             b) Character devices: This is the sequential, stream oriented device which does not use buffering
        3. Base devices : Keyboard, Mouse
Examples of block devices
Following are examples of block devices:
cd0                        CD-ROM
fd0, fd0l, fd0h       Diskette
hd1, lv00               Logical volume
hdisk0                   Physical volume
Examples of character (raw) devices
       Following are examples of character (raw) devices:
console, lft, tty0       Terminal
lp0                            Printer
rmt0                         Tape drive
tok0, ent0                 Adapter
kmem, mem, null      Memory
rfd0, rfd0l, rfd0h       Diskette
rhd1, rlv00                Logical volume
rhdisk0                      Physical volume

Note: Most of the block devices have equivalent character device , For ex, /dev/hd1 provides buffered access to a logical volume whereas /dev/rhd1 provides raw access to the same logical volume. (The raw devices are ususally accessed by the kernel)

Major and Minor Number
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

Major no is 32 and minor no is 8192,8194 ...
Major no refers to the s/w section of code in the kernel which handles that type of device(hard disk). and minor no to the particular device of that type.

Device Configuration Database
     The predefined and customized databases store information of all the logical devices in the system and their attributes. It is managed by ODM.

Predefined Database (PdDv) List all the Supported Devices
  • Contains all the possible devices supported by the system.s
  • Devices in Undefined state
  • Output contains column like
Class - what the device does
Type - what model
subclass – Where it is attached
 Using “lsdev -P” command can list the devices supported by the system
Customized Database (CuDv) – List Defined Devices
  • List the actual devices used (configured) by the system.
  • Displays name,status, Location and description.
  • lsdev -CH” provides information about the Customized devices.
    The status column contain 2 states
            Available – Device ready to use
            Defined -- Device is unavailable

     Note: Devices may appear in the Defined state after restart the server, the reason is either the corresponding device is powered off or removed from the server.
    • Devices with location code are physical devices. Devices without location codes are logical devices. Location codes depend on type of device and the adapter to which the device is connected.
    • lsattr -E -l <resource-name> command provides detailed effective attributes of currently configured devices.
    • lscfg -v” - important Customized database command in which displays complete information about the device in ODM. display vital product data (VPD) such as part no, serial nos, Model architecutre, FRU, part number etc., for all the devices present on the system                            

    Device Status
           The most common devices states are as follows.
           1. Undefined
           The device is supported device but not configured. Devices reside in the Predefined Database not customized database.
          2. Defined
          The device is configured but unavailable to use. Devices reside in Customized databases
    are in defined state.
         3. Available
         The device is available and ready to use.
    Configuring Devices
         1. “cfgmgr” configure all self-configuring devices.
         2. While configuring the devices, cfgmgr checks whether the device is support on your AIX system by checking the PdDv.
        3. Once the information is found in PD DB, it uses complete information to complete entries into the customized devices database CuDv.
         4. It also loads the appropriate device driver into the AIX kernel and makes the logical devices under /dev directory.
         5. Finally makes the device to available state (ODM).

    The above 3 &4 steps are performed by mkdev command

    Changing Device State
    i. To put a defined device to available
            #mkdev -l <dev>
     ex.,#mkdev -l hdisk1
    ii. To put a available device to defined
            #rmdev -l <device>
     ex.,#rmdev -l hdisk1
    iii. To permanently remove from ODM. 
            #rmdev -dl <device>
      ex.,#rmdev -dl hdisk1
    Device Addressing
    • Location codes are used for device addressing
    • Where exactly the device is connected to your m/c.
    • Location code is made up of 4 fields of information. Useful in troubleshooting scenarios, referred on LED hardware troubleshooting.
    • Devices which are having location code are physical deviecs, not having location code are called logical devices.
    • Location codes depend on the type of the device and adapter to which it connects.
    • Location code is another way of identifying Physical device.
    Format for ex;
    AB-CD-EF-GH for non SCSI/PCI devices
    AB-CD-EF-G,H for SCSI devices

    Commands for displaying Location codes are as follows
             #lsdev -Cc adapter
             #lscfg -vl <name of device>
              “lscfg” list the vital product data including h/w serial no.type, model and part numbers.
    Important Commands
    1. lsdev --> List all the devices (Predefined and Customized)
    2. lsattr --> List attributes of the devices
    3. lscfg --> List the VPD information of the configured (customized) devices
    Options  for Device Commands
    -P --> Predefined devices
    -C --> Customized devices
    -c --> Class type
    -H --> Header information
    -l --> Specify logical device name
    -p --> child devices of parent deviecs
    -F --> parent device of particular child device (use “lsparent -Cl hdisk0)

    -E --> Effective attributes of the devices
    -l --> Specify the logical device name

    -l --> logical device name
    -d --> completely removes from ODM.
    -SR --> removes all child devices from the parent device.

    #lscfg -vp --> all h/w information
    #lscfg -vl --> for particular logical device