Oracle Solaris ZFS 管理指南

将 UFS 根文件系统迁移到 ZFS 根文件系统 (Oracle Solaris Live Upgrade)

与 UFS 组件相关的 Oracle Solaris Live Upgrade 功能仍然可用,并且其工作方式与在先前的 Solaris 发行版中一样。

另外还提供了下列功能:

有关 Oracle Solaris 安装和 Oracle Solaris Live Upgrade 功能的详细信息,请参见《Oracle Solaris 10 9/10 安装指南:Solaris Live 升级和升级规划》

将 UFS 根文件系统迁移到 ZFS 根文件系统的基本过程如下:

有关 ZFS 和 Oracle Solaris Live Upgrade 要求的信息,请参见ZFS 支持对于 Oracle Solaris 安装和 Oracle Solaris Live Upgrade 的要求

Oracle Solaris Live Upgrade 的 ZFS 迁移问题

使用 Oracle Solaris Live Upgrade 将 UFS 根文件系统迁移到 ZFS 根文件系统之前,请查看以下问题:

使用 Oracle Solaris Live Upgrade 迁移到 ZFS 根文件系统(没有区域)

以下示例说明如何将 UFS 根文件系统迁移到 ZFS 根文件系统。

如果要迁移或更新具有区域的系统,请参见以下各节:


示例 5–3 使用 Oracle Solaris Live Upgrade 将 UFS 根文件系统迁移到 ZFS 根文件系统

以下示例说明如何从 UFS 根文件系统创建 ZFS 根文件系统的 BE。包含 UFS 根文件系统的当前 BE ufsBE-c 选项标识。如果不包括可选的 -c 选项,则当前 BE 名称将缺省为设备名称。新 BE zfsBE-n 选项标识。在执行 lucreate 操作之前,ZFS 存储池必须存在。

必须使用片而不是整个磁盘创建 ZFS 存储池,才能使 ZFS 存储池可升级和可引导。创建新池之前,请确保要用于池中的磁盘具有 SMI (VTOC) 标签而不是 EFI 标签。如果使用 SMI 标签重新标记磁盘,请确保标记过程未更改分区方案。在大多数情况下,所有磁盘容量应位于打算用于根池的片中。


# zpool create rpool mirror c1t2d0s0 c2t1d0s0
# lucreate -c ufsBE -n zfsBE -p rpool
Analyzing system configuration.
No name for current boot environment.
Current boot environment is named <ufsBE>.
Creating initial configuration for primary boot environment <ufsBE>.
The device </dev/dsk/c1t0d0s0> is not a root device for any boot environment; cannot get BE ID.
PBE configuration successful: PBE name <ufsBE> PBE Boot Device </dev/dsk/c1t0d0s0>.
Comparing source boot environment <ufsBE> file systems with the file 
system(s) you specified for the new boot environment. Determining which 
file systems should be in the new boot environment.
Updating boot environment description database on all BEs.
Updating system configuration files.
The device </dev/dsk/c1t2d0s0> is not a root device for any boot environment; cannot get BE ID.
Creating configuration for boot environment <zfsBE>.
Source boot environment is <ufsBE>.
Creating boot environment <zfsBE>.
Creating file systems on boot environment <zfsBE>.
Creating <zfs> file system for </> in zone <global> on <rpool/ROOT/zfsBE>.
Populating file systems on boot environment <zfsBE>.
Checking selection integrity.
Integrity check OK.
Populating contents of mount point </>.
Copying.
Creating shared file system mount points.
Creating compare databases for boot environment <zfsBE>.
Creating compare database for file system </rpool/ROOT>.
Creating compare database for file system </>.
Updating compare databases on boot environment <zfsBE>.
Making boot environment <zfsBE> bootable.
Creating boot_archive for /.alt.tmp.b-qD.mnt
updating /.alt.tmp.b-qD.mnt/platform/sun4u/boot_archive
Population of boot environment <zfsBE> successful.
Creation of boot environment <zfsBE> successful.

lucreate 操作完成后,使用 lustatus 命令查看 BE 状态。例如:


# lustatus
Boot Environment           Is       Active Active    Can    Copy      
Name                       Complete Now    On Reboot Delete Status    
-------------------------- -------- ------ --------- ------ ----------
ufsBE                      yes      yes    yes       no     -         
zfsBE                      yes      no     no        yes    -         

然后,查看 ZFS 组件列表。例如:


# zfs list
NAME                   USED  AVAIL  REFER  MOUNTPOINT
rpool                 7.17G  59.8G  95.5K  /rpool
rpool/ROOT            4.66G  59.8G    21K  /rpool/ROOT
rpool/ROOT/zfsBE      4.66G  59.8G  4.66G  /
rpool/dump               2G  61.8G    16K  -
rpool/swap             517M  60.3G    16K  -

接下来,使用 luactivate 命令激活新 ZFS BE。例如:


# luactivate zfsBE
A Live Upgrade Sync operation will be performed on startup of boot environment <zfsBE>.

**********************************************************************

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.

**********************************************************************
.
.
.
Modifying boot archive service
Activation of boot environment <zfsBE> successful.

接下来,将系统重新引导至 ZFS BE。


# init 6

确认 ZFS BE 是否处于活动状态。


# lustatus
Boot Environment           Is       Active Active    Can    Copy      
Name                       Complete Now    On Reboot Delete Status    
-------------------------- -------- ------ --------- ------ ----------
ufsBE                      yes      no     no        yes    -         
zfsBE                      yes      yes    yes       no     -      

如果切换回 UFS BE,必须重新导入在引导 ZFS BE 时创建的所有 ZFS 存储池,因为它们在 UFS BE 中不会自动可用。

如果不再需要 UFS BE,可以使用 ludelete 命令将其删除。



示例 5–4 使用 Oracle Solaris Live Upgrade 从 ZFS BE 中创建 ZFS BE

在同一池中从 ZFS BE 创建 ZFS BE 非常快捷,因为该操作使用 ZFS 快照和克隆功能。如果当前 BE 驻留在同一 ZFS 池上,则可以省略 -p 选项。

如果有多个 ZFS BE,请执行以下操作来选择从哪个 BE 引导:

有关更多信息,请参见示例 5–9


# lucreate -n zfs2BE
Analyzing system configuration.
No name for current boot environment.
INFORMATION: The current boot environment is not named - assigning name <zfsBE>.
Current boot environment is named <zfsBE>.
Creating initial configuration for primary boot environment <zfsBE>.
The device </dev/dsk/c1t0d0s0> is not a root device for any boot environment; cannot get BE ID.
PBE configuration successful: PBE name <zfsBE> PBE Boot Device </dev/dsk/c1t0d0s0>.
Comparing source boot environment <zfsBE> file systems with the file 
system(s) you specified for the new boot environment. Determining which 
file systems should be in the new boot environment.
Updating boot environment description database on all BEs.
Updating system configuration files.
Creating configuration for boot environment <zfs2BE>.
Source boot environment is <zfsBE>.
Creating boot environment <zfs2BE>.
Cloning file systems from boot environment <zfsBE> to create boot environment <zfs2BE>.
Creating snapshot for <rpool/ROOT/zfsBE> on <rpool/ROOT/zfsBE@zfs2BE>.
Creating clone for <rpool/ROOT/zfsBE@zfs2BE> on <rpool/ROOT/zfs2BE>.
Setting canmount=noauto for </> in zone <global> on <rpool/ROOT/zfs2BE>.
Population of boot environment <zfs2BE> successful.
Creation of boot environment <zfs2BE> successful.


示例 5–5 升级 ZFS BE (luupgrade)

您可以使用其他软件包或修补程序升级 ZFS BE。

基本过程如下:


# lustatus
Boot Environment           Is       Active Active    Can    Copy      
Name                       Complete Now    On Reboot Delete Status    
-------------------------- -------- ------ --------- ------ ----------
zfsBE                      yes      no     no        yes    -         
zfs2BE                     yes      yes    yes       no     -   
# luupgrade -p -n zfsBE -s /net/system/export/s10up/Solaris_10/Product SUNWchxge
Validating the contents of the media </net/install/export/s10up/Solaris_10/Product>.
Mounting the BE <zfsBE>.
Adding packages to the BE <zfsBE>.

Processing package instance <SUNWchxge> from </net/install/export/s10up/Solaris_10/Product>

Chelsio N110 10GE NIC Driver(sparc) 11.10.0,REV=2006.02.15.20.41
Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.

This appears to be an attempt to install the same architecture and
version of a package which is already installed.  This installation
will attempt to overwrite this package.

Using </a> as the package base directory.
## Processing package information.
## Processing system information.
   4 package pathnames are already properly installed.
## Verifying package dependencies.
## Verifying disk space requirements.
## Checking for conflicts with packages already installed.
## Checking for setuid/setgid programs.

This package contains scripts which will be executed with super-user
permission during the process of installing this package.

Do you want to continue with the installation of <SUNWchxge> [y,n,?] y
Installing Chelsio N110 10GE NIC Driver as <SUNWchxge>

## Installing part 1 of 1.
## Executing postinstall script.

Installation of <SUNWchxge> was successful.
Unmounting the BE <zfsBE>.
The package add to the BE <zfsBE> completed.

使用 Oracle Solaris Live Upgrade 迁移或升级具有区域的系统 (Solaris 10 10/08)

可以使用 Oracle Solaris Live Upgrade 迁移具有区域的系统,但在 Solaris 10 10/08 发行版中支持的配置有限。如果安装或升级到最低 Solaris 10 5/09 发行版,可支持更多区域配置。有关更多信息,请参见使用 Oracle Solaris Live Upgrade 迁移或升级具有区域的系统(最低Solaris 10 5/09)

本节介绍如何配置和安装具有区域的系统,以便使用 Oracle Solaris Live Upgrade 升级和修补该系统。如果要迁移到没有区域的 ZFS 根文件系统,请参见使用 Oracle Solaris Live Upgrade 迁移到 ZFS 根文件系统(没有区域)

如果要在 Solaris 10 10/08 发行版中迁移具有区域的系统或配置具有区域的系统,请查看以下过程:

按照建议的过程在具有 ZFS 根文件系统的系统上设置区域,以确保可以在该系统上使用 Oracle Solaris Live Upgrade。

Procedure如何将 UFS 上具有区域根的 UFS 根文件系统迁移到 ZFS 根文件系统 (Solaris 10 10/08)

此过程解释如何将安装了区域的 UFS 根文件系统迁移到 ZFS 根文件系统,以及如何升级或修补的 ZFS 区域根配置。

在后面的步骤中,示例池名称为 rpool,活动引导环境的示例名称为 s10BE*

  1. 如果系统正在运行先前的 Solaris 10 发行版,请将其升级到 Solaris 10 10/08 发行版。

    有关对运行 Solaris 10 发行版的系统进行升级的更多信息,请参见《Oracle Solaris 10 9/10 安装指南:Solaris Live 升级和升级规划》

  2. 创建根池。


    # zpool create rpool mirror c0t1d0 c1t1d0
    

    有关根池要求的信息,请参见ZFS 支持对于 Oracle Solaris 安装和 Oracle Solaris Live Upgrade 的要求

  3. 确认已引导 UFS 环境中的区域。

  4. 创建新 ZFS 引导环境。


    # lucreate -n s10BE2 -p rpool
    

    此命令将为新引导环境在根池中建立数据集并将当前引导环境(包括区域)复制到这些数据集。

  5. 激活新 ZFS 引导环境。


    # luactivate s10BE2
    

    现在,系统正在运行 ZFS 根文件系统,但 UFS 上的区域根仍在 UFS 根文件系统中。需要执行后续步骤将 UFS 区域完全迁移到支持的 ZFS 配置。

  6. 重新引导系统。


    # init 6
    
  7. 将区域迁移到 ZFS BE。

    1. 引导区域。

    2. 在池中创建另一个 ZFS BE。


      # lucreate s10BE3
      
    3. 激活新引导环境。


      # luactivate s10BE3
      
    4. 重新引导系统。


      # init 6
      

      此步骤用于验证是否已引导 ZFS BE 和区域。

  8. 解决任何潜在的挂载点问题。

    由于 Oracle Solaris Live Upgrade 中的错误,非活动引导环境可能无法引导,因为引导环境中的 ZFS 数据集或区域的 ZFS 数据集有无效的挂载点。

    1. 查看 zfs list 输出。

      查找不正确的临时挂载点。例如:


      # zfs list -r -o name,mountpoint rpool/ROOT/s10u6
      
      NAME                               MOUNTPOINT
      rpool/ROOT/s10u6                   /.alt.tmp.b-VP.mnt/
      rpool/ROOT/s10u6/zones             /.alt.tmp.b-VP.mnt//zones
      rpool/ROOT/s10u6/zones/zonerootA   /.alt.tmp.b-VP.mnt/zones/zonerootA

      根 ZFS BE (rpool/ROOT/s10u6) 的挂载点应为 /

    2. 重置 ZFS BE 及其数据集的挂载点。

      例如:


      # zfs inherit -r mountpoint rpool/ROOT/s10u6
      # zfs set mountpoint=/ rpool/ROOT/s10u6
      
    3. 重新引导系统。

      当提供选项来引导特定的引导环境时(在 GRUB 菜单中或 OpenBoot PROM 提示符下),请选择刚刚更正其挂载点的引导环境。

Procedure如何配置 ZFS 上具有区域根的 ZFS 根文件系统 (Solaris 10 10/08)

此过程解释如何设置 ZFS 根文件系统和可以进行升级或修补的 ZFS 区域根配置。在此配置中,ZFS 区域根创建为 ZFS 数据集。

在后面的步骤中,示例池名称为 rpool,活动引导环境的示例名称为 s10BE。区域数据集的名称可以为任何合法的数据集名称。在以下示例中,区域数据集名称为 zones

  1. 使用 Solaris 交互式文本安装程序或 Solaris JumpStart 安装方法安装具有 ZFS 根的系统。

    有关使用初始安装方法或 Solaris JumpStart 方法安装 ZFS 根文件系统的信息,请参见安装 ZFS 根文件系统(初始安装)安装 ZFS 根文件系统(Oracle Solaris JumpStart 安装)

  2. 从新创建的根池引导系统。

  3. 创建数据集以用于对区域根进行分组。

    例如:


    # zfs create -o canmount=noauto rpool/ROOT/s10BE/zones
    

    canmount 属性的值设置为 noauto 可防止通过 Oracle Solaris Live Upgrade 显式操作和系统启动代码以外的其他方式挂载数据集。

  4. 挂载新创建的区域数据集。


    # zfs mount rpool/ROOT/s10BE/zones
    

    数据集挂载在 /zones

  5. 为每个区域根创建并挂载数据集。


    # zfs create -o canmount=noauto rpool/ROOT/s10BE/zones/zonerootA
    # zfs mount rpool/ROOT/s10BE/zones/zonerootA
    
  6. 在区域根目录上设置适当的权限。


    # chmod 700 /zones/zonerootA
    
  7. 配置区域,如下所示设置区域路径:


    # zonecfg -z zoneA
        zoneA: No such zone configured
        Use 'create' to begin configuring a new zone.
        zonecfg:zoneA> create
        zonecfg:zoneA> set zonepath=/zones/zonerootA
    

    可通过使用以下语法在引导系统时自动引导区域:


    zonecfg:zoneA> set autoboot=true
    
  8. 安装区域。


    # zoneadm -z zoneA install
    
  9. 引导区域。


    # zoneadm -z zoneA boot
    

Procedure如何升级或修补 ZFS 上具有区域根的 ZFS 根文件系统 (Solaris 10 10/08)

当您需要升级或修补 ZFS 上具有区域根的 ZFS 根文件系统时,请使用此过程。这些更新可以是对系统进行升级,也可以是应用一些修补程序。

在后面的步骤中,newBE 为升级或修补的引导环境的示例名称。

  1. 创建引导环境以进行升级或修补。


    # lucreate -n newBE
    

    将克隆现有引导环境,包括所有区域。将为原始引导环境中的每个数据集创建一个数据集。将在与当前根池相同的池中创建新数据集。

  2. 选择以下操作之一来升级系统或将修补程序应用到新引导环境:

    • 升级系统。


      # luupgrade -u -n newBE -s /net/install/export/s10u7/latest
      

      其中 -s 选项指定 Solaris 安装介质的位置。

    • 将修补程序应用到新引导环境。


       # luupgrade -t -n newBE -t -s /patchdir 139147-02 157347-14
      
  3. 激活新引导环境。


    # luactivate newBE
    
  4. 从新激活的引导环境引导。


    # init 6
    
  5. 解决任何潜在的挂载点问题。

    由于 Oracle Solaris Live Upgrade 功能中的错误,非活动引导环境可能无法引导,因为引导环境中的 ZFS 数据集或区域的 ZFS 数据集有无效的挂载点。

    1. 查看 zfs list 输出。

      查找不正确的临时挂载点。例如:


      # zfs list -r -o name,mountpoint rpool/ROOT/newBE
      
      NAME                               MOUNTPOINT
      rpool/ROOT/newBE                   /.alt.tmp.b-VP.mnt/
      rpool/ROOT/newBE/zones             /.alt.tmp.b-VP.mnt/zones
      rpool/ROOT/newBE/zones/zonerootA   /.alt.tmp.b-VP.mnt/zones/zonerootA

      根 ZFS BE (rpool/ROOT/newBE) 的挂载点应为 /

    2. 重置 ZFS BE 及其数据集的挂载点。

      例如:


      # zfs inherit -r mountpoint rpool/ROOT/newBE
      # zfs set mountpoint=/ rpool/ROOT/newBE
      
    3. 重新引导系统。

      当提供选项来引导特定的引导环境时(在 GRUB 菜单中或 OpenBoot PROM 提示符下),请选择刚刚更正其挂载点的引导环境。

使用 Oracle Solaris Live Upgrade 迁移或升级具有区域的系统(最低Solaris 10 5/09)

从 Solaris 10 10/08 发行版开始,您可以使用 Oracle Solaris Live Upgrade 功能迁移或升级具有区域的系统。从 Solaris 10 5/09 发行版开始,Live Upgrade 支持更多稀疏根和完全根区域配置。

本节介绍从 Solaris 10 5/09 发行版开始,如何配置具有区域的系统,以便使用 Oracle Solaris Live Upgrade 升级和修补该系统。如果要迁移到没有区域的 ZFS 根文件系统,请参见使用 Oracle Solaris Live Upgrade 迁移到 ZFS 根文件系统(没有区域)

从 Solaris 10 5/09 发行版开始,对 ZFS 和区域使用 Oracle Solaris Live Upgrade 时,请考虑以下几点:

从 Solaris 10 5/09 发行版开始,如果您要迁移或配置具有区域的系统,请查看以下信息:

支持的 ZFS 和区域根配置信息(最低 Solaris 10 5/09)

在使用 Oracle Solaris Live Upgrade 迁移或升级具有区域的系统之前,需要先查看支持的区域配置。

Procedure如何创建具有 ZFS 根文件系统和区域根的 ZFS BE(最低 Solaris 10 5/09)

执行最低 Solaris 10 5/09 发行版的初始安装之后,使用此过程创建 ZFS 根文件系统。使用 luupgrade 功能将 ZFS 根文件系统升级到最低 Solaris 10 5/09 发行版之后,也可以使用此过程。然后,可以升级或修补使用此过程创建的 ZFS BE。

在后面的步骤中,Oracle Solaris 10 9/10 示例系统在 /rpool/zones 中具有 ZFS 根文件系统和区域根数据集。将创建名为 zfs2BE 的 ZFS BE,然后可以对其进行升级或修补。

  1. 查看现有的 ZFS 文件系统。


    # zfs list
    NAME                   USED  AVAIL  REFER  MOUNTPOINT
    rpool                 7.26G  59.7G    98K  /rpool
    rpool/ROOT            4.64G  59.7G    21K  legacy
    rpool/ROOT/zfsBE      4.64G  59.7G  4.64G  /
    rpool/dump            1.00G  59.7G  1.00G  -
    rpool/export            44K  59.7G    23K  /export
    rpool/export/home       21K  59.7G    21K  /export/home
    rpool/swap               1G  60.7G    16K  -
    rpool/zones            633M  59.7G   633M  /rpool/zones
  2. 确保安装和引导了区域。


    # zoneadm list -cv
      ID NAME             STATUS     PATH                           BRAND    IP    
       0 global           running    /                              native   shared
       2 zfszone          running    /rpool/zones                   native   shared
  3. 创建 ZFS BE。


    # lucreate -n zfs2BE
    Analyzing system configuration.
    No name for current boot environment.
    INFORMATION: The current boot environment is not named - assigning name <zfsBE>.
    Current boot environment is named <zfsBE>.
    Creating initial configuration for primary boot environment <zfsBE>.
    The device </dev/dsk/c1t0d0s0> is not a root device for any boot environment; cannot get BE ID.
    PBE configuration successful: PBE name <zfsBE> PBE Boot Device </dev/dsk/c1t0d0s0>.
    Comparing source boot environment <zfsBE> file systems with the file 
    system(s) you specified for the new boot environment. Determining which 
    file systems should be in the new boot environment.
    Updating boot environment description database on all BEs.
    Updating system configuration files.
    Creating configuration for boot environment <zfs2BE>.
    Source boot environment is <zfsBE>.
    Creating boot environment <zfs2BE>.
    Cloning file systems from boot environment <zfsBE> to create boot environment <zfs2BE>.
    Creating snapshot for <rpool/ROOT/zfsBE> on <rpool/ROOT/zfsBE@zfs2BE>.
    Creating clone for <rpool/ROOT/zfsBE@zfs2BE> on <rpool/ROOT/zfs2BE>.
    Setting canmount=noauto for </> in zone <global> on <rpool/ROOT/zfs2BE>.
    Population of boot environment <zfs2BE> successful.
    Creation of boot environment <zfs2BE> successful.
  4. 激活 ZFS BE。


    # lustatus
    Boot Environment           Is       Active Active    Can    Copy      
    Name                       Complete Now    On Reboot Delete Status    
    -------------------------- -------- ------ --------- ------ ----------
    zfsBE                      yes      yes    yes       no     -         
    zfs2BE                     yes      no     no        yes    -         
    # luactivate zfs2BE
    A Live Upgrade Sync operation will be performed on startup of boot environment <zfs2BE>.
    .
    .
    .
    # init 6
    
  5. 确认在新 BE 中创建了 ZFS 文件系统和区域。


    # zfs list
    NAME                               USED  AVAIL  REFER  MOUNTPOINT
    rpool                             7.38G  59.6G    98K  /rpool
    rpool/ROOT                        4.72G  59.6G    21K  legacy
    rpool/ROOT/zfs2BE                 4.72G  59.6G  4.64G  /
    rpool/ROOT/zfs2BE@zfs2BE          74.0M      -  4.64G  -
    rpool/ROOT/zfsBE                  5.45M  59.6G  4.64G  /.alt.zfsBE
    rpool/dump                        1.00G  59.6G  1.00G  -
    rpool/export                        44K  59.6G    23K  /export
    rpool/export/home                   21K  59.6G    21K  /export/home
    rpool/swap                           1G  60.6G    16K  -
    rpool/zones                       17.2M  59.6G   633M  /rpool/zones
    rpool/zones-zfsBE                  653M  59.6G   633M  /rpool/zones-zfsBE
    rpool/zones-zfsBE@zfs2BE          19.9M      -   633M  -
    # zoneadm list -cv
      ID NAME             STATUS     PATH                           BRAND    IP    
       0 global           running    /                              native   shared
       - zfszone          installed  /rpool/zones                   native   shared

Procedure如何升级或修补具有区域根的 ZFS 根文件系统(最低 Solaris 10 5/09)

在 Solaris 10 5/09 或以上的发行版中,当您需要升级或修补具有区域根的 ZFS 根文件系统时,请使用此过程。这些更新可以是对系统进行升级,也可以是应用一些修补程序。

在后面的步骤中,zfs2BE 为升级或修补的引导环境的示例名称。

  1. 查看现有的 ZFS 文件系统。


    # zfs list
    NAME                               USED  AVAIL  REFER  MOUNTPOINT
    rpool                             7.38G  59.6G   100K  /rpool
    rpool/ROOT                        4.72G  59.6G    21K  legacy
    rpool/ROOT/zfs2BE                 4.72G  59.6G  4.64G  /
    rpool/ROOT/zfs2BE@zfs2BE          75.0M      -  4.64G  -
    rpool/ROOT/zfsBE                  5.46M  59.6G  4.64G  /
    rpool/dump                        1.00G  59.6G  1.00G  -
    rpool/export                        44K  59.6G    23K  /export
    rpool/export/home                   21K  59.6G    21K  /export/home
    rpool/swap                           1G  60.6G    16K  -
    rpool/zones                       22.9M  59.6G   637M  /rpool/zones
    rpool/zones-zfsBE                  653M  59.6G   633M  /rpool/zones-zfsBE
    rpool/zones-zfsBE@zfs2BE          20.0M      -   633M  -
  2. 确保安装和引导了区域。


    # zoneadm list -cv
      ID NAME             STATUS     PATH                           BRAND    IP    
       0 global           running    /                              native   shared
       5 zfszone          running    /rpool/zones                   native   shared
  3. 创建 ZFS BE 以进行升级或修补。


    # lucreate -n zfs2BE
    Analyzing system configuration.
    Comparing source boot environment <zfsBE> file systems with the file 
    system(s) you specified for the new boot environment. Determining which 
    file systems should be in the new boot environment.
    Updating boot environment description database on all BEs.
    Updating system configuration files.
    Creating configuration for boot environment <zfs2BE>.
    Source boot environment is <zfsBE>.
    Creating boot environment <zfs2BE>.
    Cloning file systems from boot environment <zfsBE> to create boot environment <zfs2BE>.
    Creating snapshot for <rpool/ROOT/zfsBE> on <rpool/ROOT/zfsBE@zfs2BE>.
    Creating clone for <rpool/ROOT/zfsBE@zfs2BE> on <rpool/ROOT/zfs2BE>.
    Setting canmount=noauto for </> in zone <global> on <rpool/ROOT/zfs2BE>.
    Creating snapshot for <rpool/zones> on <rpool/zones@zfs10092BE>.
    Creating clone for <rpool/zones@zfs2BE> on <rpool/zones-zfs2BE>.
    Population of boot environment <zfs2BE> successful.
    Creation of boot environment <zfs2BE> successful.
  4. 选择以下操作之一来升级系统或将修补程序应用到新引导环境:

    • 升级系统。


      # luupgrade -u -n zfs2BE -s /net/install/export/s10up/latest
      

      其中 -s 选项指定 Solaris 安装介质的位置。

      此过程要花费很长时间。

      有关 luupgrade 过程的完整示例,请参见示例 5–6

    • 将修补程序应用到新引导环境。


      # luupgrade -t -n zfs2BE -t -s /patchdir patch-id-02 patch-id-04
      
  5. 激活新引导环境。


    # lustatus
    Boot Environment           Is       Active Active    Can    Copy      
    Name                       Complete Now    On Reboot Delete Status    
    -------------------------- -------- ------ --------- ------ ----------
    zfsBE                      yes      yes    yes       no     -         
    zfs2BE                     yes      no     no        yes    -    
    # luactivate zfs2BE
    A Live Upgrade Sync operation will be performed on startup of boot environment <zfs2BE>.
    .
    .
    .
  6. 从新激活的引导环境引导。


    # init 6
    

示例 5–6 将具有区域根的 ZFS 根文件系统升级到 Oracle Solaris 10 9/10 ZFS 根文件系统

在此示例中,将在具有 ZFS 根文件系统和非根池的区域根的 Solaris 10 10/09 系统上创建的 ZFS BE (zfsBE) 升级到 Oracle Solaris 10 9/10 发行版。此过程要花费较长时间。然后,激活升级的 BE (zfs2BE)。请确保在尝试升级之前,安装并引导了区域。

在此示例中,zonepool 池、/zonepool/zones 数据集和 zfszone 区域是按如下方式创建的:


# zpool create zonepool mirror c2t1d0 c2t5d0
# zfs create zonepool/zones
# chmod 700 zonepool/zones
# zonecfg -z zfszone
zfszone: No such zone configured
Use 'create' to begin configuring a new zone.
zonecfg:zfszone> create
zonecfg:zfszone> set zonepath=/zonepool/zones
zonecfg:zfszone> verify
zonecfg:zfszone> exit
# zoneadm -z zfszone install
cannot create ZFS dataset zonepool/zones: dataset already exists
Preparing to install zone <zfszone>.
Creating list of files to copy from the global zone.
Copying <8960> files to the zone.
.
.
.

# zoneadm list -cv
  ID NAME             STATUS     PATH                           BRAND    IP    
   0 global           running    /                              native   shared
   2 zfszone          running    /zonepool/zones                native   shared

# lucreate -n zfsBE
.
.
.
# luupgrade -u -n zfsBE -s /net/install/export/s10up/latest
40410 blocks
miniroot filesystem is <lofs>
Mounting miniroot at </net/system/export/s10up/latest/Solaris_10/Tools/Boot>
Validating the contents of the media </net/system/export/s10up/latest>.
The media is a standard Solaris media.
The media contains an operating system upgrade image.
The media contains <Solaris> version <10>.
Constructing upgrade profile to use.
Locating the operating system upgrade program.
Checking for existence of previously scheduled Live Upgrade requests.
Creating upgrade profile for BE <zfsBE>.
Determining packages to install or upgrade for BE <zfsBE>.
Performing the operating system upgrade of the BE <zfsBE>.
CAUTION: Interrupting this process may leave the boot environment unstable 
or unbootable.
Upgrading Solaris: 100% completed
Installation of the packages from this media is complete.
Updating package information on boot environment <zfsBE>.
Package information successfully updated on boot environment <zfsBE>.
Adding operating system patches to the BE <zfsBE>.
The operating system patch installation is complete.
INFORMATION: The file </var/sadm/system/logs/upgrade_log> on boot 
environment <zfsBE> contains a log of the upgrade operation.
INFORMATION: The file </var/sadm/system/data/upgrade_cleanup> on boot 
environment <zfsBE> contains a log of cleanup operations required.
INFORMATION: Review the files listed above. Remember that all of the files 
are located on boot environment <zfsBE>. Before you activate boot 
environment <zfsBE>, determine if any additional system maintenance is 
required or if additional media of the software distribution must be 
installed.
The Solaris upgrade of the boot environment <zfsBE> is complete.
Installing failsafe
Failsafe install is complete.
# luactivate zfsBE
# init 6
# lustatus
Boot Environment           Is       Active Active    Can    Copy      
Name                       Complete Now    On Reboot Delete Status    
-------------------------- -------- ------ --------- ------ ----------
zfsBE                      yes      no     no        yes    -         
zfs2BE                     yes      yes    yes       no     -         
# zoneadm list -cv
  ID NAME             STATUS     PATH                           BRAND    IP    
   0 global           running    /                              native   shared
   - zfszone          installed  /zonepool/zones                native   shared

Procedure如何将具有区域根的 UFS 根文件系统迁移到 ZFS 根文件系统(最低 Solaris 10 5/09)

使用此过程将具有 UFS 根文件系统和区域根的系统迁移到 Solaris 10 5/09 或以上的发行版。然后,使用 Oracle Solaris Live Upgrade 创建 ZFS BE。

在后面的步骤中,示例 UFS BE 名称为 c0t1d0s0,UFS 区域根为 zonepool/zfszone,ZFS 根 BE 为 zfsBE

  1. 如果系统正在运行先前的 Solaris 10 发行版,请将其升级到最低 Solaris 10 5/09 发行版。

    有关对运行 Solaris 10 发行版的系统进行升级的信息,请参见《Oracle Solaris 10 9/10 安装指南:Solaris Live 升级和升级规划》

  2. 创建根池。

    有关根池要求的信息,请参见ZFS 支持对于 Oracle Solaris 安装和 Oracle Solaris Live Upgrade 的要求

  3. 确认已引导 UFS 环境中的区域。


    # zoneadm list -cv
      ID NAME             STATUS     PATH                           BRAND    IP    
       0 global           running    /                              native   shared
       2 zfszone          running    /zonepool/zones                native   shared
  4. 创建新 ZFS 引导环境。


    # lucreate -c c1t1d0s0 -n zfsBE -p rpool
    

    此命令将为新引导环境在根池中建立数据集并将当前引导环境(包括区域)复制到这些数据集。

  5. 激活新 ZFS 引导环境。


    # lustatus
    Boot Environment           Is       Active Active    Can    Copy      
    Name                       Complete Now    On Reboot Delete Status    
    -------------------------- -------- ------ --------- ------ ----------
    c1t1d0s0                   yes      no     no        yes    -         
    zfsBE                      yes      yes    yes       no     -         #
    luactivate zfsBE       
    A Live Upgrade Sync operation will be performed on startup of boot environment <zfsBE>.
    .
    .
    .
  6. 重新引导系统。


    # init 6
    
  7. 确认在新 BE 中创建了 ZFS 文件系统和区域。


    # zfs list
    NAME                                USED  AVAIL  REFER  MOUNTPOINT
    rpool                              6.17G  60.8G    98K  /rpool
    rpool/ROOT                         4.67G  60.8G    21K  /rpool/ROOT
    rpool/ROOT/zfsBE                   4.67G  60.8G  4.67G  /
    rpool/dump                         1.00G  60.8G  1.00G  -
    rpool/swap                          517M  61.3G    16K  -
    zonepool                            634M  7.62G    24K  /zonepool
    zonepool/zones                      270K  7.62G   633M  /zonepool/zones
    zonepool/zones-c1t1d0s0             634M  7.62G   633M  /zonepool/zones-c1t1d0s0
    zonepool/zones-c1t1d0s0@zfsBE       262K      -   633M  -
    # zoneadm list -cv
      ID NAME             STATUS     PATH                           BRAND    IP    
       0 global           running    /                              native   shared
       - zfszone          installed  /zonepool/zones                native   shared

示例 5–7 将具有区域根的 UFS 根文件系统迁移到 ZFS 根文件系统

在此示例中,将具有 UFS 根文件系统和区域根 (/uzone/ufszone)、ZFS 非根池 (pool) 以及区域根 (/pool/zfszone) 的 Oracle Solaris 10 9/10 系统迁移到 ZFS 根文件系统。在尝试迁移之前,请确保创建了 ZFS 根池并且安装和引导了区域。


# zoneadm list -cv
  ID NAME             STATUS     PATH                           BRAND    IP    
   0 global           running    /                              native   shared
   2 ufszone          running    /uzone/ufszone                 native   shared
   3 zfszone          running    /pool/zones/zfszone            native   shared

# lucreate -c ufsBE -n zfsBE -p rpool
Analyzing system configuration.
No name for current boot environment.
Current boot environment is named <zfsBE>.
Creating initial configuration for primary boot environment <zfsBE>.
The device </dev/dsk/c1t0d0s0> is not a root device for any boot environment; cannot get BE ID.
PBE configuration successful: PBE name <ufsBE> PBE Boot Device </dev/dsk/c1t0d0s0>.
Comparing source boot environment <ufsBE> file systems with the file 
system(s) you specified for the new boot environment. Determining which 
file systems should be in the new boot environment.
Updating boot environment description database on all BEs.
Updating system configuration files.
The device </dev/dsk/c1t1d0s0> is not a root device for any boot environment; cannot get BE ID.
Creating configuration for boot environment <zfsBE>.
Source boot environment is <ufsBE>.
Creating boot environment <zfsBE>.
Creating file systems on boot environment <zfsBE>.
Creating <zfs> file system for </> in zone <global> on <rpool/ROOT/zfsBE>.
Populating file systems on boot environment <zfsBE>.
Checking selection integrity.
Integrity check OK.
Populating contents of mount point </>.
Copying.
Creating shared file system mount points.
Copying root of zone <ufszone> to </.alt.tmp.b-EYd.mnt/uzone/ufszone>.
Creating snapshot for <pool/zones/zfszone> on <pool/zones/zfszone@zfsBE>.
Creating clone for <pool/zones/zfszone@zfsBE> on <pool/zones/zfszone-zfsBE>.
Creating compare databases for boot environment <zfsBE>.
Creating compare database for file system </rpool/ROOT>.
Creating compare database for file system </>.
Updating compare databases on boot environment <zfsBE>.
Making boot environment <zfsBE> bootable.
Creating boot_archive for /.alt.tmp.b-DLd.mnt
updating /.alt.tmp.b-DLd.mnt/platform/sun4u/boot_archive
Population of boot environment <zfsBE> successful.
Creation of boot environment <zfsBE> successful.
# lustatus
Boot Environment           Is       Active Active    Can    Copy      
Name                       Complete Now    On Reboot Delete Status    
-------------------------- -------- ------ --------- ------ ----------
ufsBE                      yes      yes    yes       no     -         
zfsBE                      yes      no     no        yes    -         
# luactivate zfsBE    
.
.
.
# init 6
.
.
.
# zfs list
NAME                                    USED  AVAIL  REFER  MOUNTPOINT
pool                                    628M  66.3G    19K  /pool
pool/zones                              628M  66.3G    20K  /pool/zones
pool/zones/zfszone                     75.5K  66.3G   627M  /pool/zones/zfszone
pool/zones/zfszone-ufsBE                628M  66.3G   627M  /pool/zones/zfszone-ufsBE
pool/zones/zfszone-ufsBE@zfsBE           98K      -   627M  -
rpool                                  7.76G  59.2G    95K  /rpool
rpool/ROOT                             5.25G  59.2G    18K  /rpool/ROOT
rpool/ROOT/zfsBE                       5.25G  59.2G  5.25G  /
rpool/dump                             2.00G  59.2G  2.00G  -
rpool/swap                              517M  59.7G    16K  -
# zoneadm list -cv
  ID NAME             STATUS     PATH                           BRAND    IP    
   0 global           running    /                              native   shared
   - ufszone          installed  /uzone/ufszone                 native   shared
   - zfszone          installed  /pool/zones/zfszone            native   shared