How to force Solaris to renumber network devices

July 8, 2008

Let us suppose, as a not entirely hypothetical example, that you are transplanting the system disks from a Solaris 10 install from a SunFire X2100 to a SunFire X2200. While both machines have four onboard network ports, two Broadcom and two nVidia, they are not quite the same hardware, enough so that if left to its own devices Solaris will consider the new machine's NICs to be bge2, bge3, nge2, and nge3 (instead of bge0, bge1, nge0, and nge1).

This isn't a really desirable result, because it makes the transplanted machines different from any future machines you install on the X2200s (and in turn means that you have to remember any particular install's history when figuring out which network device is which). What you want to do is to force Solaris to renumber the Ethernet devices from scratch, giving them their natural numbers.

(As far as I can see, there is no documented way of doing this; a reconfiguration reboot doesn't do it, at least on Solaris 10 U4 and U5.)

It turns out that Solaris stores this mapping information in /etc/path_to_inst in the relatively obvious form of:

"PATH" INSTANCE "DRIVER"

The PATH is relative to /devices, the DRIVER is what you'd expect, and the INSTANCE, for network devices, is the N in bgeN. So what you want to do is edit /etc/path_to_inst to remove all mention of your network devices and do a reconfiguration reboot, which will recreate them from scratch and should give them the numbers you want. It's possible that you can just directly assign instance numbers to network devices without the reconfiguration reboot, but I haven't tested this.

(Important: make a backup of the file first, just in case.)

When I did this it took two go-arounds to get the nVidia devices correct; you might be able to get it down to one by doing the editing in the rescue environment instead of booting the system into normal single-user mode. If you go this route, you'll need to rebuild the boot archive by hand (with 'bootadm update-archive -R /a').

Oh yes, and here's an important safety tip that I learned the hard way: under no circumstances should you use rem_drv (what can I say, it looked like a tempting way to force a full reconfiguration of the driver from scratch). Doing so removes the information about which PCI devices are handled by the driver, which is hard to recover from unless you have a spare Solaris 10 machine (ideally with the same hardware) around to consult as reference.

(This mapping information is stored in /etc/driver_aliases; the base version of driver_aliases comes from the SUNWcsd package but it's then modified by the install scripts of various driver packages.)

Written on 08 July 2008.
« A (D)VCS feature that I'd really like
Detailed usage charges versus simpler charging models »

Page tools: View Source, Add Comment.
Search:
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Tue Jul 8 00:09:30 2008
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.