Informing the IBM Community

AIX tech tip: How to scan new devices with a single command


Abstract technology background with hexagonal shapes
There are things I really love about virtualisation for Power Systems. I probably appreciate some things more than other people do because I got to see how things used to work many years ago. A combination of physical and virtual enhancements has made life a lot easier than it used to be.

I remember when discovering a new tape drive meant cabling it to the right SCSI adapter and powering off everything before you started. Getting the right cable and SCSI adapter was a dark art that I never mastered.
We were told that connecting a new tape drive was a full system outage (no big deal, given that we scheduled weekly reboots anyway just to clear out the cobwebs). But there was no such thing as “hot-swappable”. Or so I understood. I’m still not sure if it was technically true or merely folklore to keep us young whippersnappers off the street. Reboot or die.

It used to be that discovering new devices was done with a reboot or by running cfgmgr “config manager” on the command line. Either way, on a standalone system with quite a few disks and physical adapters to scan, the process could take 15 minutes or more. Then, if the new tape drive didn’t appear, you did what troubleshooting you could and tried another rescan.

Since the introduction of increasing levels of virtualisation, this ageing AIX guy actually prefers the new way things are done. You still run “cfgmgr”, but the whole episode can be over in a second or two.

Discover new devices with cfgmgr

The command cfgmgr needs to be run with root permissions. The command documentation page says that cfgmgr “configures devices and optionally installs device software”. That second part doesn’t have to happen so much these days, as so many drivers come native with AIX.

Most people run cfgmgr without any flags. Being the sort of person who likes to look under the covers a bit, I usually run it with the verbose flag: -v. That will scroll off the screen with a number of underlying programs that are called, depending on what kind of device is being discovered.

One of the benefits of using the –v flag is that you get to see where cfgmgr is hanging (if that happens). And  if it does take a long time – often because it’s timing out on an adapter somewhere – you can see how many seconds it’s been running.  I find that techies tend to like it when things run well, but when something goes wrong they’re super-hungry for information to help them diagnose the problem.

Locate your child!

It sometimes happens that you only want to discover the child devices of a single adapter. You can do that using the –l flag and specifying the adapter name.

For example, here’s how to discover any new devices hanging off Fibre Channel adapter fcs0:

cfgmgr –l fcs0

As with most commands, there are other flags and options you can use. For instance, if you need to install device software that is sitting on a CD in /dev/cd0, you can specify that using the –i flag. That will point to the right installation media.

cfgmgr –i /dev/cd0

It is important to be aware that new devices will typically be named with the next incremental number. For example, if you have three disks on your AIX environment (hdisk0, hdisk1 and hdisk2), if you map a new virtual SCSI disk it will come in as hdisk3.

List device classes

You can check your list of the devices on your AIX system using the command “lscfg”. You’ll also find “lsdev” helpful with the –c flag followed by the supported device class.

To list disks:

lsdev –c disk

You can show adapters with:

lsdev –c adapter

And tape drives are shown with:

lsdev –c tape

By the way, most AIX people will add the –C flag on the lsdev command:

lsdev –Cc disk

There’s no harm in this but it is not necessary. Since at least AIX 4.3, the –C flag has not been required. It’s still there for backward compatibility with earlier versions of AIX.

There’s something simple and elegant about having a single command to scan for new devices without having to take the hit of a system shutdown. And I kind of like the fact that I don’t have time to make a coffee every time I run it.

Resources on the IBM Knowledge Center

Configure devices and install device software using the cfgmgr command

List devices and their characteristics with lsdev

How to display configuration, diagnostic, and vital product data (VPD) information about the system with the lscfg command

Having worked on IBM systems since 1991, Anthony English has seen how AIX and virtualisation can manage all kinds of business environments. He is a well-recognised author in the IT field and he writes about business systems improvement through his blog Anthony is based in Sydney, Australia, with his wife and his seven children.

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.