Renumbering device instances

With really large disk arrays, you can find instance numbers piling up very quickly, and worse, they can make path managers such as DynaPath, Power Path and Secure Path exceed their limits. This is especially true if you are deleting and re-adding devices. Fortunately, there is a relatively easy way to accomplish this task.

Instance numbers are simply an index or ID within the driver for that device. The driver creates an instance number for each hardware path where the device is found, for instance disks or LUNs. If there are 10 disks, then the instance numbers will start at 0 and increment as each new disk is discovered. Depending on the version and patches for HP-UX, missing numbers or gaps can start showing up. The good news is that the instances for a specific device type (disk, tape, lan, ext_bus, etc) can be renumbered with the only restriction that there can be no duplicates for a given device class. Note that for disks, the legacy names (called CTD names) use the “c” portion of the name to correspond to the ext_bus number.

It turns out that the instance number is only used by the driver and insf, and reported by ioscan. Therefore, you can edit the list of instance numbers and change them to different values, as long as there are no duplicates for a given device type. Here is the command to generate an ioinit listing:

# ioscan -f |

grep -e INTERFACE -e DEVICE |

grep -v target |

awk ‘{print $3, $1, $2}’ > /infile

The output look like this:

0/0/0/0 lan 0

0/0/1/0 ext_bus 0

0/0/1/0.7.0 ctl 3

0/0/1/1 ext_bus 1

0/0/1/1.0.0 disk 0

0/0/1/1.2.0 disk 1

0/0/1/1.7.0 ctl 0

0/0/2/0 ext_bus 2

0/0/2/0.0.0 disk 28

0/0/2/0.2.0 disk 2

0/0/2/0.7.0 ctl 1

0/0/2/1 ext_bus 3

0/0/2/1.2.0 disk 3

0/0/2/1.7.0 ctl 2

So the fields are: hardware path, device class name and instance. To isolate all the disks:

# grep disk /infile

0/0/1/1.0.0 disk 0

0/0/1/1.2.0 disk 1

0/0/2/0.0.0 disk 28

0/0/2/0.2.0 disk 2

0/0/2/1.2.0 disk 3

And as you can see, disk 28 is out of sequence. You must retain the entire file and just edit the disk lines.

nes renumbered:

# grep disk /infile

0/0/1/1.0.0 disk 0

0/0/1/1.2.0 disk 1

0/0/2/0.0.0 disk 2

0/0/2/0.2.0 disk 3

0/0/2/1.2.0 disk 4

Important: the file (infile) must be stored in / or /etc as it may be needed when no filesystems are mounted.

To apply these changes (requires a reboot), use ioinit like this:

# /sbin/ioinit -f /infile -r

Ignore the lines which state that “Input is identical to kernel”. The system will reboot and instance numbers reported by ioscan will be the new values. NOTE: changing disk instance numbers will not change the device file connections so existing LUNS and volume groups should remain unaffected.

If you have problems with the ioinit command reporting errors, you can use the two step approach. The first step is to rename the current ioconfig files (there are two: /stand/ioconfig and /etc/ioconfig) to something like ioconfig.sav and reboot:

# mv /stand/ioconfig /stand/ioconfig.sav

# mv /etc/ioconfig /etc/ioconfig.sav

# shutdown -ry 0

and the system will automatically stop after booting part way up at the ioinitrc stage. Type the two commands:

(in ioinitrc)# /sbin/ioinit -c

(in ioinitrc)# /sbin/ioinit -f /infile -r

The -c option initializes the ioconfig file and will remove any conflicts or problems when running the ioinit command previously. Then the new infile is merged into the ioconfig file and the system reboots. Note that this applies to HP-UX 11.23 and earlier. For 11.31, there are online procedures to renumber instances.

– See more at: http://serviceitdirect.com/blog/renumbering-device-instances#sthash.1pU2uiDR.dpuf


Tags: