Sun Cluster 3.0 系统管理指南

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