Solaris 10 10/08 安裝指南: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 建立新 ZFS 啟動環境,至少需要安裝 Solaris 10 10/08 發行版本。舊版中的 ZFS 和 Solaris Live Upgrade 軟體無法執行這些作業。


    1. 如有必要,請移除系統上現有的 Solaris Live Upgrade 套裝軟體。如果您要升級至新發行版本,則必須從該發行版本安裝套裝軟體。

      三種 Solaris Live Upgrade 套裝軟體 SUNWluuSUNWlurSUNWlucfg 組成了使用 Solaris Live Upgrade 進行升級所需的軟體。這些套裝軟體包含現有軟體、新功能和錯誤修正。若您在使用 Solaris Live Upgrade 前未移除現有套裝軟體並在系統上安裝新套裝軟體,則升級至目標發行版本時會失敗。


      # pkgrm SUNWlucfg SUNWluu SUNWlur
      
    2. 從您要升級的發行版本安裝新的 Solaris Live Upgrade 套裝軟體。如需相關說明,請參閱安裝 Solaris Live Upgrade

    3. 安裝或執行 Solaris Live Upgrade 之前,必須安裝下列修補程式。這些修補程式可確保您有此發行版本中的所有最新錯誤修正程式和新功能。

      請參閱SunSolve,以確定您有最近更新的修補程式清單。在 SunSolve 網站上搜尋資訊文件 206844 (以前為 72099)。

      • 成為超級使用者,或者假定一個對等身份。

      • 如果您要在本機磁碟上儲存修補程式,請建立如 /var/tmp/lupatches 的目錄,然後將修補程式下載至該目錄中。

      • 請從 SunSolve 網站取得修補程式清單。

      • 變更至修補程式目錄。


        # 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 Administration Guide」

  3. 將 UFS 根 (/) 檔案系統遷移至新的 ZFS 根池。


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

    將名稱 ufsBE 指定給目前的 UFS 啟動環境。此選項不是必要選項,它僅在建立第一個啟動環境時使用。如果您是首次執行 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>