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

    This entry was posted on Wednesday, December 21st, 2005 at 1:58 pm and is filed under Data and Technology. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
  • 10 Comments

    Take a look at some of the responses we've had to this article.

    1. [...] 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
      Jul 23rd
      Reply

      Shouldn’t


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

      be


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

    3. A Braunsdorf
      Aug 16th
      Reply

      /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
      Aug 21st
      Reply

      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
      Aug 21st
      Reply

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

      Jay

    6. Robert Sturrock
      Dec 21st
      Reply

      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. [...] 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
      May 7th
      Reply

      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.

    9. [...] 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 [...]

    10. Stefan
      Jan 28th
      Reply

      To rebuild the path_to_inst file you can move the old /etc/path_to_inst to /etc/path_to_inst_old and in the bootpromt ok> type boot -ar then you will be asked to rebuild the path_to_inst
      Best regards
      Stefan

  • Leave a Reply

    Let us know what you thought.

  • Name (required):

    Email (required):

    Website:

    Message:

Visitors have tagged this post: solaris path_to_inst (400) - rebuild path_to_inst (285) - t (271) - solaris rebuild device tree (202) - solaris rebuild path_to_inst (165) - solaris device tree (157) - solaris rebuild devices (152) - path_to_inst rebuild (146) - rebuilding path_to_inst (109) - devfsadm solaris 10 (107) - rebuild path_to_inst solaris 10 (90) - rebuild device tree solaris (90) - solaris 10 devfsadm (90) - solaris rebuild /dev (79) - rebuild solaris device tree (75) - "path_to_inst" solaris (72) - solaris 10 path_to_inst (64) - path_to_inst solaris 10 (58) - rebuild device tree (53) - solaris 10 rebuild device tree (50) - solaris 10 rebuild path_to_inst (49) - "solaris 10 " path_to_inst (42) - device tree solaris (39) - solaris rebuild device (38) - rebuild /devices solaris (38) - path_to_inst solaris (38) - "solaris 10" devfsadm (37) - rebuild path_to_inst solaris (37) - solaris remove disk (30) - "solaris 10" rebuild path_to_inst (30) - rebuild device tree solaris 10 (30) - devfsadm path_to_inst (30) - solaris devfsadm (26) - rebuild /dev solaris (26) - f (26) - spiralbound net (25) - solaris 10 rebuild devices (24) - solaris devices (22) - rebuild /etc/path_to_inst (22) - rebuilding solaris device tree (22) - solaris 8 path_to_inst (22) - solaris remove device (21) - Rebuilding the Solaris Device tree (20) - how to rebuild path_to_inst (20) - Solaris path_to_inst rebuild (20) - target (20) - solaris remove devices (19) - device (18) - Solaris /etc/path_to_inst (18) - remove device solaris (18) - etc path_to_inst solaris (18) - solaris (17) - solaris 9 rebuild device tree (17) - rebuild /devices (17) - rebuild devices solaris 10 (17) - all (16) - solaris 8 rebuild path_to_inst (16) - solaris device (16) - devfsadm cdrom rebuild (16) - delete path_to_inst (15) - Solaris device naming (14) - rebuild the solaris device tree (14) - rebuild solaris devices (14) - Solaris rebuild /dev/rmt (14) - devfsadm rebuild path_to_inst (14) - solaris 10 device tree (14) - devfsadm cdrom (14) - rebuild path_to_inst Solaris 8 (13) - rebuilding device tree (13) - solaris 10 rebuild dev (13) - Solaris /dev/cfg (13) - solaris change boot device (12) - path_to_inst (12) - rebuild path_to_inst devfsadm (12) - solaris 10 cdrom device (12) - solaris rebuild kernel (12) - device tree in Solaris (12) - Solaris device rebuild (12) - path_to_inst solaris 8 (12) - solaris 10 remove devices (12) - boot cdrom solaris (11) - rebuild solaris kernel (11) - solaris 10 cdrom device name (11) - rebuild device Solaris (11) - solaris devfsadm path_to_inst (11) - solaris 10 devfsadm path_to_inst (11) - path_to_inst in solaris (11) - devfsadm +solaris (10) - rebuild vfstab (10) - Rebuild /dev/rmt (10) - solaris 10 path_to_inst rebuild (10) - solaris 9 rebuild path_to_inst (10) - solaris rebuild (10) - path_to_inst rebuild solaris 10 (10) - rebuild solaris path_to_inst (10) - solaris devices tree (10) - remove devices solaris (10) - solaris find cdrom device (9) - mount cdrom solaris 8 (9) - solaris 10 mount cdrom (9) - solaris remove path_to_inst (9) - rebuild solaris device (9) - solaris +rebuilding "device tree" (9) - solaris rebuilding path_to_inst (9) - /devices solaris (9) - "devfsadm -R" (9) - devfsadm solaris10 (9) - rebuild path_to_inst Solaris 10 x86 (9) - solaris rebuild device files (9) - Solaris Cannot find /devices (9) - Solaris rebuild /devices (9) - device tree (8) - rebuilding /dev solaris (8) - rebuilding /etc/path_to_inst (8) - solaris disk device names (8) - path_to_inst on solaris (8) - solaris 10 remove device (8) - solaris 8 cdrom device (8) - solaris rebuild /dev/dsk (8) - rebuild the device tree solaris (8) - solaris rebuild dev (8) - solaris :boot -ar (7) - rebuild path_to_inst file (7) - path_to_inst devfsadm (7) - solaris rebuilding dev (7) - remove disk solaris (7) - solaris "cdrom device" (7) - rebuild path_to_inst solaris 9 (7) - solaris kernel rebuild (7) - solaris delete path_to_inst (7) - rebuilding the device tree (7) - Rebuilding device tree Solaris 10 (7) - solaris device tree rebuild (7) - remove path_to_inst (7) - devfsadm solaris 9 (7) - rebuild devices solaris (7) - rebuild devices (7) - Can't stat /dev/rdsk/c1t0d0s0 (7) - solaris 8 rebuild devices (7) - /etc/path_to_inst (6) - solaris /dev /devices (6) - solaris boot path_to_inst (6) - solaris device links (6) - rebuild device tree in solaris (6) - solaris 8 rebuild device tree (6) - solaris delete /devices (6) - rebuilt path_to_inst (6) - rebuild "/dev" (6) - device tree rebuild (6) - rebuilding devices solaris (6) -