Sun Cluster 3.0 系统管理指南

第 8 章 备份并恢复群集

以下是本章中的分步说明。

8.1 备份群集文件

表 8-1 任务图:备份群集文件

任务 

有关说明,请转到... 

查找您要备份的文件系统的名称。 

"8.1.1 如何查找要备份的文件系统的名称"

计算存放一个完全备份需要多少磁带。 

"8.1.2 如何确定完全备份所需要的磁带数"

备份根文件系统。 

"8.1.3 如何备份根 (/) 文件系统"

为镜像的文件系统或网状文件系统执行联机备份。 

"8.1.4 如何执行镜像的联机备份 (Solstice DiskSuite)"

"8.1.5 如何执行卷的联机备份 (VERITAS 卷管理器)"

8.1.1 如何查找要备份的文件系统的名称

请遵照此过程来确定您要备份的文件系统的名称。

  1. 显示 /etc/vfstab 文件的内容。

    运行此命令不需要成为超级用户。


    % more /etc/vfstab
    
  2. 在安装点列中查找要备份的文件系统的名称。

    请在备份文件系统时使用此名称。


    % more /etc/vfstab 
    

8.1.1.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      -

8.1.2 如何确定完全备份所需要的磁带数

按照此过程来计算备份一个文件系统将需要的磁带数。

  1. 成为您要备份的群集节点上的超级用户。

  2. 估计备份的大小,以字节为单位。


    # ufsdump S filesystem 
    
    S

    显示执行该备份估计需要的字节数。

    filesystem

    指定您要备份的文件系统的名称。

  3. 用磁带容量去除估算大小,看需要多少磁带。

8.1.2.1 示例-确定所需要的磁带数

在以下示例中,905,881,620 字节将轻松装入一个 4 GB 磁 带 (905,881,620 / 4,000,000,000) 上。


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

8.1.3 如何备份根 (/) 文件系统

按照此过程来备份一个群集节点的根 (/) 文件系统。在执行此备份过程前确保群集无故障运行。

  1. 成为您要备份的群集节点上的超级用户。

  2. 将每项运行中的数据服务从要备份的节点切换到群集中的另一节点。


    # scswitch -z -D disk-device-group -h node
    
    -z

    执行切换。

    -D disk-device-group

    磁盘设备组的名称,与磁盘集或磁盘组的名称相同。

    -h node

    充当磁盘设备组的主节点的群集节点的名称。

  3. 停止该节点。


    # shutdown -g0 -y
    
  4. ok 提示符下,以非群集模式重新引导。


    ok boot -x
    
  5. 备份根 (/) 文件系统。

    • 如果根磁盘未封装,请使用以下命令。


      # ufsdump 0ucf dump-device /
      
    • 如果根磁盘已封装,请使用以下命令。


      # ufsdump 0ucf dump-device /dev/vx/rdsk/rootvol
      

    有关详细信息,请参考 ufsdump(1M) 手册页。

  6. 以群集模式重新引导该节点。


    # init 6
    

8.1.3.1 示例-备份根 (/) 文件系统

在以下示例中,根 (/) 文件系统备份到了磁盘 设备 /dev/rmt/0 上。


# ufsdump 0ucf /dev/rmt/0 /
  DUMP: Writing 63 Kilobyte records
  DUMP: Date of this level 0 dump: Tue Apr 18 18:06:15 2000
  DUMP: Date of last level 0 dump: the epoch
  DUMP: Dumping /dev/rdsk/c0t0d0s0 (phys-schost-1:/) to /dev/rmt/0
  DUMP: Mapping (Pass I) [regular files]
  DUMP: Mapping (Pass II) [directories]
  DUMP: Estimated 859086 blocks (419.48MB).
  DUMP: Dumping (Pass III) [directories]
  DUMP: Dumping (Pass IV) [regular files]
  DUMP: 859066 blocks (419.47MB) on 1 volume at 2495 KB/sec
  DUMP: DUMP IS DONE
  DUMP: Level 0 dump on Tue Apr 18 18:06:15 2000

8.1.4 如何执行镜像的联机备份 (Solstice DiskSuite)

不用卸装一个镜像的元设备或使整个镜像脱机,就可以备份该镜 像的元设备。必须使其子镜像之一临时脱机,因而它就失去了镜像,但备份完成后可立即使之联机并再 同步;这样就不必停止系统,也不用拒绝用户访问数据。使用镜像来执行联机备份可创建活动文件 系统的“快照”备份。

如果一个程序在卷上写入了数据后 lockfs 命令随即运行,则可能 会发生故障。要避免此故障,请暂时停止在此节点上运行的所有服务。此外,请在执行此备份过程前确保群集无故障运行。

  1. 成为您要备份的群集节点上的超级用户。

  2. 请使用 metaset(1M) 命令来确定哪一个节点对备份的卷具有拥有权。


    # metaset -s setname
    
    -s setname

    指定磁盘集名称。

  3. 使用 lockfs(1M) 命令和 -w 选项来锁定文件系统的写操作。


    # lockfs -w mount-point 
    


    注意:

    仅在镜像上驻留着一个 UFS 文件系统时才必须锁定此文件系统。例如,如果元设备被设置 为数据库管理软件或其他某个特定的应用程序的原始设备,就不必使用 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 mount-point
    

  7. 执行文件系统检查。


    # fsck /dev/md/diskset/rdsk/submirror
    
  8. 将脱机子镜像备份到磁带或另一介质上。

    使用 ufsdump(1M) 命令或其他您通常使用的无论什么备份公用程序。


    注意:

    让子镜像使用原始设备 (/rdsk) 名称,而不使用块 设备 (/dsk) 名称。



    # ufsdump 0ucf dump-device submirror
    
  9. 使用 metattach(1M) 命令来使元设备重新联机。


    # metattach -s setname mirror submirror
    

    使元设备联机后,它自动地重新与镜像同步。

  10. 使用 metastat 命令来检验子镜像是否在重新同步。


    # metastat -s setname mirror
    

8.1.4.1 示例-执行镜像的联机备份 (Solstice DiskSuite)

在以下示例中,群集节点 phys-schost-1 是 元集 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
[Resync 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)
...

8.1.5 如何执行卷的联机备份 (VERITAS 卷管理器)

VERITAS Volume Manager 将一个镜像的卷识别为一个丛。不用卸装一个丛或使整个卷脱机,就可以 备份该镜像的元设备。这是通过创建卷的快照副本并备份此临时卷来完成的,不用停止系统或拒绝用户对数据的访问。

在执行此备份过程前确保群集无故障运行。

  1. 登录到群集中的任一节点上,并成为群集中该磁盘组的当前主节点上的超级用户。

  2. 列出磁盘组信息。


    # vxprint -g diskgroup
    
  3. 运行 scstat(1M) 来查看哪个节点当前导入了磁盘组,导入了磁盘组即表示它是磁盘组的主节点。


    # scstat -D
    
    -D

    显示所有磁盘设备组的状态。

  4. 使用 vxassist(1M) 命令创建卷的一个快照。


    # vxassist -g diskgroup snapstart volume
    

    注意:

    创建快照可能需要很长一段时间,时间的长度取决于卷的大小。


  5. 使用 vxprint(1M) 命令来检验已创建新卷。


    # vxprint -g diskgroup
    

    当快照完成后,所选择的磁盘组的 State 字段会 显示 Snapdone 状态。

  6. 停止正在使用 scswitch(1M) 命令访问文件系统的任何数据服务。


    # scswitch -z -g nfs-rg -h ""
    

    注意:

    建议停止数据服务,以确保正确备份数据文件系统。如果没有数据服务在运行中,则不必 执行步骤 6步骤 8


  7. 创建一个名为 bkup-vol 的备份卷并 使用 vxassist 命令将快照卷连接到此备份卷。


    # vxassist -g diskgroup snapshot volume bkup-vol
    
  8. 使用 scswitch 命令,重新启动在 步骤 6 中停止的任何数据服务。


    # scswitch -z -g nfs-rg -h nodename
    
  9. 使用 vxprint 命令,检验该卷此时是否连接到了 新卷 bkup-vol


    # vxprint -g diskgroup
    
  10. 使用 scconf(1M) 命令注册磁盘组配置更改。


    # scconf -c -D name=diskgroup,sync
    
  11. 使用 fsck 命令检查备份卷。


    # 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(1M) 移除临时卷。


    # vxedit -rf rm bkup-vol
    
  14. 使用 scconf 命令注册磁盘组配置更改。


    # scconf -c -D name=disk-group,sync
    

8.1.5.1 示例-执行卷的联机备份 (VERITAS 卷管理器)

在以下示例中,群集节点 phys-schost-2 是元集磁盘 组 schost-1 的主属主,所以备份过程是从 phys-schost-2 开 始执行的。卷 /vo101 被复制,然后与一个新卷 bkup-vol 关联。


[Become superuser on the primary node.]
[Identify the current primary node for the disk group:]
# scstat -D
-- 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 disk 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:]
# scswitch -z -g nfs-rg -h ""
[Create a copy of the volume:]
# vxassist -g schost-1 snapshot vol01 bkup-vol
[Restart data services, if necessary:]
# scswitch -z -g nfs-rg -h phys-schost-1
[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 -      -        -      -
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  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:]
# scconf -c -D name=schost-1,sync
[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:]
# scconf -c -D name=schost-1,sync

8.2 群集文件恢复概述

ufsrestore 命令从使 用 ufsdump 命令创建的备份,将文件复制到与当前工作目录相关的 磁盘。您可以使用 ufsrestore 来从 0 级转储和其后更高级别的转储 重新装入一个完整的文件系统结构,或从任何转储磁带恢复一个或多个单个文件。如 果 ufsrestore 以超级用户用户身份运行,文件就会恢复给原属主、恢复到 上次修改时间并恢复模式(许可)。

在开始恢复文件前,您需要了解:

8.3 恢复群集文件

表 8-2 任务图:恢复群集文件

任务 

有关说明,请转到... 

对于 Solstice DiskSuite,请按 Solaris 恢复过程以互动方式恢复文件。 

"8.3.1 如何以互动方式恢复单个文件 (Solstice DiskSuite)"

为 Solstice DiskSuite 恢复根 (/) 文件系统。

"8.3.2 如何恢复根 (/) 文件系统 (Solstice DiskSuite)"

 

"8.3.3 如何恢复元设备 (Solstice DiskSuite) 上的 根 (/) 文件系统"

为 VERITAS 卷管理器,恢复恢复一个未封装的根 (/) 文件系统。 

"8.3.4 如何恢复未封装 的根 (/) 文件系统 (VERITAS 卷管理器)"

为 VERITAS 卷管理器 恢复一个封装的根 (/) 文件系统。 

"8.3.5 如何恢复未封装的根 (/) 文件系统 (VERITAS 卷管理器)"

8.3.1 如何以互动方式恢复单个文件 (Solstice DiskSuite)

按照此过程恢复一个或多个单个文件。在执行此恢复过程前确保群集无故障运行。

  1. 成为您要恢复的群集节点上的超级用户。

  2. 停止所有正在使用要恢复的文件的数据服务。


    # scswitch -z -g rgname -h ""
    
  3. 使用 ufsrestore 命令来恢复这些文件。

8.3.2 如何恢复根 (/) 文件系统 (Solstice DiskSuite)

按照此过程将根 (/) 文件系统恢复一个新磁盘,比如在更换一个坏的根 磁盘后。不应引导正在恢复的节点。在执行此恢复过程前确保群集无故障运行。


注意:

由于必须使用失败的磁盘的格式来给新的磁盘进行分区,所以在进行此过程前必须识别 分区方案,并相应地重新创建文件系统。


  1. 成为要恢复的节点之外的一个群集节点上的超级用户。

  2. 使用 metaset(1M) 命令可移除要从所有元集中恢复的节点的主 机名。在元集中您要移除的节点之外的节点上运行此命令。


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

    指定磁盘集名称。

    -f

    强制。

    -d

    从磁盘集中删除。

    -h node

    指定要从磁盘集中删除的节点的名称。

  3. 在要恢复其上的根 (/) 文件系统的节点上更换失败的磁盘。

    请参考服务器附带的文档中的磁盘更换过程。

  4. 引导要恢复的节点。

    • 如果使用 Solaris CD-ROM,请运行以下命令:


      ok boot cdrom -s
      
    • 如果使用 JumpStartTM 服务器,请运行下面的命令:


      ok boot net -s
      
  5. 使用 format(1M) 命令在根磁盘上创建所有的分区和交换。

    重建失败的磁盘上的原分区方案。

  6. 使用 newfs(1M) 命令,相应地创建根 (/) 文件系统和其他文件系统。

    重建失败的磁盘上的原文件系统。


    注意:

    确保创建 /global/.devices/node@nodeid 文件系统。


  7. 在一个临时安装点上安装根 (/) 文件系统。


    # mount device temp-mount-point
    
  8. 使用下面的命令来恢复根 (/) 文件系统。


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

    此时文件系统已恢复。

  9. 在新磁盘上安装一个新引导块。


    # /usr/sbin/installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk raw-disk-device
    
  10. 以单用户模式重新引导节点。


    # reboot -- "-s"
    
  11. 使用 scdidadm 命令更换磁盘 ID。


    # scdidadm -R rootdisk
    
  12. 使用 metadb(1M) 命令来重建状态数据库复制品。


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

    指定要创建的复制器的编号。

    -f raw-disk-device

    在其上创建复制器的原始磁盘设备。

    -a

    添加复制器。

  13. 以群集模式重新引导该节点。

    1. 启动重新引导。


      # reboot
      

      在此引导过程中,您可能会看到一个错误消息或警告消息,其结尾部分是以下指令:


      Type control-d to proceed with normal startup,
      (or give root password for system maintenance):
    2. 按下 CTRL-d 以引导到多用户模式下。

  14. 从已恢复的节点之外的一个群集节点,使用 metaset(1M) 命令来 将恢复的节点添加到所有的元集中。


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

    创建并将主机添加到磁盘集中。

    节点已引导到群集模式下。群集已经就绪。

8.3.2.1 示例-恢复根 (/) 文件系统 (Solstice DiskSuite)

以下示例展示从磁带设备 /dev/rmt/0 恢复 到 phys-schost-1 根 (/) 文件 系统。从群集中的另一节点 phys-schost-2 运行 了 metaset 命令,以移除节点 phys-schost-1,稍后再 将它重新添加到 schost-1 中。所有其他命令都是 从 phys-schost-1 上运行的。/dev/rdsk/c0t0d0s0 上创建 了一个新的引导块,/dev/rdsk/c0t0d0s4 上重建了三个状态数据库复制器。


[Become superuser 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:]
ok boot cdrom -s
[Use format and newfs to recreate 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 in single-user mode:]
# reboot -- "-s"
[Replace the disk ID:]
# scdidadm -R /dev/dsk/c0t0d0
[Recreate state database replicas:]
# metadb -c 3 -af /dev/rdsk/c0t0d0s4
# reboot
Press CTL-d to boot into multiuser mode.
[Add the node back to the metaset:]
phys-schost-2# metaset -s schost-1 -a -h phys-schost-1

8.3.3 如何恢复元设备 (Solstice DiskSuite) 上的 根 (/) 文件系统

使用此过程来恢复执行备份时元设备上存在的根 (/) 文件系统。比如在 根磁盘损坏后更换新磁盘时,就可以执行此过程。不应引导正在恢复的节点。在执行此恢复过程前确保群集无故障运行。


注意:

由于必须使用失败的磁盘的格式来给新的磁盘进行分区,所以在进行此过程前必须识别 分区方案,并相应地重新创建文件系统。


  1. 在您要恢复的节点之外的、一个有权访问元集的群集 节点上的超级用户。

  2. 使用 metaset(1M) 命令来 从所有元集中移除要恢复的节点的主机名。


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

    指定元集名称。

    -f

    强制。

    -d

    从元集中删除。

    -h node

    指定要从元集中删除的节点的名称。

  3. 在要恢复其上的根 (/) 文件系统的节点上更换失败的磁盘。

    请参考服务器附带的文档中的磁盘更换过程。

  4. 引导要恢复的节点。

    • 如果使用 Solaris CD-ROM,请运行以下命令:


      ok boot cdrom -s
      
    • 如果使用一个 JumpStart 服务器,则运行以下命令:


      ok boot net -s
      
  5. 使用 format(1M) 命令在根磁盘上创建所有的分区和交换。

    重建失败的磁盘上的原分区方案。

  6. 使用 newfs(1M) 命令,相应地创建根 (/) 文件系统和其他文件系统

    重建失败的磁盘上的原文件系统。


    注意:

    确保创建 /global/.devices/node@nodeid 文件系统。


  7. 在一个临时安装点上安装根 (/) 文件系统。


    # mount device temp-mount-point
    

  8. 使用下列名称来恢复根 (/) 文件系统。


    # cd  temp-mount-point
    # ufsrestore rvf dump-device
    # rm restoresymtable
    

  9. 在新磁盘上安装一个新引导块。


    # /usr/sbin/installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk raw-disk-device
    
  10. /temp-mount-point/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-mount-point/etc/vfstab 文件以将根项从元设备更改到对应的 一个正常片上。


    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       -
  12. 卸载临时文件系统并检查原始磁盘设备。


    # cd /
    # umount  temp-mount-point
    # fsck raw-disk-device
    
  13. 以单用户模式重新引导节点。


    # reboot -- "-s"
    
  14. 使用 scdidadm 命令更换磁盘 ID。


    # scdidadm -R rootdisk
    
  15. 使用 metadb(1M) 命令来重建状态数据库复制品。


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

    指定要创建的复制器的编号。

    -af raw-disk-device

    在指定的原始磁盘设备上创建初始状态数据库复制品。

  16. 以群集模式重新引导该节点。

    1. 启动重新引导。


      # reboot
      

      在此引导过程中,您将看到错误消息或警告消息,其结尾部分是以下指令:


      Type control-d to proceed with normal startup,
      (or give root password for system maintenance):
    2. 按下 CTRL-d 以引导到多用户模式下。

  17. 从已恢复的节点之外的一个群集节点,使用 metaset(1M) 命令来 将恢复的节点添加到所有的元集中。


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

    添加(创建)元集。

    根据 Solstice DiskSuite 文档为根 (/) 设置元设备/镜像。

    节点已引导到群集模式下。群集已经就绪。

8.3.3.1 示例-恢复元设备 (Solstice DiskSuite) 上原有的根 (/) 文件系统

以下示例展示从磁带设备 /dev/rmt/0 恢复到 节点 phys-schost-1 的根 (/) 文件 系统。从群集中的另一节点 phys-schost-2 运行 了 metaset 命令,以移除 phys-schost-1,稍后再将它 重新添加到元集 schost-1 中。所有其他命令都是 从 phys-schost-1 上运行的。/dev/rdsk/c0t0d0s0 上创建 了一个新的引导块,/dev/rdsk/c0t0d0s4 上重建了三个状态数据库复制器。


[Become superuser 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:]
ok boot cdrom -s
[Use format and newfs to recreate 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-mount-point/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-mount-point/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 in single-user mode:]
# reboot -- "-s"
[Replace the disk ID:]
# scdidadm -R /dev/dsk/c0t0d0
[Recreate state database replicas:]
# metadb -c 3 -af /dev/rdsk/c0t0d0s4
# reboot
Type CTRL-d to boot into multiuser mode.
[Add the node back to the metaset:]
phys-schost-2# metaset -s schost-1 -a -h phys-schost-1

8.3.4 如何恢复未封装 的根 (/) 文件系统 (VERITAS 卷管理器)

按照此过程将一个未封装的根 (/) 文件系统恢复到一个节点。不应引导正在恢复的节点。在执行此恢复过程前确保群集无故障运行。


注意:

由于必须使用失败的磁盘的格式来给新的磁盘进行分区,所以在进行此过程前必须识别 分区方案,并相应地重新创建文件系统。


  1. 更换要在其上恢复根文件的节点上失败的磁盘。

    请参考服务器附带的文档中的磁盘更换过程。

  2. 引导要恢复的节点。

    • 如果正在使用 Solaris CD-ROM,则运行以下命令:


      ok boot cdrom -s
      

    • 如果正在使用一个 JumpStart 服务器,则运行以下命令:


      ok boot net -s
      

  3. 使用 format(1M) 命令在根磁盘上创建所有的分区和交换。

    重建失败的磁盘上的原分区方案。

  4. 使用 newfs(1M) 命令,相应地创建根 (/) 文件系统和其他文件系统。

    重建失败的磁盘上的原文件系统。


    注意:

    确保创建 /global/.devices/node@nodeid 文件系统。


  5. 在一个临时安装点上安装根 (/) 文件系统。


    # mount device temp-mount-point
    
  6. 从备份中恢复根 (/) 文件系统,然后卸载并 检查文件系统。


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

    此时文件系统已恢复。

  7. 在新磁盘上安装一个新引导块。


    # /usr/sbin/installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk raw-disk-device
    
  8. 将节点重新引导到单用户模式。

    1. 启动重新引导。


      # reboot -- "-s"

      在此引导过程中,您将看到错误消息或警告消息,其结尾部分是以下指令:


      Type control-d to proceed with normal startup,
      (or give root password for system maintenance):
    2. 输入超级用户口令。

  9. 确定根磁盘组是否位于根磁盘上的一个单片上。

    • 如果是,则创建并设置根磁盘组:


      # vxdctl init
      # vxdg init rootdg
      # vxdctl add disk diskslice type=simple
      # vxdisk -f init diskslice type=simple
      # vxdg adddisk diskslice
      # vxdctl enable
      
    • 如果否,则进行步骤 10

  10. 使用 scdidadm 命令更新磁盘 ID。


    # scdidadm -R /dev/rdsk/diskdevice
  11. 按下 CTRL-d 以恢复多用户模式。

    节点重新引导到群集模式下。群集已经就绪。

8.3.4.1 示例-恢复未封装的根 (/) 文件系统 (VERITAS 卷管理器)

以下示例展示从磁带设备 /dev/rmt/0 恢复到 节点 phys-schost-1 的未封装的根 (/) 文件系统。


[Replace the failed disk and boot the node:]
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 in single-user mode:]
# reboot -- "-s"
[If the root disk group is on a single slice on the root disk, create the new root disk group:]
# vxdctl init
# vxdg init rootdg
# vxdctl add disk c0t0d0s4 type=simple
# vxdisk -f init c0t0d0s4 type=simple
# vxdg adddisk c0t0d0s4
# vxdctl enable
[Update the disk ID:]
# scdidadm -R /dev/rdsk/c0t0d0
[Press CTRL-d to resume in multiuser mode]

8.3.5 如何恢复未封装的根 (/) 文件系统 (VERITAS 卷管理器)

按照此过程将一个未封装的根 (/) 文件系统恢复到一个节点。不应引导正在恢复的节点。在执行此恢复过程前确保群集无故障运行。


注意:

由于必须使用失败的磁盘的格式来给新的磁盘进行分区,所以在进行此过程前必须识别 分区方案,并相应地重新创建文件系统。


  1. 更换要在其上恢复根文件的节点上失败的磁盘。

    请参考服务器附带的文档中的磁盘更换过程。

  2. 引导要恢复的节点。

    • 如果使用 Solaris CD-ROM,请运行以下命令:


      ok boot cdrom -s
      
    • 如果使用一个 JumpStart 服务器,则运行以下命令:


      ok boot net -s
      
  3. 使用 format(1M) 命令在根磁盘上创建所有的分区和交换。

    重建失败的磁盘上的原分区方案。

  4. 使用 newfs(1M) 命令,相应地创建根 (/) 文件系统和其他文件系统。

    重建失败的磁盘上的原文件系统。


    注意:

    确保创建 /global/.devices/node@nodeid 文件系统。


  5. 在一个临时安装点上安装根 (/) 文件系统。


    # mount device temp-mount-point
  6. 从备份中恢复根 (/) 文件系统。


    # cd temp-mount-point
    # ufsrestore rvf dump-device
    # rm restoresymtable
    
  7. 创建一个空的 install-db 文件。

    这会使节点在下次重新引导时进入 VxVM i安装模式。


    # touch /temp-mount-point/etc/vx/reconfig.d/state.d/install-db
    
  8. /temp-mount-point/etc/system 文 件移除或注释掉下列项。


    * rootdev:/pseudo/vxio@0:0
    * set vxio:vol_rootdev_is_volume=1
  9. 编辑 /temp-mount-point/etc/vfstab 文 件并用根磁盘的标准磁盘设备替换所有的 VxVM 安装 点,如 /dev/dsk/c0t0d0s0


    Example: 
    Change from-
    /dev/vx/dsk/rootdg/rootvol /dev/md/rdsk/rootdg/rootvol /      ufs   1     no -
    
    Change to-
    /dev/dsk/c0t0d0s0 /dev/rdsk/c0t0d0s0  / ufs   1     no       -
  10. 卸载临时文件系统并检查该文件系统。


    # cd /
    # umount temp-mount-point
    # fsck raw-disk-device
    
  11. 在新的磁盘上安装引导块。


    # /usr/sbin/installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk raw-disk-device
  12. 以单用户模式重新引导节点。


    # reboot -- "-s"
    
  13. 使用 scdidadm(1M) 更新磁盘 ID。


    # scdidadm -R /dev/rdsk/c0t0d0
  14. 运行 vxinstall


    # vxinstall
    

    选择封装磁盘并重新引导。

  15. 如果与其他系统间存在次编号冲突,则卸载全局设备并为磁盘组重编次编号。

    • 卸载群集节点上的全局设备文件系统。


      # umount /global/.devices/node@nodeid
      
    • 为群集节点上的 rootdg 磁盘组重编次编号。


      # vxdg reminor rootdg 100
      

  16. # shutdown -g0 -i 6 -y
    
    关闭节点,再以群集模式重新引导该节点。

8.3.5.1 示例-恢复封装的根 (/) 文件系统 (VERITAS 卷管理器)

以下示例展示从磁带设备 /dev/rmt/0 恢复到 节点 phys-schost-1 的封装的根 (/) 文件系统。


[Replace the failed disk and boot the node:]
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/md/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 in single-user mode:]
# reboot -- "-s"
[Update the disk ID:]
# scdidadm -R /dev/rdsk/c0t0d0
[Run vxinstall:]
# vxinstall
Choose to encapsulate the root disk.
[If there is a conflict in minor number, reminor the rootdg disk group:]
# umount /global/.devices/node@nodeid
# vxdg reminor rootdg 100
# shutdown -g0 -i 6 -y