以下示例说明如何将 UFS 根文件系统迁移到 ZFS 根文件系统。
如果要迁移或更新具有区域的系统,请参见以下各节:
使用 Oracle Solaris Live Upgrade 迁移或升级具有区域的系统 (Solaris 10 10/08)
使用 Oracle Solaris Live Upgrade 迁移或升级具有区域的系统(最低Solaris 10 5/09)
以下示例说明如何从 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 命令将其删除。
在同一池中从 ZFS BE 创建 ZFS BE 非常快捷,因为该操作使用 ZFS 快照和克隆功能。如果当前 BE 驻留在同一 ZFS 池上,则可以省略 -p 选项。
如果有多个 ZFS BE,请执行以下操作来选择从哪个 BE 引导:
SPARC:您可以使用 boot -L 命令确定可用的 BE,并使用 boot -Z 命令从中选择一个 BE 来执行引导。
x86:您可以从 GRUB 菜单中选择一个 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. |
您可以使用其他软件包或修补程序升级 ZFS BE。
基本过程如下:
使用 lucreate 命令创建备用 BE。
激活该备用 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. |