Sun Cluster 3.0 12/01 系统管理指南

第 8 章 备份和恢复群集

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

8.1 备份群集

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

任务 

有关说明,请转到... 

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

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

计算存放一份完整备份需要多少磁带 

"8.1.2 如何确定进行完整备份所需要的磁带数量"

备份根文件系统 

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

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

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

"8.1.5 如何为卷执行联机备份 (VERITAS Volume Manager)"

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 nodelist
    

    -z

    执行切换。

    -D disk-device-group

    要切换的磁盘设备组的名称。

    -h nodelist

    要将该磁盘设备组切换到其中的群集节点的名称。 该节点将成为新的主节点。

  3. 停止该节点。


    # shutdown -g0 -y -i0
    

  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 mountpoint 
    


    注意:

    仅当镜像上还有 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 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
    

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 Volume Manager)

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

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

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

  2. 列出磁盘组信息。


    # vxprint -g diskgroup
    

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


    # scstat -D
    

    -D

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

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


    # vxassist -g diskgroup snapstart volume
    


    注意:

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


  5. 检验是否已创建新卷。


    # vxprint -g diskgroup
    

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

  6. 停止正在访问文件系统的任何数据服务。


    # scswitch -z -g resource-group -h ""
    


    注意:

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


  7. 创建一个名为 bkup-vol 的备份卷并使用 vxassist 命令将快照卷附加到该备份卷上。


    # vxassist -g diskgroup snapshot volume bkup-vol
    

  8. 使用 scswitch 命令重新启动步骤 6 中停止的任何数据服务。


    # scswitch -z -g resource-group -h nodelist
    

  9. 使用 vxprint 命令,检验该卷此时是否附加到了新卷 bkup-vol 上。


    # vxprint -g diskgroup
    

  10. 注册对磁盘组配置所做的更改。


    # 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=diskgroup,sync
    

8.1.5.1 示例 - 为卷执行联机备份 (VERITAS Volume Manager)

在下面的示例中,群集节点 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 -      -        -      -
...
 
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 Volume Manager,恢复未封装的根 (/) 文件系统 

"8.3.4 如何恢复未封装的根 (/) 文件系统 (VERITAS Volume Manager)"

对于 VERITAS Volume Manager,恢复封装的根 (/) 文件系统 

"8.3.5 如何恢复已封装的根 (/) 文件系统 (VERITAS Volume Manager)"

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

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

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

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


    # scswitch -z -g resource-group -h ""
    

  3. 使用 ufsrestore 命令恢复这些文件。

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

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


注意:

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


  1. 成为某个有权访问元集的群集节点(而不是所要恢复的那个节点)的超级用户。

  2. 从所有元集中删除要恢复的节点的主机名。

    从元集中的某个节点(而非正要删除的那个节点)运行此命令。


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

    -s setname

    指定磁盘集名称。

    -f

    强制。

    -d

    从磁盘集中删除。

    -h nodelist

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

  3. 替换正恢复其根 (/) 文件系统的那个节点上的故障磁盘。

    请参阅服务器所附带的文档,以了解磁盘替换过程。

  4. 引导要恢复的节点。

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


      ok boot cdrom -s
      

    • 如果使用的是 Solaris JumpStartTM 服务器,则运行以下命令:


      ok boot net -s
      

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

    重建故障磁盘上的原分区方案。

  6. 使用 newfs(1M) 命令适当创建根 (/) 文件系统和其他文件系统。

    重建故障磁盘上的原文件系统。


    注意:

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


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


    # mount device temp-mountpoint
    

  8. 使用以下命令来恢复根 (/) 文件系统。


    # cd temp-mountpoint
    # ufsrestore rvf dump-device
    # rm restoresymtable
    # cd /
    # umount temp-mountpoint
    # 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 nodelist
    

    -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 \
-矛/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 -s setname -f -d -h nodelist
    

    -s setname

    指定元集名称。

    -f

    强制。

    -d

    从元集中删除。

    -h nodelist

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

  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-mountpoint
    

  8. 使用以下命令来恢复根 (/) 文件系统。


    # cd temp-mountpoint
    # ufsrestore rvf dump-device
    # rm restoresymtable
    

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


    # /usr/sbin/installboot /usr/platform/`uname -矛/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-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-mountpoint
    # 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 nodelist
    

    -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 \
-矛/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 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 Volume Manager)

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


注意:

由于新磁盘的分区必须与故障磁盘完全相同,所以在进行此过程前必须先确定分区方案,并相应地重建文件系统。


  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-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 -矛/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/disk-device
    

  11. 按下 CTRL-d 可恢复多用户模式。

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

8.3.4.1 示例 - 恢复未封装的根 (/) 文件系统 (VERITAS Volume Manager)

下面的示例展示了将未封装的根 (/) 文件系统从磁带设备 /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 \
-矛/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 Volume Manager)

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


注意:

由于新磁盘的分区必须与故障磁盘完全相同,所以在进行此过程前必须先确定分区方案,并相应地重建文件系统。


  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-mountpoint
    

  6. 从备份中恢复根 (/) 文件系统。


    # 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-mount-point/etc/vfstab 文件,并用根磁盘的标准磁盘设备(例如 /dev/dsk/c0t0d0s0)替换所有的 VxVM 安装点。


    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-mountpoint
    # fsck raw-disk-device
    

  11. 在新磁盘上安装引导块。


    # /usr/sbin/installboot /usr/platform/`uname -矛/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 -i6 -y
    

8.3.5.1 示例 - 恢复封装的根 (/) 文件系统 (VERITAS Volume Manager)

下面的示例展示了将根 (/) 文件系统从磁带设备 /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 \
-矛/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 -i6 -y

8.3.5.2 从此处可转到何处

有关如何镜像已封装的根磁盘的说明,请参阅《Sun Cluster 3.0 12/01 软件安装指南》。