系统管理指南:基本管理

引导基于 SPARC 的系统

如果系统已关闭,则将其打开即可启动多用户引导序列。以下过程说明如何从 ok PROM 提示符处引导至不同的运行级别。除非另行说明,否则这些过程假设系统已正常关闭。

使用 who -r 命令验证系统是否已进入指定的运行级别。有关运行级别的说明,请参见第 18 章

ProcedureSPARC: 如何将系统引导至运行级别 3(多用户级别)

使用此过程将当前处于运行级别 0 的系统引导至运行级别 3。

  1. 将系统引导至运行级别 3。


    ok boot
    

    自动引导过程会显示一系列的启动消息,并使系统进入运行级别 3。有关更多信息,请参见 boot(1M) 手册页。

  2. 确认系统已引导至运行级别 3。

    引导过程成功完成后,将显示登录提示。


    hostname console login:

示例 12–1 SPARC: 将系统引导至运行级别 3(多用户级别)

以下示例显示了将系统引导至运行级别 3 时出现的消息。


ok boot
Sun Ultra 5/10 UPA/PCI (UltraSPARC-IIi 333MHz)
OpenBoot 3.15, 128 MB memory installed, Serial #number.
Ethernet address number, Host ID: number.

Rebooting with command: boot
Boot device: /pci@1f,0/pci@1,1/ide@3/disk@0,0:a  File and args: kernel/sparcv9/unix
SunOS Release 5.10 Version s10_60 64-bit
Copyright 1983-2004 Sun Microsystems, Inc.  All rights reserved.
Use is subject to license terms.
configuring IPv4 interfaces: hme0.
add net default: gateway 172.20.27.248
Hostname: starlite
The system is coming up.  Please wait.
NIS domain name is example.com
starting rpc services: rpcbind keyserv ypbind done.
Setting netmask of hme0 to 255.255.255.0
Setting default IPv4 interface for multicast: add net 224.0/4: gateway starlite
syslog service starting.The system is ready.
Starting Sun(TM) Web Console Version 2.1-dev..
volume management starting.
The system is ready.
starlite console login: 

在前面的示例中,sparcv9 仅为一个示例。此字符串与 isainfo -k 命令的输出匹配。


ProcedureSPARC: 如何将系统引导至运行级别 S(单用户级别)

使用此过程可将当前位于运行级别 0 的系统引导至运行级别 S。此运行级别用于执行系统维护任务,例如,备份文件系统。

  1. 将系统引导至运行级别 S。


    ok boot -s
    
  2. 显示以下消息时键入超级用户口令:


    SINGLE USER MODE
    
    Root password for system maintenance (control-d to bypass): xxxxxx
    
  3. 确认系统处于运行级别 S。


    # who -r
    
  4. 执行将运行级别更改为 S 所需的维护任务。

  5. 完成系统维护任务之后,请按 Ctrl-D 组合键,使系统进入多用户状态。


示例 12–2 SPARC: 将系统引导至运行级别 S(单用户级别)

以下示例显示了将系统引导至运行级别 S 时出现的消息。


ok boot -s
.
.
.
Sun Microsystems Inc.   SunOS 5.10 Version Generic_120012-14 32-bit
Copyright 1983-2003 Sun Microsystems, Inc.  All rights reserved.
Use is subject to license terms.
configuring IPv4 interfaces: hme0.
Hostname: starlite

SINGLE USER MODE

Root password for system maintenance (control-d to bypass): xxxxxx
single-user privilege assigned to /dev/console.
Entering System Maintenance Mode
Oct 14 15:01:28 su: 'su root' succeeded for root on /dev/console
Sun Microsystems Inc.   SunOS 5.10
# who -r
   .       run-level S  Sep 19 08:49     S      0  ?
(Perform some maintenance task)
# ^D

ProcedureSPARC: 如何交互式地引导系统

需要指定替代内核或 /etc/system 文件时,请使用此引导选项。

开始之前

要在使用 boot -a 命令以交互方式引导基于 SPARC 的系统时指定备用的 /etc/system 文件,必须在引导系统之前执行以下步骤。

  1. 交互式地引导系统。


    ok boot -a
    
  2. 应答以下系统提示:

    1. 系统提示时,请输入要用于引导的内核名称。

      按 Enter 键使用缺省的内核文件名。否则,请提供替代内核的名称,然后按 Enter 键。

    2. 出现提示时,请提供 modules 目录的替代路径。

      按 Enter 键使用缺省的模块目录。否则,请提供模块目录的替代路径,然后按 Enter 键。

    3. 系统提示时,请提供替代系统文件的名称。

      如果 /etc/system 文件已损坏,请键入 /dev/null

    4. 出现提示时,输入 root 文件系统类型。

      按 Enter 键,选择 UFS 进行本地磁盘引导(缺省值),或者输入 NFS 采用网络引导。

    5. 系统提示时,请输入 root 设备的物理名称。

      提供替代的设备名称或按回车键以使用缺省值。

  3. 如果系统未提示回答这些问题,请验证是否正确键入了 boot -a 命令。


示例 12–3 SPARC: 交互式地引导系统

在以下示例中,接受了缺省选择(显示在方括号 [] 中)。有关使用 boot -a 命令引导备用文件系统的说明和示例,请参见SPARC: 如何交互式地引导系统


ok boot -a
.
.
.
Rebooting with command: boot -a
Boot device: /pci@1f,0/pci@1,1/ide@3/disk@0,0:a  
File and args: -a
Enter filename [kernel/sparcv9/unix]: Press Return
Enter default directory for modules [/platform/SUNW,Ultra-5_10/kernel 
     /platform/sun4u/kernel /kernel /usr/kernel]: Press Return
Name of system file [etc/system]: Press Return
SunOS Release 5.10 Version S10_60 64-bit
Copyright (c) 1983-2004 by Sun Microsystems, Inc. All rights reserved
Use is subject to license terms.
root filesystem type [ufs]: Press Return
Enter physical name of root device
[/pci@1f,0/pci@1,1/ide@3/disk@0,0:a]: Press Return
configuring IPv4 interfaces: hme0.
Hostname: starlite
The system is coming up.  Please wait.
checking ufs filesystems
.
.
.
The system is ready.
starlite console login:

ProcedureSPARC: 如何引导除缺省内核以外的内核

  1. 成为超级用户或同等角色。

    角色包含授权和具有一定权限的命令。有关角色的更多信息,请参见 《系统管理指南:安全性服务》中的“配置 RBAC(任务列表)”

  2. 获取现有 Oracle Solaris 内核的副本并将其重命名。

  3. 将您在步骤 2 中复制和重命名的内核添加到 /etc/boot/solaris/filelist.ramdisk 文件中。


    # echo "kernel.name" >> /boot/solaris/filelist.ramdisk
    
  4. 检验是否已将备用内核添加到 /etc/boot/solaris/filelist.ramdisk 文件中。


    # cat > /etc/boot/solaris/filelist.ramdisk
    
  5. 使用 bootadm 命令更新引导归档文件。


    # bootadm update-archive
    
  6. 更改为运行级别 0。


    # init 0
    

    此时将显示 ok PROM 提示符。

  7. 引导备用内核。


    ok boot alternate-kernel
    

    例如:


    ok boot kernel.myname/sparcv9/unix
    
    • 要在缺省情况下引导备用内核,请执行以下步骤:

      1. 将 boot-file 参数设置为新内核。


        ok setenv boot-file kernel.name/sparc9/unix
        
      2. 检验 boot-file 属性是否已更改。


        ok printenv boot-file
        
      3. 重新引导系统。


        ok boot
        
  8. 在引导系统后,检验是否已引导备用内核。


    # prtconf -vp | grep whoami
    

示例 12–4 通过更改缺省引导文件引导备用的内核


# cp -r /platform/sun4v/kernel /platform/sun4vu/kernel.caiobella
# echo "kernel.caiobela" >> /boot/solaris/filelist.ramdisk

# cat > /etc/boot/solaris/filelist.ramdisk
/platform/sun4v/kernel.caiobella
^D (control D)

ok setenv boot-file kernel.caiobells/sparcv9/unix
ok printenv boot-file
boot-file = kernel.caiobella/sparcv9/unix

ok boot

SC Alert: Host System has Reset

SC Alert: Host system has shut down.


Sun Fire T200, No KeyboardCopyright 2006 Sun Microsystems, Inc.  All rights reserved.
OpenBoot 4.25.0.build_01***PROTOTYPE BUILD***, 32760 MB memory available, Serial 
#69060038.
Ethernet address 0:x:4f:x:c5:c6, Host ID: 8xxc5c6.



Rebooting with command: boot
Boot device: /pci@7c0/pci@0/pci@1/pci@0,2/LSILogic,sas@2/disk@0,0:a  File and 
args: kernel.caiobella/sparcv9/unix
SunOS Release 5.10
Copyright 1983-2007 Sun Microsystems, Inc.  All rights reserved.
Use is subject to license terms.
DEBUG enabled
misc/forthdebug (176650 bytes) loaded
Hostname: seasonz
NIS domain name is lab.domain.sun.com
Reading ZFS config: done.

seasonz console login:
Password:
Last login: Mon Nov 12 18:02:00 on console
Sun Microsystems Inc.   SunOS 5.10
.
.
.
You have new mail.
#
#
# prtconf -vp | grep whoami
        whoami:  '/platform/sun4v/kernel.caiobella/sparcv9/unix'