Rebuilding the Solaris Device Tree

If you ever shift around any bootable drives within a Sun Solaris box, you may find that either the device names (cxtxd0sx) do not follow the disk position within the server, or, the system just fails to boot because it can’t mount the other disk slices.

Let’s assume you are booting off of target 8 (c1t8d0s0), but wish to move that disk to the appropriate slot to make it target 0 (c1t0d0s0). You have changed all references in the /etc/vfstab file to reflect the new disk position, physically moved the drive from the target 8 slot to the target 0 slot, and changed the boot-device variable within the OBP to the appropriate disk. You should now be all set to boot from the disk in target 0, right?

Not quite yet.

Solaris creates a device tree with links to all the disks it knows about, and these don’t get rebuilt upon reboot. If you simply tried to boot the disk now in target 0, it would find the kernel, but fail to mount any of the other filesystems, because these device links are still pointing to the disk slices on target 8.

In order to boot off the drive in the new position, you will have to remove these device links and rebuild them. Here is how we do that:

1. Insert a Solaris 8, 9 or 10 cd into the hosts cdrom

2. From the ok prompt, enter boot cdrom -s

ok> boot cdrom -s

3. fsck the boot disk

# fsck -y /dev/rdsk/c1t0d0s0

Remember that your boot disk may differ than the example above. Since in our example above, we have put the disk into the slot for target 0 (c1t0d0), that is what we are using here.

4. Mount the root slice on /mnt

# mount /dev/dsk/c1t0d0s0 /mnt

Note that your root slice may differ than the above example.

5. Move path_to_inst

# mv /mnt/etc/path_to_inst /mnt/etc/PATH_TO_INST_ORIG

6. Remove all old device links

# rm /mnt/dev/rdsk/c* ; rm /mnt/dev/dsk/c* ; rm /mnt/dev/rmt/* ; rm
/mnt/dev/cfg/c*

7. Rebuild path_to_inst and devices

# devfsadm -r /a -p /mnt/etc/path_to_inst

8. Unmount the root slice and reboot

# umount /mnt ; init 6

You should now be able to boot off your old drive in its new slot.

Discuss This Article


8 Responses to “Rebuilding the Solaris Device Tree”

  1. spiralbound.net » How to copy a Solaris boot drive to a disk with a different partition layout on December 21st, 2005 3:20 pm #

    [...] Notice that the target number will remain 2, not move to 0 when we swap the disks and boot from the new one. To resolve this, it is strongly suggested that you rebuild the solaris device tree and change the vfstab file to reflect the new disk position. [...]

  2. Jim Weller on July 23rd, 2006 1:41 pm #

    Shouldn’t


    # devfsadm -r /a -p /mnt/etc/path_to_inst

    be


    # devfsadm -r /mnt -p /mnt/etc/path_to_inst

  3. A Braunsdorf on August 16th, 2006 4:30 pm #

    /etc/inst_to_path doesn’t seem to be used (or created by this procedure) on i86pc. Moved a drive from an older V40 to a newer one and can’t get it to work, so any clues would be appreciated. I’ve done basically what’s above moving from SPARC to SPARC, but doesn’t seem to work on the AMDs. :-(

  4. Jay Herbig on August 21st, 2006 9:58 am #

    Your directions look pretty good but I’m not quite sure about the arguments. Why, when you have the root mounted under /mnt are you using -r /a? I know the /a convention is usually what you’ll use if you’re mounting a filesystem under a failed boot which exits to the degraded single user mode… but wouldn’t the -r (root_dir) also be the mounted filesystem under /mnt?

    Thanks, other than that looks great. I’m using some of your notes to migrate a fibre based V480 disk to a scsi based V440.

    Jay

  5. Jay Herbig on August 21st, 2006 9:59 am #

    Doh, sorry, should have looked further down the page. Pardon my redundancy.

    Jay

  6. Robert Sturrock on December 21st, 2006 1:00 am #

    Very useful article - thanks. Like another poster, I was able to use this to help clone an already installed system from a V440 to a V240 with a different device layout.

    Robert.

  7. How to copy a Solaris boot drive to a disk with a different partition layout | IDGLabs.COM - tips, tools and resource on April 15th, 2008 8:34 am #

    [...] we swap the disks and boot from the new one. To resolve this, it is strongly suggested that you rebuild the solaris device tree and change the vfstab file to reflect the new disk [...]

  8. Guillermo Salas on May 7th, 2008 4:34 pm #

    A. Braunsdorf:

    I was having the same problem you are having. (because I installed it on one machine and then moved the disk to a completely different machine). I got the system running by starting up in safe mode and copying the file “path_to_inst” from the failsafe instance to the normal “etc” directory. I then modified the boot archive in the normal instance so that the file /boot/solaris/bootenv.rc had the parameter “boot device” pointing to the correct device. To find out what the new device was, I just made a ls -l to the /dev/dsk directory. Lastly I had to make some modifications to the vfstab file in the “normal” /etc/ directory. Hope this helps.


Got something to say?






Post Tags (user submitted): t (271) - solaris path_to_inst (271) - rebuild path_to_inst (197) - solaris rebuild devices (119) - solaris rebuild device tree (114) - solaris rebuild path_to_inst (98) - solaris device tree (90) - rebuilding path_to_inst (74) - "path_to_inst" solaris (72) - solaris rebuild /dev (59) - rebuild solaris device tree (47) - rebuild device tree solaris (45) - "solaris 10 " path_to_inst (42) - rebuild device tree (39) - "solaris 10" devfsadm (37) - rebuild /devices solaris (34) - path_to_inst rebuild (34) - solaris rebuild device (32) - rebuild path_to_inst solaris (32) - "solaris 10" rebuild path_to_inst (30) - solaris 10 rebuild device tree (27) - devfsadm solaris 10 (27) - rebuild path_to_inst solaris 10 (26) - f (26) - spiralbound net (25) - solaris devfsadm (22) - device tree solaris (22) - solaris 10 rebuild devices (20) - rebuild /dev solaris (19) - devfsadm path_to_inst (18) - solaris devices (17) - rebuilding solaris device tree (17) - solaris (16) - all (16) - solaris 8 path_to_inst (16) - Solaris path_to_inst rebuild (15) - path_to_inst solaris 10 (15) - solaris 9 rebuild device tree (14) - target (14) - Solaris device naming (13) - solaris remove disk (13) - rebuild /devices (13) - rebuild device tree solaris 10 (13) - rebuild solaris devices (12) - solaris 8 rebuild path_to_inst (11) - delete path_to_inst (11) - rebuild /etc/path_to_inst (11) - devfsadm +solaris (10) - solaris rebuild kernel (10) - Rebuilding the Solaris Device tree (10) - solaris 10 rebuild dev (10) - path_to_inst solaris 8 (10) - rebuild path_to_inst Solaris 8 (9) - path_to_inst (9) - solaris 10 cdrom device (9) - how to rebuild path_to_inst (9) - Solaris device rebuild (9) - solaris devfsadm path_to_inst (9) - solaris +rebuilding "device tree" (9) - solaris 10 devfsadm path_to_inst (9) - "devfsadm -R" (9) - device tree (8) - solaris find cdrom device (8) - rebuild vfstab (8) - solaris 10 mount cdrom (8) - solaris disk device names (8) - rebuilding device tree (8) - solaris 10 cdrom device name (8) - Solaris rebuild /dev/rmt (8) - rebuild devices solaris 10 (8) - rebuild solaris device (8) - solaris rebuild (8) - /devices solaris (8) - solaris 10 device tree (8) - remove device solaris (8) - solaris :boot -ar (7) - rebuild path_to_inst file (7) - solaris rebuilding dev (7) - mount cdrom solaris 8 (7) - solaris "cdrom device" (7) - solaris device (7) - rebuild solaris kernel (7) - rebuild path_to_inst devfsadm (7) - devfsadm rebuild path_to_inst (7) - device tree in Solaris (7) - rebuild device Solaris (7) - rebuilding the device tree (7) - solaris rebuilding path_to_inst (7) - rebuild solaris path_to_inst (7) - solaris 10 devfsadm (7) - path_to_inst devfsadm (6) - rebuilding /dev solaris (6) - remove disk solaris (6) - solaris boot path_to_inst (6) - Rebuild /dev/rmt (6) - solaris kernel rebuild (6) - rebuild the solaris device tree (6) - solaris delete path_to_inst (6) - rebuild "/dev" (6) - solaris device tree rebuild (6) - jay herbig (6) - solaris "remove device" (6) - mss (6) - remove devices solaris (6) - solaris remove devices (6) - solaris rebuild device files (6) - boot cdrom solaris (5) - solaris rebuild dev devices (5) - /etc/path_to_inst (5) - solaris cdrom device name (5) - solaris change boot device (5) - boot path_to_inst (5) - solaris +boot +cdrom (5) - Rebuild device tree "Solaris 8" (5) - solaris device links (5) - solaris rebuild devices tree (5) - remove device path_to_inst "solaris 9" (5) - solaris 9 rebuild path_to_inst (5) - device tree rebuild (5) - +solaris +/devices +rebuild (5) - rebuilding devices solaris (5) - path_to_inst rebuild solaris 10 (5) - how to rebuild the device tree on solaris 8 (5) - path_to_inst in solaris (5) - remove path_to_inst (5) - Solaris /dev/cfg (5) - solaris 8 rebuild devices (5) - solaris 9 devices tree rebuild (5) - rebuild the device tree solaris (5) - solaris boot rebuild devices (5) - rebuild devices on solaris (5) - devfsadm cdrom rebuild (5) - path_to_inst solaris (5) - device links (4) - solaris "device names" (4) - Solaris /etc/path_to_inst (4) - solaris rebuild devices path_to_inst (4) - solaris disk device naming (4) - delete devices solaris (4) - solaris 10 find cdrom device (4) - solaris 10 path_to_inst rebuild (4) - rebuilt path_to_inst (4) - solaris remove path_to_inst (4) - solaris 10 device tree path_to_inst (4) - rebuilt devices in solaris (4) - vfstab rebuild (4) - rebuilding dev devices solaris (4) - solaris 9 rebuild devices (4) - Rebuilding device tree Solaris 10 (4) - device rebuilding on solaris8 (4) -