Sun Cluster 系統管理指南(適用於 Solaris 作業系統)

第 11 章 備份與復原叢集

本章提供以下章節:

備份叢集

表 11–1 作業說明:備份叢集檔案

作業 

指示 

尋找要備份的檔案系統的名稱 

如何尋找要備份的檔案系統名稱

計算您需要多少磁帶才能容納完整的備份 

如何判斷完整備份所需的磁帶數

備份 root 檔案系統 

如何備份根 (/) 檔案系統

執行鏡像或診測檔案系統的線上備份 

如何執行鏡像的線上備份 (Solaris Volume Manager)

 

SPARC: 如何執行磁碟區的線上備份 (VERITAS Volume Manager)

備份叢集配置 

如何備份叢集配置

備份儲存磁碟的磁碟分割區配置。 

請參閱您的儲存磁碟的文件。 

Procedure如何尋找要備份的檔案系統名稱

使用此程序確定要備份的檔案系統的名稱。

  1. 顯示 /etc/vfstab 檔的內容。

    您無須以超級使用者身份登入或成為等效角色便可執行此指令。


    # more /etc/vfstab
    
  2. 在裝載點欄位尋找您要備份之檔案系統的名稱。

    請在備份檔案系統時使用這個名稱。


    # more /etc/vfstab 
    

範例 11–1 查找要備份的檔案系統名稱

以下範例顯示列於 /etc/vfstab 檔案中的可用檔案系統名稱。


# more /etc/vfstab
#device             device             mount  FS fsck  mount  mount
#to mount           to fsck            point  type     pass   at boot  options
#
#/dev/dsk/c1d0s2    /dev/rdsk/c1d0s2   /usr     ufs     1      yes      -
 f                  -                  /dev/fd  fd      -      no       -
 /proc              -                  /proc    proc    -      no       -
 /dev/dsk/c1t6d0s1  -                  -        swap    -      no       -
 /dev/dsk/c1t6d0s0  /dev/rdsk/c1t6d0s0 /        ufs     1      no       -
 /dev/dsk/c1t6d0s3  /dev/rdsk/c1t6d0s3 /cache   ufs     2      yes      -
 swap               -                  /tmp     tmpfs   -      yes      -

Procedure如何判斷完整備份所需的磁帶數

使用此程序計算您備份檔案系統將需要的磁帶數。

  1. 在要備份的叢集節點上以超級使用者身份登入或成為等效角色。

  2. 以位元組預估備份大小。


    # ufsdump S filesystem 
    
    S

    顯示執行備份時的預計位元組數。

    filesystem

    指定您要備份之檔案系統的名稱。

  3. 將預估大小除以磁帶容量來求出所需的磁帶數。


範例 11–2 確定所需的磁帶數

在以下範例中,905,881,620 位元組的檔案系統可以輕易地放入 4 GB 的磁帶 (905,881,620 ÷ 4,000,000,000)。


# ufsdump S /global/phys-schost-1
905881620

Procedure如何備份根 (/) 檔案系統

使用此程序備份叢集節點的根 (/) 檔案系統。請先確定叢集執行時沒有任何錯誤,再執行備份程序。

此程序提供長形式的 Sun Cluster 指令。大多數指令還有簡短的形式。除了指令名稱有長形式和短形式之分外,指令本身是相同的。如需指令及其短形式的清單,請參閱附錄 ASun Cluster 以物件為導向的指令

  1. 在您要備份的叢集節點上成為超級使用者或成為提供 solaris.cluster.modify RBAC 授權的角色。

  2. 將每個執行的資料服務從要備份的節點切換到叢集中的另一節點上。


    # clnode evacuate node
    
    node

    指定您要從中切換資源群組及裝置群組的節點。

  3. 關閉節點。


    # shutdown -g0 -y -i0
    
  4. 重新啟動節點進入非叢集模式。

    • SPARC:鍵入:


      ok boot -xs
      
    • 在 x86 架構的系統上,執行下列指令:


      phys-schost# shutdown -g -y -i0
      
      Press any key to continue
    1. 在 GRUB 功能表中,使用方向鍵選取適合的 Solaris 項目,並鍵入 e 以編輯其指令。

      GRUB 功能表會以類似以下的方式顯示:


      GNU GRUB version 0.95 (631K lower / 2095488K upper memory)
      +-------------------------------------------------------------------------+
      | Solaris 10 /sol_10_x86                                                  |
      | Solaris 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.

      如需更多以 GRUB 為基礎的啟動之相關資訊,請參閱「System Administration Guide: Basic Administration」中的第 11 章「GRUB Based Booting (Tasks)」

    2. 在啟動參數畫面中,使用方向鍵選取核心項目並鍵入 e 以編輯該項目。

      GRUB 啟動參數畫面會以類似以下的方式顯示:


      GNU GRUB version 0.95 (615K lower / 2095552K upper memory)
      +----------------------------------------------------------------------+
      | root (hd0,0,a)                                                       |
      | kernel /platform/i86pc/multiboot                                     |
      | module /platform/i86pc/boot_archive                                  |
      +----------------------------------------------------------------------+
      Use the ^ and v keys to select which entry is highlighted.
      Press 'b' to boot, 'e' to edit the selected command in the
      boot sequence, 'c' for a command-line, 'o' to open a new line
      after ('O' for before) the selected line, 'd' to remove the
      selected line, or escape to go back to the main menu.
    3. -x 增加至指令以指定系統會啟動至非叢集模式。


      [ Minimal BASH-like line editing is supported. For the first word, TAB
      lists possible command completions. Anywhere else TAB lists the possible
      completions of a device/filename. ESC at any time exits. ]
      
      grub edit> kernel /platform/i86pc/multiboot -x
    4. 按 Enter 鍵接受變更並返回啟動參數畫面。

      畫面會顯示已編輯的指令。


      GNU GRUB version 0.95 (615K lower / 2095552K upper memory)
      +----------------------------------------------------------------------+
      | root (hd0,0,a)                                                       |
      | kernel /platform/i86pc/multiboot -x                                  |
      | module /platform/i86pc/boot_archive                                  |
      +----------------------------------------------------------------------+
      Use the ^ and v keys to select which entry is highlighted.
      Press 'b' to boot, 'e' to edit the selected command in the
      boot sequence, 'c' for a command-line, 'o' to open a new line
      after ('O' for before) the selected line, 'd' to remove the
      selected line, or escape to go back to the main menu.-
    5. 鍵入 b 將節點啟動至非叢集模式。


      備註 –

      對核心啟動參數指令所做的這個變更不會在系統啟動後持續。下次您重新啟動節點時,將會啟動至叢集模式。若要啟動至非叢集模式,請重新執行這些步驟,將 -x 選項增加至核心啟動參數指令。


  5. 透過建立 UFS 快照來備份根 (/) 檔案系統。

    1. 確定檔案系統有足夠的磁碟空間來後備儲存檔案。


      # df -k
      
    2. 確定不存在相同名稱與位置的後備儲存檔案。


      # ls /backing-store-file
      
    3. 建立 UFS 快照。


      # fssnap -F ufs -o bs=/backing-store-file /file-system
      
    4. 驗證快照是否已經建立。


      # /usr/lib/fs/ufs/fssnap -i /file-system
      
  6. 將節點重新啟動為叢集模式。


    # init 6
    

範例 11–3 備份根 (/) 檔案系統

在下列範例中,根 (/) 檔案系統的快照儲存至 /usr 目錄中的 /scratch/usr.back.file。`


# fssnap -F ufs -o bs=/scratch/usr.back.file /usr
  /dev/fssnap/1

Procedure如何執行鏡像的線上備份 (Solaris Volume Manager)

鏡像的 Solstice DiskSuite 中介裝置或 Solaris Volume Manager 磁碟區可以在沒有卸載且沒有使整個鏡像離線的情況下進行備份。有一個子鏡像必須暫時設成離線,這樣會導致失去鏡像功能,但可在備份完成後重新使它進入線上並同步,如此可以不必關機或拒絕使用者存取資料。使用鏡像執行線上備份會建立使用中檔案系統的「快照」備份。

如果程式在執行 lockfs 指令之前將資料寫入磁碟區,可能會發生問題。要避免這個問題,請先暫時停止在這個節點上執行的所有服務。另外,請先確認叢集在執行時沒有出現錯誤,再執行備份程序。

此程序提供長形式的 Sun Cluster 指令。大多數指令還有簡短的形式。除了指令名稱有長形式和短形式之分外,指令本身是相同的。如需指令及其短形式的清單,請參閱附錄 ASun Cluster 以物件為導向的指令

  1. 在要備份的叢集節點上以超級使用者身份登入或成為等效角色。

  2. 使用 metaset(1M) 指令以判定哪個節點擁有已備份磁碟區的所有權。


    # metaset -s setname
    
    -s setname

    指定磁碟組名稱。

  3. -w 選項與 lockfs(1M) 指令搭配使用,以鎖定檔案系統,防止寫入。


    # lockfs -w mountpoint 
    

    備註 –

    只有當 UFS 檔案系統位於鏡像上時,才需要鎖定檔案系統。例如,如果 Solstice DiskSuite 中介裝置或 Solaris Volume Manager 磁碟區被設置為資料庫管理軟體或某些其他特定應用程式的原始裝置,您將不必使用 lockfs 指令。不過,您可能要執行適當的廠商相關公用程式,來清除任何緩衝區以及鎖定存取。


  4. 使用 metastat(1M) 指令確定子鏡像的名稱。


    # metastat -s setname -p
    
    -p

    以類似 md.tab 檔的格式顯示狀態。

  5. 使用 metadetach(1M) 指令使一個子鏡像從鏡像離線。


    # metadetach -s setname mirror submirror
    

    備註 –

    讀取作業將從其他子鏡像持續進行。不過,離線的子鏡像將在第一次寫入其他鏡像時失去同步。這種不一致可在離線子鏡像重回線上時更正。您不必執行 fsck


  6. 使用 lockfs 指令以及 -u 選項解除檔案系統的鎖定以容繼續寫入。


    # lockfs -u mountpoint 
    
  7. 執行檔案系統檢查。


    # fsck /dev/md/diskset/rdsk/submirror
    
  8. 將離線子鏡像備份到磁帶或其他媒體。

    使用 ufsdump(1M) 指令或常用的備份公用程式。


    # ufsdump 0ucf dump-device submirror
    

    備註 –

    請使用子鏡像的原始裝置 (/rdsk) 名稱,而不是區段裝置 (/dsk) 名稱。


  9. 使用 metattach(1M) 指令使中介裝置或磁碟區重新上線運作。


    # metattach -s setname mirror submirror
    

    中介裝置或磁碟區進入線上狀態後,將自動和鏡像重新同步。

  10. 使用 metastat 指令來驗證子鏡像是否重新同步。


    # metastat -s setname mirror
    

範例 11–4 執行鏡像的線上備份 (Solaris Volume Manager)

在下列範例中,叢集節點 phys-schost-1 為 metaset schost-1 的所有者,因此備份程序是從 phys-schost-1 開始執行。鏡像 /dev/md/schost-1/dsk/d0 是由 d10d20d30 子鏡像所組成。


[Determine the owner of the metaset:]
# metaset -s schost-1
Set name = schost-1, Set number = 1
Host                Owner
  phys-schost-1     Yes 
...
[Lock the file system from writes:] 
# lockfs -w /global/schost-1
[List the submirrors:]
# metastat -s schost-1 -p
schost-1/d0 -m schost-1/d10 schost-1/d20 schost-1/d30 1
schost-1/d10 1 1 d4s0
schost-1/d20 1 1 d6s0
schost-1/d30 1 1 d8s0
[Take a submirror offline:]
# metadetach -s schost-1 d0 d30
[Unlock the file system:]
# lockfs -u /
[Check the file system:]
# fsck /dev/md/schost-1/rdsk/d30
[Copy the submirror to the backup device:]
# ufsdump 0ucf /dev/rmt/0 /dev/md/schost-1/rdsk/d30
  DUMP: Writing 63 Kilobyte records
  DUMP: Date of this level 0 dump: Tue Apr 25 16:15:51 2000
  DUMP: Date of last level 0 dump: the epoch
  DUMP: Dumping /dev/md/schost-1/rdsk/d30 to /dev/rdsk/c1t9d0s0.
  ...
  DUMP: DUMP IS DONE
[Bring the submirror back online:]
# metattach -s schost-1 d0 d30
schost-1/d0: submirror schost-1/d30 is attached
[Resynchronize the submirror:]
# metastat -s schost-1 d0
schost-1/d0: Mirror
    Submirror 0: schost-0/d10
      State: Okay         
    Submirror 1: schost-0/d20
      State: Okay
    Submirror 2: schost-0/d30
      State: Resyncing
    Resync in progress: 42% done
    Pass: 1
    Read option: roundrobin (default)
...

ProcedureSPARC: 如何執行磁碟區的線上備份 (VERITAS Volume Manager)

VERITAS Volume Manager 將鏡像磁碟區識別為診測裝置。診測裝置可以在沒有卸載且沒有使整個磁碟區離線的情況下備份。結果是透過建立磁碟區的快照副本以及備份這個暫時磁碟區的方式來完成,不必關閉系統也不必拒絕使用者存取資料。

請先確定叢集執行時沒有任何錯誤,再執行備份程序。

此程序提供長形式的 Sun Cluster 指令。大多數指令還有簡短的形式。除了指令名稱有長形式和短形式之分外,指令本身是相同的。如需指令及其短形式的清單,請參閱附錄 ASun Cluster 以物件為導向的指令

  1. 登入叢集中的任何節點,然後成為超級使用者,或在叢集上的磁碟群組的目前主要節點上成為提供 solaris.cluster.admin RBAC 授權的角色。

  2. 列出磁碟群組資訊。


    # vxprint -g diskgroup
    
  3. 判定哪一個節點擁有目前匯入的磁碟群組,表示它就是磁碟群組的主要節點。


    # cldevicegroup status
    
  4. 建立磁碟區快照。


    # vxassist -g diskgroup snapstart volume
    

    備註 –

    視您磁碟區大小而定,建立快照可能需花上很長的時間。


  5. 驗證是否已建立新的磁碟區。


    # vxprint -g diskgroup
    

    當快照完成時,Snapdone 的狀態會顯示在選定磁碟群組的 State 欄位中。

  6. 停止任何存取檔案系統的資料服務。


    # clresourcegroup offline resource-group
    

    備註 –

    停止資料服務,以確保資料檔案系統備份正常執行。如果未執行任何資料服務,則無需執行步驟 6步驟 8


  7. 建立名為 bkup-vol 的備份磁碟區,並將快照磁碟區附加至其中。


    # vxassist -g diskgroup snapshot volume bkup-vol
    
  8. 使用 clresourcegroup 指令重新啟動任何在步驟 6 受中止的資料服務。


    # clresourcegroup online - zone -n node resourcegroup
    
    node

    節點名稱。

    zone

    可以控制資源群組的節點上的非全域區域名稱。唯有在您建立資源群組時已指定非全域區域時,才指定區域

  9. 驗證磁碟區現在是否已連結至新的磁碟區 bkup-vol


    # vxprint -g diskgroup
    
  10. 註冊裝置群組的配置變更。


    # cldevicegroup sync diskgroup
    
  11. 檢查備份磁碟區。


    # fsck -y /dev/vx/rdsk/diskgroup/bkup-vol
    
  12. 執行備份作業,將磁碟區 bkup-vol 複製到磁帶或其他媒體。

    使用 ufsdump(1M) 指令或常用的備份公用程式。


    # ufsdump 0ucf dump-device /dev/vx/dsk/diskgroup/bkup-vol
    
  13. 移除暫時磁碟區。


    # vxedit -rf rm bkup-vol
    
  14. 註冊磁碟群組的配置變更。


    # cldevicegroup sync diskgroup
    

範例 11–5 SPARC: 執行磁碟區的線上備份 (VERITAS Volume Manager)

在下範例中,叢集節點 phys-schost-2 為裝置群組 schost-1 的主要所有者。因此,備份程序是從 phys-schost-2 執行。先複製磁碟區 /vo101,然後將其與新磁碟區 bkup-vol 關聯。


[Become superuser or assume a role that provides solaris.cluster.admin RBAC authorization on 
the primary node.]
[Identify the current primary node for the device group:]
# cldevicegroup status
-- Device Group Servers --
                         Device Group     Primary           Secondary
                         ------------     -------           ---------
 Device group servers:   rmt/1            -                 -
 Device group servers:   schost-1         phys-schost-2     phys-schost-1

-- Device Group Status --
                             Device Group        Status              
                             ------------        ------              
 Device group status:        rmt/1               Offline
 Device group status:        schost-1            Online
[List the device group information:]
# vxprint -g schost-1
TY NAME            ASSOC     KSTATE   LENGTH   PLOFFS STATE   TUTIL0  PUTIL0
dg schost-1       schost-1   -        -        -      -        -      -
  
dm schost-101     c1t1d0s2   -        17678493 -      -        -      -
dm schost-102     c1t2d0s2   -        17678493 -      -        -      -
dm schost-103     c2t1d0s2   -        8378640  -      -        -      -
dm schost-104     c2t2d0s2   -        17678493 -      -        -      -
dm schost-105     c1t3d0s2   -        17678493 -      -        -      -
dm schost-106     c2t3d0s2   -        17678493 -      -        -      -
 
v  vol01          gen        ENABLED  204800   -      ACTIVE   -      -
pl vol01-01       vol01      ENABLED  208331   -      ACTIVE   -      -
sd schost-101-01  vol01-01   ENABLED  104139   0      -        -      -
sd schost-102-01  vol01-01   ENABLED  104139   0      -        -      -
pl vol01-02       vol01      ENABLED  208331   -      ACTIVE   -      -
sd schost-103-01  vol01-02   ENABLED  103680   0      -        -      -
sd schost-104-01  vol01-02   ENABLED  104139   0      -        -      -
pl vol01-03       vol01      ENABLED  LOGONLY  -      ACTIVE   -      -
sd schost-103-02  vol01-03   ENABLED  5        LOG    -        -      -
[Start the snapshot operation:]
# vxassist -g schost-1 snapstart vol01
[Verify the new volume was created:]
# vxprint -g schost-1
TY NAME            ASSOC    KSTATE    LENGTH   PLOFFS STATE   TUTIL0  PUTIL0
dg schost-1       schost-1   -        -        -      -        -      -
  
dm schost-101     c1t1d0s2   -        17678493 -      -        -      -
dm schost-102     c1t2d0s2   -        17678493 -      -        -      -
dm schost-103     c2t1d0s2   -        8378640  -      -        -      -
dm schost-104     c2t2d0s2   -        17678493 -      -        -      -
dm schost-105     c1t3d0s2   -        17678493 -      -        -      -
dm schost-106     c2t3d0s2   -        17678493 -      -        -      -
  
v  vol01          gen        ENABLED  204800   -      ACTIVE   -      -
pl vol01-01       vol01      ENABLED  208331   -      ACTIVE   -      -
sd schost-101-01  vol01-01   ENABLED  104139   0      -        -      -
sd schost-102-01  vol01-01   ENABLED  104139   0      -        -      -
pl vol01-02       vol01      ENABLED  208331   -      ACTIVE   -      -
sd schost-103-01  vol01-02   ENABLED  103680   0      -        -      -
sd schost-104-01  vol01-02   ENABLED  104139   0      -        -      -
pl vol01-03       vol01      ENABLED  LOGONLY  -      ACTIVE   -      -
sd schost-103-02  vol01-03   ENABLED  5        LOG    -        -      -
pl vol01-04       vol01      ENABLED  208331   -      SNAPDONE -      -
sd schost-105-01  vol01-04   ENABLED  104139   0      -        -      -
sd schost-106-01  vol01-04   ENABLED  104139   0      -        -      -
[Stop data services, if necessary:]
# clresourcegroup offline nfs-rg
[Create a copy of the volume:]
# vxassist -g schost-1 snapshot vol01 bkup-vol
[Restart data services, if necessary:]
# clresourcegroup online -n phys-schost-1 nfs-rg
[Verify bkup-vol was created:]
# vxprint -g schost-1
TY NAME           ASSOC       KSTATE   LENGTH   PLOFFS STATE   TUTIL0  PUTIL0
dg schost-1       schost-1    -        -        -      -        -      -
 
dm schost-101     c1t1d0s2    -        17678493 -      -        -      -
...
 
v  bkup-vol       gen         ENABLED  204800   -      ACTIVE   -      -
pl bkup-vol-01    bkup-vol    ENABLED  208331   -      ACTIVE   -      -
sd schost-105-01  bkup-vol-01 ENABLED  104139   0      -        -      -
sd schost-106-01  bkup-vol-01 ENABLED  104139   0      -        -      -
 
v  vol01          gen         ENABLED  204800   -      ACTIVE   -      -
pl vol01-01       vol01       ENABLED  208331   -      ACTIVE   -      -
sd schost-101-01  vol01-01    ENABLED  104139   0      -        -      -
sd schost-102-01  vol01-01    ENABLED  104139   0      -        -      -
pl vol01-02       vol01       ENABLED  208331   -      ACTIVE   -      -
sd schost-103-01  vol01-02    ENABLED  103680   0      -        -      -
sd schost-104-01  vol01-02    ENABLED  104139   0      -        -      -
pl vol01-03       vol01       ENABLED  LOGONLY  -      ACTIVE   -      -
sd schost-103-02  vol01-03    ENABLED  5        LOG    -        -      -
[Synchronize the disk group with cluster framework:]
# cldevicegroup sync schost-1
[Check the file systems:]
# fsck -y /dev/vx/rdsk/schost-1/bkup-vol
[Copy bkup-vol to the backup device:]
# ufsdump 0ucf /dev/rmt/0 /dev/vx/rdsk/schost-1/bkup-vol
  DUMP: Writing 63 Kilobyte records
  DUMP: Date of this level 0 dump: Tue Apr 25 16:15:51 2000
  DUMP: Date of last level 0 dump: the epoch
  DUMP: Dumping /dev/vx/dsk/schost-2/bkup-vol to /dev/rmt/0.
  ...
  DUMP: DUMP IS DONE
[Remove the bkup-volume:]
# vxedit -rf rm bkup-vol
[Synchronize the disk group:]
# cldevicegroup sync schost-1

Procedure如何備份叢集配置

為確保您的叢集配置已歸檔並方便回復您的叢集配置,請定期備份您的叢集配置。Sun Cluster 3.2 具有將叢集配置匯出至可延伸標記語言 (XML) 檔案的功能。

  1. 登入叢集中的任何節點,並成為超級使用者,或成為提供 solaris.cluster.read RBAC 授權的角色。

  2. 將叢集配置資訊匯出到某一檔案。


    # /usr/cluster/bin/cluster/export -o configfile
    
    configfile

    XML 配置檔案的名稱 (叢集指令將叢集配置資訊匯出至此檔案)。如需有關 XML 配置檔案的資訊,請參閱 clconfiguration(5CL)

  3. 驗證叢集配置資訊是否已成功匯出至 XML 檔案。


    # vi configfile
    

復原叢集檔案

ufsrestore(1M) 指令從使用 ufsdump(1M) 指令建立的備份將檔案複製到與目前工作目錄相關的磁碟中。您可以使用 ufsrestore,從層次 0 傾印以及之後的增量傾印重新載入檔案系統階層,或從任何傾印磁帶復原一個或多個單一檔案。如果以超級使用者身份或等效角色執行 ufsrestore,則以原來的所有者、上次修改時間及模式 (權限) 復原檔案。

在開始復原檔案或檔案系統之前,您必須知道下列資訊。

表 11–2 作業說明:復原叢集檔案

作業 

指示 

至於 Solaris Volume Manager,會以互動的方式復原檔案 

如何以互動方式復原個別的檔案 (Solaris Volume Manager)

針對 Solaris Volume Manager,復原 root (/) 檔案系統

如何復原根 (/) 檔案系統 (Solaris Volume Manager)

  

如何復原 Solstice DiskSuite 中介裝置上或 Solaris Volume Manager 磁碟區上的根 (/) 檔案系統

對於 VERITAS Volume Manager,請復原非封裝的根 (/) 檔案系統

SPARC: 如何復原非封裝的根 (/) 檔案系統 (VERITAS Volume Manager)

對於 VERITAS Volume Manager,請復原封裝的根 (/) 檔案系統

SPARC: 如何復原封裝的根 (/) 檔案系統 (VERITAS Volume Manager)

Procedure如何以互動方式復原個別的檔案 (Solaris Volume Manager)

使用此程序復原一個或多個個別檔案。請先確認叢集執行時沒有出現錯誤,再執行復原程序。

  1. 成為超級使用者,或在您正在復原的叢集節點上成為提供 solaris.cluster.admin RBAC 授權的角色

  2. 停止所有使用要儲存之檔案的資料服務。


    # clresourcegroup offline resource-group
    
  3. 復原檔案。


    # ufsrestore
    

Procedure如何復原根 (/) 檔案系統 (Solaris Volume Manager)

可使用此程序將根 (/) 檔案系統復原至新的磁碟 (例如,在更換有故障的根磁碟後)。要復原的節點應該不在啟動狀態。請先確定叢集執行時沒有任何錯誤,再執行復原程序。


備註 –

由於您必須使用與故障磁碟相同的格式分割新磁碟,因此請在開始此程序前識別分割方案,然後相應地重新建立檔案系統。


此程序提供長形式的 Sun Cluster 指令。大多數指令還有簡短的形式。除了指令名稱有長形式和短形式之分外,指令本身是相同的。如需指令及其短形式的清單,請參閱附錄 ASun Cluster 以物件為導向的指令

  1. 成為超級使用者,或成為在可存取磁碟組的叢集節點上提供 solaris.cluster.modify RBAC 授權的角色。(要復原的節點也會連結到這個磁碟組。)

    使用您要復原的節點以外的節點。

  2. 從所有中介集合移除要復原的節點的主機名稱。

    從 metaset 中的節點執行這個指令,而不是從您正在移除的節點執行。由於回復的節點目前為離線,因此系統會顯示 RPC: Rpcbind failure - RPC: Timed out 錯誤。忽略此錯誤並繼續下一個步驟。


    # metaset -s setname -f -d -h nodelist
    
    -s setname

    指定磁碟組名稱。

    -f

    從磁碟組刪除最後一個主機。

    -d

    從磁碟組刪除。

    -h nodelist

    指定要從磁碟組刪除之節點的名稱。

  3. 復原根 (/) 檔案系統和 /usr 檔案系統。

    若要復原根檔案系統和 /usr 檔案系統,請按照「System Administration Guide: Devices and File Systems」中的第 26 章「Restoring Files and File Systems (Tasks)」所述程序進行操作。忽略 Solaris 作業系統程序中的步驟以重新啟動系統。


    備註 –

    確定您有建立 /global/.devices/node@nodeid 檔案系統。


  4. 以多使用者模式重新啟動節點。


    # reboot
    
  5. 更換磁碟 ID。


    # cldevice repair rootdisk
    
  6. 使用 metadb(1M) 指令重新建立狀態資料庫複本。


    # metadb -c copies -af raw-disk-device
    
    -c copies

    指定要建立的複本數目。

    -f raw-disk-device

    要在其上建立複本的原始裝置。

    -a

    新增複本。

  7. 從已復原的節點以外的叢集節點,將已復原的節點增加至所有磁碟組。


    phys-schost-2# metaset -s setname -a -h nodelist
    
    -a

    建立並增加主機至磁碟組。

    節點重新啟動為叢集模式。叢集已經備妥可以使用。


範例 11–6 復原根(/) 檔案系統 (Solaris Volume Manager)

以下範例顯示 root (/) 檔案系統復原至節點 phys-schost-1 (從磁帶裝置 /dev/rmt/0) 。從叢集中的另一個節點 phys-schost-2 執行 metaset 指令來進行移除,然後將節點 phys-schost-1 重新增加至磁碟組 schost-1。從 phys-schost-1 執行所有其他指令。在 /dev/rdsk/c0t0d0s0 上建立新的啟動區段,並在 /dev/rdsk/c0t0d0s4 上重新建立三個狀態資料庫複本。


[Become superuser or assume a  role that provides solaris.cluster.modify RBAC authorization on a cluster 
node other than the node to be restored
.]
[Remove the node from the metaset:]
phys-schost-2# metaset -s schost-1 -f -d -h phys-schost-1
[Replace the failed disk and boot the node:]
Restore the root (/) and /usr file system 
using the procedure in the Solaris system administration documentation
 [Reboot:]
# reboot
[Replace the disk ID:]
# cldevice repair /dev/dsk/c0t0d0
[Re-create state database replicas:]
# metadb -c 3 -af /dev/rdsk/c0t0d0s4
[Add the node back to the metaset:]
phys-schost-2# metaset -s schost-1 -a -h phys-schost-1

Procedure如何復原 Solstice DiskSuite 中介裝置上或 Solaris Volume Manager 磁碟區上的根 (/) 檔案系統

可使用此程序復原執行備份時 Solstice DiskSuite 中介裝置或 Solaris Volume Manager 磁碟區上的根 (/) 檔案系統。在根磁碟毀損而換成新磁碟等情況下執行這個程序。要復原的節點應該不在啟動狀態。請先確認叢集執行時沒有出現錯誤,再執行復原程序。


備註 –

由於您必須使用與故障磁碟相同的格式分割新磁碟,因此請在開始此程序前識別分割方案,然後相應地重新建立檔案系統。


此程序提供長形式的 Sun Cluster 指令。大多數指令還有簡短的形式。除了指令名稱有長形式和短形式之分外,指令本身是相同的。如需指令及其短形式的清單,請參閱附錄 ASun Cluster 以物件為導向的指令

  1. 在可存取磁碟組的叢集節點 (除了您復原的節點以外) 上,成為超級使用者,或成為提供 solaris.cluster.modifiy RBAC 授權的角色。

    使用您要復原的節點以外的節點。

  2. 從所有磁碟組移除要復原的節點的主機名稱。


    # metaset -s setname -f -d -h nodelist
    
    -s setname

    指定 metaset 名稱。

    -f

    從磁碟組刪除最後一個主機。

    -d

    從 metaset 刪除。

    -h nodelist

    指定要從 metaset 刪除之節點的名稱。

  3. 置換節點上要復原 root (/) 檔案系統的故障磁碟。

    請參閱隨附伺服器之文件中敘述的磁碟置換程序。

  4. 啟動您要復原的節點。

    • 如果您使用的是 Solaris 作業系統 CD,請注意以下事項:

      • SPARC:鍵入:


        ok boot cdrom -s
        
      • x86:將 CD 插入系統的 CD 光碟機中,並透過關閉系統之後再開啟系統來啟動系統。在 [Current Boot Parameters] (目前啟動參數) 畫面上,鍵入 bi


                             <<< Current Boot Parameters >>>
        Boot path: /pci@0,0/pci8086,2545@3/pci8086,1460@1d/pci8086,341a@
        7,1/sd@0,0:a
        Boot args:
        
        Type b [file-name] [boot-flags] <ENTER> to boot with options
        or   i <ENTER>                          to enter boot interpreter
        or   <ENTER>                            to boot with defaults
        
                         <<< timeout in 5 seconds >>>
        Select (b)oot or (i)nterpreter: b -s
        
    • 如果您使用的是 Solaris JumpStartTM 伺服器,請注意以下事項:

      • SPARC:鍵入:


        ok boot net -s
        
      • x86:將 CD 插入系統的 CD 光碟機中,並透過關閉系統之後再開啟系統來啟動系統。在 [Current Boot Parameters] (目前啟動參數) 畫面上,鍵入 bi


                             <<< Current Boot Parameters >>>
        Boot path: /pci@0,0/pci8086,2545@3/pci8086,1460@1d/pci8086,341a@
        7,1/sd@0,0:a
        Boot args:
        
        Type b [file-name] [boot-flags] <ENTER> to boot with options
        or   i <ENTER>                          to enter boot interpreter
        or   <ENTER>                            to boot with defaults
        
                         <<< timeout in 5 seconds >>>
        Select (b)oot or (i)nterpreter: b -s
        
  5. 使用 format 指令,在根磁碟上建立所有的分割區與交換空間。

    重新建立故障磁碟的原始分割機制。

  6. 使用 newfs 指令,適當建立根 (/) 檔案系統以及其他檔案系統

    重新建立故障磁碟的原始檔案系統。


    備註 –

    確定您有建立 /global/.devices/node@nodeid 檔案系統。


  7. 將 root (/) 檔案系統裝載到暫時裝載點。


    # mount device temp-mountpoint
    
  8. 使用下列指令復原根 (/) 檔案系統。


    # cd temp-mountpoint
    # ufsrestore rvf dump-device
    # rm restoresymtable
    
  9. 在新磁碟上安裝新的啟動區段。


    # /usr/sbin/installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk 
    raw-disk-device
    
  10. 移除在 /temp-mountpoint/etc/system 檔中 MDD 根資訊的行。


    * Begin MDD root info (do not edit)
    forceload: misc/md_trans
    forceload: misc/md_raid
    forceload: misc/md_mirror
    forceload: misc/md_hotspares
    forceload: misc/md_stripe
    forceload: drv/pcipsy
    forceload: drv/glm
    forceload: drv/sd
    rootdev:/pseudo/md@0:0,10,blk
    * End MDD root info (do not edit)
  11. 編輯 /temp-mountpoint/etc/vfstab 檔案,將根項目從 Solstice DiskSuite 中介裝置或 Solaris Volume Manager 磁碟區變更為屬於該中介裝置或磁碟區的根磁碟上每個檔案系統的相應正常磁碟片段。


    Example: 
    Change from—
    /dev/md/dsk/d10   /dev/md/rdsk/d10    /      ufs   1     no       -
    
    Change to—
    /dev/dsk/c0t0d0s0 /dev/rdsk/c0t0d0s0  /      ufs   1     no       -
  12. 卸載暫時檔案系統,並檢查原始磁碟裝置。


    # cd /
    # umount temp-mountpoint
    # fsck raw-disk-device
    
  13. 以多使用者模式重新啟動節點。


    # reboot
    
  14. 更換磁碟 ID。


    # cldevice repair rootdisk
    
  15. 使用 metadb 指令重新建立狀態資料庫副本。


    # metadb -c copies -af raw-disk-device
    
    -c copies

    指定要建立的複本數目。

    -af raw-disk-device

    在指名的原始磁碟裝置上建立初始狀態資料庫複本。

  16. 從已復原的節點以外的叢集節點,將已復原的節點新增至所有磁碟組。


    phys-schost-2# metaset -s setname -a -h nodelist
    
    -a

    新增 (建立) metaset。

    依照 Solstice DiskSuite 文件,為根 (/) 設置中介裝置或磁碟區/鏡像。

    節點重新啟動為叢集模式。叢集已經備妥可以使用。


範例 11–7 復原 Solstice DiskSuite 中介裝置或 Solaris Volume Manager 磁碟區上的根 (/) 檔案系統

以下範例顯示 root (/) 檔案系統復原至節點 phys-schost-1 (從磁帶裝置 /dev/rmt/0) 。從叢集中的另一個節點 phys-schost-2 執行 metaset 指令來進行移除,然後將節點 phys-schost-1 重新增加至 metaset schost-1。所有其他指令是由 phys-schost-1 執行。在 /dev/rdsk/c0t0d0s0 上建立新的啟動區段,並在 /dev/rdsk/c0t0d0s4 上重新建立三個狀態資料庫複本。


[Become superuser or assume a role that provides solaris.cluster.modify RBAC authorization on a cluster node with 
access to the metaset, other than the node to be restored.]
[Remove the node from the metaset:]
phys-schost-2# metaset -s schost-1 -f -d -h phys-schost-1
[Replace the failed disk and boot the node:]

從 Solaris 作業系統 CD 啟動節點︰


[Use format and newfs to re-create partitions and file systems
.]
[Mount the root file system on a temporary mount point:]
# mount /dev/dsk/c0t0d0s0 /a
[Restore the root file system:]
# cd /a
# ufsrestore rvf /dev/rmt/0
# rm restoresymtable
[Install a new boot block:]
# /usr/sbin/installboot /usr/platform/`uname \
-i`/lib/fs/ufs/bootblk /dev/rdsk/c0t0d0s0

[Remove the lines in / temp-mountpoint/etc/system file for MDD root information:
]
* Begin MDD root info (do not edit)
forceload: misc/md_trans
forceload: misc/md_raid
forceload: misc/md_mirror
forceload: misc/md_hotspares
forceload: misc/md_stripe
forceload: drv/pcipsy
forceload: drv/glm
forceload: drv/sd
rootdev:/pseudo/md@0:0,10,blk
* End MDD root info (do not edit)
[Edit the /temp-mountpoint/etc/vfstab file]
Example: 
Change from—
/dev/md/dsk/d10   /dev/md/rdsk/d10    /      ufs   1     no       -

Change to—
/dev/dsk/c0t0d0s0 /dev/rdsk/c0t0d0s0  /usr   ufs   1     no       -
[Unmount the temporary file system and check the raw disk device:]
# cd /
# umount /a
# fsck /dev/rdsk/c0t0d0s0
[Reboot:]
# reboot
[Replace the disk ID:]
# cldevice repair /dev/rdsk/c0t0d0
[Re-create state database replicas:]
# metadb -c 3 -af /dev/rdsk/c0t0d0s4
[Add the node back to the metaset:]
phys-schost-2# metaset -s schost-1 -a -h phys-schost-1

ProcedureSPARC: 如何復原非封裝的根 (/) 檔案系統 (VERITAS Volume Manager)

可使用此程序將非封裝的根 (/) 檔案系統復原至節點。要復原的節點應該不在啟動狀態。請先確定叢集執行時沒有任何錯誤,再執行復原程序。


備註 –

由於您必須使用與故障磁碟相同的格式分割新磁碟,因此請在開始此程序前識別分割方案,然後相應地重新建立檔案系統。


此程序提供長形式的 Sun Cluster 指令。大多數指令還有簡短的形式。除了指令名稱有長形式和短形式之分外,指令本身是相同的。如需指令及其短形式的清單,請參閱附錄 ASun Cluster 以物件為導向的指令

  1. 替代節點上要復原根檔案系統的故障磁碟。

    請參閱隨附伺服器之文件中敘述的磁碟置換程序。

  2. 啟動您要復原的節點。

    • 如果您使用的是 Solaris 作業系統 CD,請在 OpenBoot PROM ok 提示符號下,鍵入以下指令:


      ok boot cdrom -s
      
    • 如果您使用的是 Solaris JumpStart 伺服器,在出現 OpenBoot PROM ok 提示符號時,請鍵入以下指令︰


      ok boot net -s
      
  3. 使用 format 指令,在根磁碟上建立所有分割區與交換空間。

    重新建立故障磁碟的原始分割機制。

  4. 使用 newfs 指令,適當建立根 (/) 檔案系統以及其他檔案系統。

    重新建立故障磁碟的原始檔案系統。


    備註 –

    確定您有建立 /global/.devices/node@nodeid 檔案系統。


  5. 將 root (/) 檔案系統裝載到暫時裝載點。


    # mount device temp-mountpoint
    
  6. 從備份復原根 (/) 檔案系統,同時卸載並檢查檔案系統。


    # cd temp-mountpoint
    # ufsrestore rvf dump-device
    # rm restoresymtable
    # cd /
    # umount temp-mountpoint
    # fsck raw-disk-device
    

    檔案系統現在完成復原。

  7. 在新磁碟上安裝新的啟動區段。


    # /usr/sbin/installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk raw-disk-device
    
  8. 以多使用者模式重新啟動節點。


    # reboot
    
  9. 更新磁碟 ID。


    # cldevice repair /dev/rdsk/disk-device
    
  10. 按下 Ctrl-d 重新啟動為多重使用者模式。

    節點將重新啟動為叢集模式。叢集已經備妥可以使用。


範例 11–8 SPARC: 復原非封裝的根 (/) 檔案系統 (VERITAS Volume Manager)

以下範例顯示從磁帶裝置 /dev/rmt/0 復原至節點 phys-schost-1 的非封裝根 (/) 檔案系統。


[Replace the failed disk and boot the node:]

從 Solaris 作業系統 CD 啟動節點︰出現 OpenBoot PROM ok 提示符號時,請鍵入以下指令︰


ok boot cdrom -s
...
[Use format and newfs to create partitions and file systems]
[Mount the root file system on a temporary mount point:]
# mount /dev/dsk/c0t0d0s0 /a
[Restore the root file system:]
# cd /a
# ufsrestore rvf /dev/rmt/0
# rm restoresymtable
# cd /
# umount /a
# fsck /dev/rdsk/c0t0d0s0
[Install a new boot block:]
# /usr/sbin/installboot /usr/platform/`uname \
-i`/lib/fs/ufs/bootblk /dev/rdsk/c0t0d0s0

[Reboot:]
# reboot
[Update the disk ID:]
# cldevice repair /dev/rdsk/c0t0d0

ProcedureSPARC: 如何復原封裝的根 (/) 檔案系統 (VERITAS Volume Manager)

可使用此程序將封裝的根 (/) 檔案系統復原至節點。要復原的節點應該不在啟動狀態。請先確定叢集執行時沒有任何錯誤,再執行復原程序。


備註 –

由於您必須使用與故障磁碟相同的格式分割新磁碟,因此請在開始此程序前識別分割方案,然後相應地重新建立檔案系統。


此程序提供長形式的 Sun Cluster 指令。大多數指令還有簡短的形式。除了指令名稱有長形式和短形式之分外,指令本身是相同的。如需指令及其短形式的清單,請參閱附錄 ASun Cluster 以物件為導向的指令

  1. 替代節點上要復原根檔案系統的故障磁碟。

    請參閱隨附伺服器之文件中敘述的磁碟置換程序。

  2. 啟動您要復原的節點。

    • 如果您使用的是 Solaris 作業系統 CD,請在 OpenBoot PROM ok 提示符號下,鍵入以下指令:


      ok boot cdrom -s
      
    • 如果您使用的是 Solaris JumpStart 伺服器,在出現 OpenBoot PROM ok 提示符號時,請鍵入以下指令︰


      ok boot net -s
      
  3. 使用 format 指令,在根磁碟上建立所有的分割區與交換空間。

    重新建立故障磁碟的原始分割機制。

  4. 使用 newfs 指令,適當建立根 (/) 檔案系統以及其他檔案系統。

    重新建立故障磁碟的原始檔案系統。


    備註 –

    確定您要建立 /global/.devices/node@nodeid 檔案系統。


  5. 將 root (/) 檔案系統裝載到暫時裝載點。


    # mount device temp-mountpoint
    
  6. 從備份復原 root (/) 檔案系統。


    # cd temp-mountpoint
    # ufsrestore rvf dump-device
    # rm restoresymtable
    
  7. 建立空的 install-db 檔。

    此檔案將使節點在下次重新啟動時進入 VxVM 安裝模式。


    # touch \
    /temp-mountpoint/etc/vx/reconfig.d/state.d/install-db
    
  8. / temp-mountpoint/etc/system 檔案中移除以下條目。


    * rootdev:/pseudo/vxio@0:0
    * set vxio:vol_rootdev_is_volume=1
  9. 編輯 /temp-mountpoint /etc/vfstab 檔案,並使用根磁碟的標準磁碟裝置替代所有 VxVM 掛載點,例如 /dev/dsk/c0t0d0s0


    Example: 
    Change from—
    /dev/vx/dsk/rootdg/rootvol /dev/vx/rdsk/rootdg/rootvol /      ufs   1     no -
    
    Change to—
    /dev/dsk/c0t0d0s0 /dev/rdsk/c0t0d0s0  / ufs   1     no       -
  10. 卸載暫時檔案系統,並檢查檔案系統。


    # cd /
    # umount temp-mountpoint
    # fsck raw-disk-device
    
  11. 在新磁碟上安裝啟動區段。


    # /usr/sbin/installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk raw-disk-device
    
  12. 以多使用者模式重新啟動節點。


    # reboot
    
  13. 使用 scdidadm(1M) 更新磁碟 ID。


    # cldevice repair /dev/rdsk/c0t0d0
    
  14. 執行 vxinstall 指令以封裝磁碟並重新開機。

  15. 如果有某個次要編號和其他系統發生衝突,請卸載全域裝置並重新指定磁碟群組。

    • 卸載叢集節點上的全域裝置檔案系統。


      # umount /global/.devices/node@nodeid
      
    • 重新指定叢集節點上的 rootdg 磁碟群組的次要編號。


      # vxdg reminor rootdg 100
      
  16. 在叢集模式下關閉,並重新啟動節點。


    # shutdown -g0 -i6 -y
    

範例 11–9 SPARC: 復原封裝的根 (/) 檔案系統 (VERITAS Volume Manager)

以下範例顯示封裝的 root (/) 檔案系統復原至節點 phys-schost-1 (從磁帶裝置 /dev/rmt/0)。


[Replace the failed disk and boot the node:]

從 Solaris 作業系統 CD 啟動節點︰出現 OpenBoot PROM ok 提示符號時,請鍵入以下指令︰


ok boot cdrom -s
...
[Use format and newfs to create partitions and file systems]
[Mount the root file system on a temporary mount point:]
# mount /dev/dsk/c0t0d0s0 /a
[Restore the root file system:]
# cd /a
# ufsrestore rvf /dev/rmt/0
# rm restoresymtable
[Create an empty install-db file:]
# touch /a/etc/vx/reconfig.d/state.d/install-db
[Edit /etc/system on the temporary file system and 
remove or comment out the following entries:]
	# rootdev:/pseudo/vxio@0:0
	# set vxio:vol_rootdev_is_volume=1
[Edit /etc/vfstab on the temporary file system:]
Example: 
Change from—
/dev/vx/dsk/rootdg/rootvol /dev/vx/rdsk/rootdg/rootvol / ufs 1 no-

Change to—
/dev/dsk/c0t0d0s0 /dev/rdsk/c0t0d0s0  / ufs   1     no       -
[Unmount the temporary file system, then check the file system:]
# cd /
# umount /a
# fsck /dev/rdsk/c0t0d0s0
[Install a new boot block:]
# /usr/sbin/installboot /usr/platform/`uname \
-i`/lib/fs/ufs/bootblk /dev/rdsk/c0t0d0s0

[Reboot:]
# reboot
[Update the disk ID:]
# cldevice repair /dev/rdsk/c0t0d0
[Encapsulate the disk::]
# vxinstall
Choose to encapsulate the root disk.
[If a conflict  in minor number occurs, reminor the rootdg disk group
:]
# umount /global/.devices/node@nodeid
# vxdg reminor rootdg 100
# shutdown -g0 -i6 -y

另請參閱

如需有關如何鏡像封裝的根磁碟的指示,請參閱「Sun Cluster 軟體安裝指南 (適用於 Solaris 作業系統)」