dropdown menu

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.)


lsdev and lscfg commands lists all devices (disks, network cards etc.) and additionally these devices as well:
pkcs11      Public-Key Cryptography Standards (it is an interface to create and manipulate cryptographic tokens)
vsa0        Virtual Serial Adapter (HMC to LPAR virtual console connection)
vasi0       Virtual Asynchronous Services Interface (administrative access to VIOS for example during LPM)
sysplanar0  the main board (motherboard), lscfg -vpl sysplanar0 will list all HW related to it (Memory DIMM, FSP, FAN etc.)
sys0        the AIX kernel device of the system planar (motherboard), lsattr -El sys0 will show lots of attributes related to it
pty0        pseudo terminal server (when looging in via putty)
vty0        virtual terminal server (when logging in via console)

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

Major and Minor device numbers:

major number: device driver number (each type of hardware has different numbers: disks, network adapters, fc adapters...)
minor number: number of a specific device on that driver (each disk will have different minor numbers, but same major 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

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.


Device states:
Undefined   The device is unknown to the system.
Defined     The device is known to the system but it is unavailable for use.
Available   The device is available and ready for use.
Stopped     The device is unavailable but remains known by its device driver.


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

26 comments:

Ben said...

The last part about the rmdev failing was really helpful for me today. I couldn't figure out how to find the process which was keeping the device and I tried a bunch of different options/variations of lsof and it was really frustrating me. Thanks for the fuser tip!

aix said...

Cool...thanks for your feedback!

rajesh said...

In AIX how do we identify if a media is present in the tape drive or not ?

# lsdev -Cc tape | grep rmt4
rmt4 AVAILABLE 04-00-00 SAS 4mm Tape Drive

# lsattr -E -l rmt4
block_size 512 BLOCK size (0=variable length) True
compress yes Use data COMPRESSION True
density_set_1 72 DENSITY setting #1 True
density_set_2 71 DENSITY setting #2 True
extfm yes Use EXTENDED file marks True
mode yes Use DEVICE BUFFERS during writes True
ret no RETENSION on tape change or reset True
ret_error no RETURN error on tape change or reset True
size_in_mb 80000 Size in Megabytes False
ww_id 500110a00150c0e8 World Wide Identifier False

# lscfg -vl rmt4
rmt4 U5802.001.9K8R228-P1-C3-T1-L0-L0 SAS 4mm Tape Drive (80000 MB)

Manufacturer................IBM
Machine Type and Model......DDS Gen6
Device Specific.(Z1)........WS20
Serial Number...............201B1728
Load ID.....................A1700D60
Part Number.................23R9722
FRU Number..................23R9723
EC Level....................H82479
Device Specific.(Z0)........0180030283001000
Device Specific.(Z3)........L1

aix said...

If you do a test read on the tape, you will see if there is anything (for example: tctl -f /dev/rmt0 read > /tmp/test_file)

Anonymous said...

Hi Rajech, I have use this procedure to change from "defined" to "Available" but my device rmt0 has disappeared, any advice to re-establish the device??
Thanks in advance,
Regards,
Marco

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 ...

ra said...

hii Balazs,

is there any way to find out all lun disks info using lscfg -vpl command in 1 go?

how about if i use:

lscfg -vpl | grep hdisk

Thanks
Rahul

aix said...

Hi, "lscfg -vpl | grep hdisk" does not work, try this one: "lscfg -vpl hdisk*"

ra said...

thank you Balazs !

Anonymous said...

Hi, is there command that can retrieve specific "Device Specific(Z#)...........[value]" for device(s)? grep, awk/sed, could be used on the above "lscfg -vpl hdisk*" but is not ideal when there are many hundreds of hdisk* on the system. Also, is there any odmshow/odmget or equivalent that would provide a description of what the "Device Specific(Z#)........[value]" entries are. I have executed "odmget -q name=hdisk1 CuVPD" but the output does not contain the "Device Specific(Z#)........[value]" entries only the Manufacturer, Machine Type and Model, and EC Level entries as below:
CuVPD:
name = "hdisk1"
vpd_type = 0
vpd = "*MFVIOLIN *TM\n\
SAN ARRAY *EC552"

Thank you for your assistance!

Anonymous said...

Great blog with wealth of information!! Please keep up the good work, I am wondering is there a reason for lsdev to show the logical volumes and volume groups as "defined".

Anonymous said...

Hello Blazas,

My one of the server is not showing the model number ? can you please help me to fix this?

Asdaf said...

Hi Balazs, I'd like to ask your advice. Someone deleted the /dev/null special file....Do You have any idea how to recover, I found this:
rm /dev/null; mknod /dev/null c 2 2; chmod 666 /dev/null
Many thanks in advance, Asdaf

aix said...

Hi Asdaf, I tested it and the solution what you found worked for me.

- Balazs

Asdaf said...

Hi Balazs, highly appreciate your prompt response! One thing came into my mind. The device should have to be recreated by the cfgmgr as well. Am I right ?
Thanks again, Asdaf

aix said...

Hi, I tried with cfgmgr as well, and it created a /dev/null file, just major,minor number was different from the original one. In my opinion mknod solution shoul be better.

oyao aixblogspot.com said...

how to know disk(pv) have howmuch free space when three disks are there in a volume group

Anonymous said...

Hello. Suppose an AIX server has both an IBM tape library and tape drives. Is it possible to have IBMtape driver attach only to the library and leave the IBM tape drives with AIX default other scsi tape driver (OST)? Even after reboot..

Unknown said...

Please details mention
1. What is an NMON?
2. Briefly explain NMON?

Unknown said...
This comment has been removed by the author.
Unknown said...

Full command
lsvg -p vg_name

Anonymous said...

I am unable to remove a disk which used to be an NSD; removed related GPFS filesystem, deleted nsd but when try to remove the hdisk, it says;
Method error (/usr/lib/methods/ucfgdevice):
0514-062 Cannot perform the requested function because the
specified device is busy.

- fuser shows no process attached
root [aixdev1] /: fuser -cu /dev/hdisk88
/dev/hdisk88:
root [aixdev1] /: fuser /dev/hdisk88
/dev/hdisk88:

There are multiple gpfs filesystems, removed all of them and their NSDs but unable to remove any of the related hdisk due to the above error. Any advice will be greatly appreciated.

Raj said...

Hi, in your location code topic you mentioned that "Devices with a location code are physical devices."...
we have virtual FCs in our server but still i am able to see the phy location code for them..Am i missing anything or misunderstood.

root:common@a72:/ #> lsdev | grep fcs
fcs0 Available 98-T1 Virtual Fibre Channel Client Adapter
fcs1 Available 99-T1 Virtual Fibre Channel Client Adapter
root:common@a72:/ #>
root:common@a72:/ #> lscfg -vpl fcs0 | grep -i physical
Physical Location: U9117.MMB.0639ADR-V21-C98-T1
root:common@ra72cpi101:/ #>

aix said...

Hi, good point.
This was written before virtualization started to rule the world :)
Actually when you create a virtual FC (at HMC level), and you check it at your AIX level, your AIX will handle it as a real device, with location code and all other characteristics (speed, settings...), only you will know it is a virtual adapter (because of the description).

Anonymous said...

Nice Information...

TiGERBOYS said...

Hi IBM Support Team,

We have recently build Two Node RAC cluster. As per Oracle recommendation Major Number of the ASM disk(Shared) should be same on both nodes to configure the RAC cluster. But we are getting different major number of the disks on both nodes. On Primary Node we are getting Major Num 18 and On Secondary Node we are getting Major Num 19. As per Oracle recommendation, we need same Major Num on both Nodes for RAW Disks(ASM).


NODE1 Primary Node
NODE2 Secondary Node

Note : We are changing Major Num to Disk level not VG level.

Both servers rootvg disk have different Major Number. Due to this other disks Major number also showing different. We need same Major Number for ASM disks on both Nodes. Please find the logs below:

[NODE1:root:/dev:] lspv|grep -i rootvg
hdisk0 00f79cb1f6ac8288 rootvg active

[NODE1:root:/dev:] ls -l /dev/hdisk0
brw------- 1 root system 18, 1 Sep 22 22:23 /dev/hdisk0
[NODE1:root:/dev:]



[NODE2:root:/dev:] lspv|grep -i rootvg
hdisk0 00f79cb0f6f7d638 rootvg active

[NODE2:root:/dev:] ls -l /dev/hdisk0
brw-r--r-- 1 root system 19, 1 Nov 16 14:01 /dev/hdisk0
[NODE2:root:/dev:]

Pjg said...

Just a question, if C and B device files were removed or missing, how to recreate them? Will mknod help