Sunday, 21 October 2018

How to create an OBP boot device alias in Solaris [SPARC] By Devan

How to create an OBP boot device alias in Solaris [SPARC]

These aliases are created to simplify access to hardware devices at the OBP level. They can be used in place of the full OBP hardware path at the “ok” prompt. When viewed via the “devalias” command at the prom level, they are listed in the form of the alias name followed by the full hardware path to the device. There are 3 methods discussed in this post to create a boot device alias.

Method 1: Creating a custom boot device alias using show-disks and nvalias from the OpenBoot PROM (OBP) command line

While still booted to the Solaris Operating Environment, find the device path for the boot disk:
# df -lh /
# ls -l /dev/dsk/cxtxdxsx

Example

# df -lh /
Filesystem             size   used  avail capacity  Mounted on
/dev/dsk/c0t0d0s0       12G   5.1G   6.3G    45%    /
# ls -l /dev/dsk/c0t0d0s0
lrwxrwxrwx   1 root     root          41 Feb  1  2010 /dev/dsk/c0t0d0s0 -> ../../devices/pci@1f,4000/scsi@3/sd@0,0:a
Write down the entire physical path to be used for the alias.
Gracefully shutdown the system to the ok prompt:
# init 0
At the ok> prompt, use the show-disks command to view the available disks on the system and select the boot-device path that you wrote down in the first step. Note that the OBP translates the ‘sd’ part of the device path to ‘disk’.
ok>  show-disks
a) /ramdisk-root
b) /pci@1f,4000/scsi@3,1/disk
c) /pci@1f,4000/scsi@3/disk                                    <-- been="" c="" command="" control-y="" creating="" d="" devalias="" disk="" e.g.="" ebus="" enter="" f0="" f="" fdthree="" follow="" for="" has="" in="" insert="" is="" it="" line.="" mydev="" no="" nvalias="" ok="" path="" pci="" q="" quit:="" same="" scsi="" selected.="" selection="" steps="" the="" these="" this="" to="" type=""> nvalias newdisk /pci@1f,4000/scsi@3/disk@0,0:a              <-- a="" add="" manually="" pre="" the="">
Follow the prompts to use nvalias to create the new device alias and add the disk number and slice number from the device path (which you wrote down in the first step) to the end of the device path. e.g. In the example above, @0,0:a was added to the end of the path. Set the boot-device to the new device alias:
ok> setenv boot-device [alias-name]
ok> printenv boot-device
ok> reset-all

Example

ok> setenv boot-device newdisk
ok> printenv boot-device
boot-device = newdisk
ok> reset-all
Note: Custom device aliases will be retained in the OBP unless set-defaults (STOP-N) is used to reset the NVRAM to the default values or nvunalias is used to delete the custom device alias. To remove a custom device alias:
ok> nvunalias [aliasname]
ok> reset-all

Example

ok> nvunalias mydisk
ok> reset-all

Method 2: Creating a boot alias using nvedit

Use the NVRAM editor (nvedit) to create a script that will create the boot alias at reset:
ok> nvedit
0: devalias newdisk /pci@1d,700000/scsi@4/sd@0,0:a
^c (control c)
ok nvstore
ok setenv use-nvramrc? true
ok reset
Note: The 0: in the example above is the line number from nvedit, do not type it as part of your device alias.
Set the boot-device to the new device alias:
ok> setenv boot-device [alias-name]
ok> printenv boot-device
ok> reset-all

Example

ok> setenv boot-device newdisk
ok> printenv boot-device
boot-device = newdisk
ok> reset-all

Method 3: Viewing and using existing device aliases provided in the OpenBoot PROM

Use the devalias command to identify the default device aliases:
ok> devalias
disk5 /pci@1f,4000/scsi@3/disk@c,0
disk4 /pci@1f,4000/scsi@3/disk@b,0
disk3 /pci@1f,4000/scsi@3/disk@a,0
disk2 /pci@1f,4000/scsi@3/disk@9,0
disk1 /pci@1f,4000/scsi@3/disk@8,0
disk0 /pci@1f,4000/scsi@3/disk@0,0    <--- alias="" disk0="" disk="" f="" is="" path="" pci="" pre="" same="" scsi="" the="">
Identify the boot disk path in the above output and set the boot-device to that alias:
ok> setenv boot-device [alias-name]
ok> printenv boot-device
ok> reset-all

Example

ok> setenv boot-device disk0
ok> printenv boot-device
boot-device = disk0
ok> reset-all

No comments:

Post a Comment