Solaris 10 5/09 安装指南:Solaris Live Upgrade 和升级规划

将 UFS 文件系统迁移到 ZFS 文件系统

此过程介绍如何将 UFS 文件系统迁移到 ZFS 文件系统。通过创建引导环境,可以将关键文件系统从活动 UFS 引导环境复制到 ZFS 根池中。lucreate 命令可将关键文件系统复制到现有 ZFS 根池的新引导环境中。不会复制用户定义的(可共享的)文件系统,也不会与源 UFS 引导环境共享这些文件系统。此外,不会在 UFS 文件系统与 ZFS 根池之间共享 /swap。有关可共享的关键文件系统的概述,请参见文件系统类型

Procedure如何将 UFS 文件系统迁移到 ZFS 文件系统


注 –

要将活动 UFS 根 (/) 文件系统迁移到迁移到 ZFS 根池,您必须提供根池的名称。关键文件系统将被复制到根池中。


  1. 在第一次运行 Solaris Live Upgrade 之前,必须从安装介质安装最新 Solaris Live Upgrade 软件包以及安装 SunSolve 信息文档 206844 中列出的修补程序。在 SunSolve Web 站点上搜索信息文档 206844(以前为 72099)。

    最新的软件包以及修补程序可确保您具有该发行版的所有最新错误修复和新增功能。在继续创建新的引导环境之前,请确保安装了所有与您的系统相关的修补程序。

    下列子步骤说明了 SunSolve 信息文档 206844 中的步骤。


    注 –

    使用 Solaris Live Upgrade 创建新的 ZFS 引导环境至少需要安装 Solaris 10 10/08 发行版。以前的发行版中的 ZFS 和 Solaris Live Upgrade 软件不能执行这些任务。


    1. 成为超级用户或承担等效角色。

    2. 按照 SunSolve Web 站点上信息文档 206844 中的说明删除和添加 Solaris Live Upgrade 软件包。

      三个 Solaris Live Upgrade 软件包(SUNWluuSUNWlurSUNWlucfg)组成了使用 Solaris Live Upgrade 进行升级所需的软件。这些软件包包含现有的软件、新增功能和错误修复。如果在使用 Solaris Live Upgrade 前未删除现有软件包并在系统上安装新的软件包,则升级到目标发行版时将失败。从 Solaris 10 8/07 发行版开始,新增了 SUMWlucfg 软件包。如果您要从 Solaris 10 8/07 之前的发行版使用 Solaris Live Upgrade 软件包,则不需要删除此软件包。


      # pkgrm SUNWlucfg SUNWluu SUNWlur
      
    3. 从要升级到的发行版安装新的 Solaris Live Upgrade 软件包。有关说明,请参见安装 Solaris Live Upgrade

    4. 在运行 Solaris Live Upgrade 之前,需要安装下列修补程序。这些修补程序可确保您具有该发行版的所有最新错误修复和新增功能。

      请访问 SunSolve,以确保具有最近更新的修补程序列表。在 SunSolve Web 站点上搜索信息文档 206844(以前为 72099)。

      • 如果您要将修补程序存储在本地磁盘上,请创建一个目录(如 /var/tmp/lupatches)并将这些修补程序下载到该目录中。

      • SunSolve Web 站点获取修补程序列表。

      • 转到修补程序目录。


        # cd /var/tmp/lupatches
        
      • 使用 patchadd 命令安装修补程序。


        # patchadd patch_id
        

        patch_id 是修补程序号。用空格分隔多个修补程序名称。


        注 –

        需要按照信息文档 206844 中指定的顺序来应用这些修补程序。


      • 根据需要重新引导系统。某些修补程序需要重新引导后才能生效。

        仅适用于 x86: 需要重新引导系统,否则 Solaris Live Upgrade 将会失败。


        # init 6
        

        您现在有了成功迁移所需的软件包和修补程序。

  2. 创建 ZFS 根池。

    ZFS 根池必须位于单个片上才能引导和升级。


    # zpool create rpool  c0t1d0s5
    
    rpool

    指定要创建的新 ZFS 根池的名称。

    c0t1d0s5

    在磁盘片 c0t1d0s5 上创建新的根池。

    有关创建新根池的信息,请参见《Solaris ZFS 管理指南》

  3. 将 UFS 根 (/) 文件系统迁移到新的 ZFS 根池。


    # lucreate [-c ufsBE] -n new-zfsBE -p rpool
    
    -c ufsBE

    为当前 UFS 引导环境指定名称 ufsBE。该选项不是必需的,仅在创建首个引导环境时使用。如果是首次运行 lucreate 命令且省略了 -c 选项,本软件将为您创建一个缺省名称。

    -n new-zfsBE

    为要创建的引导环境指定名称 new-zfsBE。名称在系统中必须是唯一的。

    -p rpool

    将新创建的 ZFS 根 (/) 文件系统置于在 rpool 中定义的 ZFS 根池中。

    创建新的 ZFS 引导环境可能需要一段时间。UFS 文件系统数据将被复制到 ZFS 根池中。创建非活动引导环境后,可以使用 luupgradeluactivate 命令升级或激活新的 ZFS 引导环境。

  4. (可选)验证引导环境是否已完成。

    在本示例中,lustatus 命令会报告引导环境的创建是否已完成以及引导环境是否可以引导。


    # lustatus
    boot environment   Is         Active   Active     Can	    Copy 
    Name               Complete   Now	  OnReboot   Delete	 Status 
    -----------------------------------------------------------------
    ufsBE               yes       yes      yes        no         -
    new-zfsBE           yes       no       no        yes         -
  5. (可选)验证系统上的基本数据集信息。

    list 命令显示系统上所有数据集的名称。在本示例中,rpool 是 ZFS 池的名称,new-zfsBE 是新创建的 ZFS 引导环境的名称。


    # zfs list
    NAME                        USED  AVAIL  REFER  MOUNTPOINT 
    rpool                      9.29G  57.6G    20K  /rpool
    rpool/ROOT                 5.38G  57.6G    18K  /rpool/ROOT
    rpool/ROOT/new-zfsBE       5.38G  57.6G   551M  /tmp/.alt.luupdall.110034
    rpool/dump                 1.95G      -  1.95G  - 
    rpool/swap                 1.95G      -  1.95G  - 

    针对新引导环境列出的挂载点是临时的,直到执行 luactivate 命令为止。/dump/swap 卷不与原始 UFS 引导环境共享,但在 ZFS 根池和根池内的引导环境中共享。

    现在可以升级并激活新的引导环境了。请参见示例 13–1


示例 13–1 将 UFS 根 (/) 文件系统迁移到 ZFS 根池

在本示例中,新的 ZFS 根池 rpool 是在单独的片 C0t0d0s4 上创建的。lucreate 命令可将当前正在运行的 UFS 引导环境 c0t0d0 迁移到新的 ZFS 引导环境 new-zfsBE,并将新的引导环境置于 rpool 中。


# zpool create rpool C0t0d0s4

# zfs list
NAME                        USED  AVAIL  REFER  MOUNTPOINT 
rpool                      9.29G  57.6G    20K  /rpool
# lucreate -c c0t0d0 -n new-zfsBE -p rpool
Analyzing system configuration.
Current boot environment is named <c0t0d0>.
Creating initial configuration for primary boot environment <c0t0d0>.
The device </dev/dsk/c0t0d0> is not a root device for any boot 
environment; cannot get BE ID.
PBE configuration successful: PBE name <c0t0d0> PBE Boot Device 
</dev/dsk/c0t0d0>.
Comparing source boot environment <c0t0d0> 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/c1t0d0s0> is not a root device for any boot 
environment; cannot get BE ID.
Creating configuration for boot environment <new-zfsBE>.
Source boot environment is <c0t0d0>.
Creating boot environment <new-zfsBE>.
Creating file systems on boot environment <new-zfsBE>.
Creating <zfs> file system for </> in zone <global> on 
<rpool/ROOT/new-zfsBE>.
Populating file systems on boot environment <new-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 </>.
Making boot environment <zfsBE> bootable.
Creating boot_archive for /.alt.tmp.b-cBc.mnt
updating /.alt.tmp.b-cBc.mnt/platform/sun4u/boot_archive
Population of boot environment <new-zfsBE> successful.
Creation of boot environment <new-zfsBE> successful.

# lustatus
boot environment   Is         Active   Active     Can	    Copy 
Name               Complete   Now	  OnReboot   Delete	 Status 
------------------------------------------------------------------------ 
c0t0d0             yes       yes      yes        no         - 
new-zfsBE           yes       no       no        yes       -

# zfs list
NAME                        USED  AVAIL  REFER  MOUNTPOINT 
rpool                      9.29G  57.6G    20K  /rpool
rpool/ROOT                 5.38G  57.6G    18K  /rpool/ROOT
rpool/ROOT/zfsBE           5.38G  57.6G   551M  
rpool/ROOT/new-zfsBE       5.38G  57.6G   551M  /tmp/.alt.luupdall.110034
rpool/dump                 1.95G      -  1.95G  - 
rpool/swap                 1.95G      -  1.95G  - 

现在可以升级或激活新的引导环境了。

在本示例中,使用 luupgrade 命令从通过 -s 选项指明的位置中存储的映像升级新引导环境。


# luupgrade -n zfsBE -u -s /net/install/export/s10/combined.s10
 51135 blocks 
miniroot filesystem is <lofs>
Mounting miniroot at 
</net/install/export/solaris_10/combined.solaris_10_wos
/Solaris_10/Tools/Boot> 
Validating the contents of the media 
</net/install/export/s10/combined.s10>. 
The media is a standard Solaris media. 
The media contains an operating system upgrade image. 
The media contains Solaris version <10_1008>. 
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. 
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.

创建新引导环境后,可以随时激活它。


# luactivate new-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.

**********************************************************************
In case of a failure while booting to the target BE, the following process 
needs to be followed to fallback to the currently working boot environment:

1. Enter the PROM monitor (ok prompt).

2. Change the boot device back to the original boot environment by typing:

     setenv boot-device /pci@1f,0/pci@1/scsi@4,1/disk@2,0:a

3. Boot to the original boot environment by typing:

     boot

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

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

将系统重新引导至 ZFS 引导环境。


# init 6
# svc.startd: The system is coming down.  Please wait.
svc.startd: 79 system services are now being stopped.
.
.
.

如果回退到 UFS 引导环境,则需要再次导入在 ZFS 引导环境中创建的所有 ZFS 存储池,因为 UFS 引导环境不会自动提供它们。切换回 UFS 引导环境时,您将看到类似于以下示例的消息。


# luactivate c0t0d0
WARNING: The following files have changed on both the current boot 
environment <new-zfsBE> zone <global> and the boot environment 
to be activated <c0t0d0>:
 /etc/zfs/zpool.cache
INFORMATION: The files listed above are in conflict between the current 
boot environment <zfsBE> zone <global> and the boot environment to be 
activated <c0t0d0>. These files will not be automatically synchronized 
from the current boot environment <new-zfsBE> when boot environment <c0t0d0>