为了支持在 x86 平台上引导 Oracle Solaris ZFS 根文件系统,已引入了一个新的 GRUB 关键字 $ZFS-BOOTFS。如果根设备包含 ZFS 池,则会为此关键字分配一个值,然后使用 -B 选项将该值传递给内核。此选项标识要引导的数据集。如果您使用支持 ZFS 引导装载器的 Oracle Solaris 发行版来安装或升级您的系统,则在缺省情况下,GRUB menu.lst 文件和 GRUB 引导菜单将包含此信息。
成为超级用户或同等角色。
角色包含授权和具有一定权限的命令。有关角色的更多信息,请参见 《系统管理指南:安全性服务》中的“配置 RBAC(任务列表)”。
要显示系统中可用 BE 的列表,请键入以下命令:
~# bootadm list-menu |
# lustatus |
请注意,也可以在基于 SPARC 的系统上使用 lustatus 命令。
如果在运行 lustatus 命令时显示以下错误,则表明执行了全新安装,而没有使用 Solaris Live Upgrade。必须先在系统中创建新的 BE,然后才能在 lustatus 输出中确认任何 BE。
# lustatus ERROR: No boot environments are configured on this system ERROR: cannot determine list of all boot environment names |
有关使用 Solaris Live Upgrade 将 UFS 根文件系统迁移到 ZFS 根文件系统的更多信息,请参见 《Oracle Solaris ZFS 管理指南》中的“将 UFS 根文件系统迁移到 ZFS 根文件系统 (Oracle Solaris Live Upgrade)”。
在以下示例中,lustatus 命令的输出显示了三个 ZFS 可引导数据集的状态。缺省的引导环境是 be1,因而无法将其删除。
# lustatus Boot Environment Is Active Active Can Copy Name Complete Now On Reboot Delete Status -------------------------- -------- ------ --------- ------ ---------- s10s_nbu6wos yes no no yes - zfs2BE yes yes yes no - zfsbe3 no no no yes - # |
如果该 BE 已创建且可引导,则 Is Complete 列中会显示 "yes"。如果某个 BE 已创建但尚未激活,则此列中会显示 "no"。要激活某个 BE,请使用 luactivate 命令。之后,可以运行 lustatus 命令以检验是否已成功激活该 BE。
有关更多信息,请参见 lustatus(1M) 和 luactivate(1M) 手册页。
以下过程介绍如何在支持 ZFS 引导装载器的 x86 系统上从 ZFS 根文件系统引导。
请注意,如果您安装支持 ZFS 引导装载器的 Oracle Solaris 发行版或将您的系统升级至该发行版,则在缺省情况下,GRUB 菜单项包含 -B $ZFS-BOOTFS 引导参数,因此,系统无需任何其他引导参数即可从 ZFS 引导。
重新引导系统。
# reboot |
如果系统显示 Press any key to reboot 提示,请按任意键以重新引导系统。
在出现此提示时,您还可以使用“重置”按钮。如果系统已关闭,请使用电源开关打开系统。
引导序列开始时,将显示 GRUB 主菜单。如果缺省引导项是 ZFS 文件系统,则菜单将类似如下:
GNU GRUB version 0.95 (637K lower / 3144640K upper memory) +----------------------------------------------------------------+ | be1 | be1 failsafe | be3 | be3 failsafe | be2 | be2 failfafe +---------------------------------------------------------------+ Use the ^ and v keys to select which entry is highlighted. Press enter to boot the selected OS, 'e' to edit the commands before booting, or 'c' for a command-line. |
显示 GRUB 菜单后,请按 Enter 键引导缺省的操作系统实例。
如果在 10 秒内未选择项,系统会自动引导至运行级别 3。
要引导其他 BE,请使用方向键突出显示指定的引导项。
键入 b 引导此项,或键入 e 编辑此项。
有关引导时 GRUB 菜单项的更多信息,请参见 x86: 如何通过在引导时编辑 GRUB 菜单修改引导行为。
以下示例显示了在系统中激活引导环境 be10 所要执行的步骤。请注意,要首先运行 lustatus,以确定系统中哪些 BE 是活动的,以及哪些 BE 需要激活。
# lustatus Boot Environment Is Active Active Can Copy Name Complete Now On Reboot Delete Status ----------------------------------------------------------------- be1 yes yes yes no be10 yes no no yes # luactivate be10 System has findroot enabled GRUB Generating boot-sign, partition and slice information for PBE <be1> WARNING: The following file s have change on both the current boot environment <be1> zone <global> and the boot environment to be activitate <be10> /etc/zfs/zpool.cache INFORMATION: The files listed above are in conflict between the current boot environment <be1> zone <global> and the boot environment to be activated <be10>. These files will not be automatically synchronized from the current boot environment <be1> when boot environment <be10> is activated. Setting failsafe console to <ttyb> Generating boot-sign for ABE <be10> Generating partition and slice information for ABE <be10> Copied boot menu from top level dataset. Generating direct boot menu entries for PBE. Generating direct boot menu entries for ABE. Disabling splashimage Current GRUB menu default setting is not valid title Solaris bootenv rc No more bootadm entries. Deletion of bootadm entries is complete. GRUB menu default setting is unchanged Done eliding bootadm entries. ************************************************************** The target boot environment has been activated. It will be used when you reboot. NOTE: You MUST NOT USE the reboot, halt, or uadmin commands. You MUST USE either the init or the shutdown command when you reboot. If you do not use either init or shutdown, the system will not boot using the target BE. *************************************************************** ,,, # reboot May 30 09:52:32 pups reboot: initiated by root on /dev/console syncing file systems... done rebooting... CE SDRAM BIOS P/N GR-xlint.007-4.330 * BIOS Lan-Console 2.0 Copyright (C) 1999-2001 Intel Corporation . . . GNU GRUB version 0.95 (637K lower / 3144640K upper memory) +-------------------------------------------------------------------+ | be1 | be1 failsafe | be10 | be10 failsafe +------------------------------------------------------------------+ Use the ^ and v keys to select which entry is highlighted. Press enter to boot the selected OS, 'e' to edit the commands before booting, or 'c' for a command-line. SunOS Release 5.10 32-bit Copyright 1983-2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Hostname: pups NIS domain name is sunsoft.eng.sun.com Reading ZFS config: done. Mounting ZFS filesystems: (8/8) pups console login: # lustatus Boot Environment Is Active Active Can Copy Name Complete Now On Reboot Delete Status ----------------------------------------------------------------- be1 yes yes yes no be10 yes yes yes no # |