任务 |
指导 |
---|---|
查找要备份的文件系统的名称 | |
计算存放一份完整备份需要多少磁带 | |
备份根文件系统 | |
为镜像的文件系统或网状文件系统执行联机备份 | |
备份群集配置 | |
备份存储磁盘的磁盘分区配置 |
参见存储磁盘的相关文档 |
显示 /etc/vfstab 文件的内容。
运行此命令不需要成为超级用户或等效角色。
# more /etc/vfstab |
在挂载点列中查找要备份的文件系统的名称。
备份文件系统时,使用此名称。
# more /etc/vfstab |
以下示例显示了列在 /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 - |
在要备份的群集节点上,成为超级用户或使用等效角色。
按字节估算备份的大小。
# ufsdump S filesystem |
显示执行该备份估计需要的字节数。
指定您要备份的文件系统的名称。
用磁带容量去除估算大小,看需要多少磁带。
在以下示例中,大小为 905,881,620 字节的文件系统用一盒 4 GB 的磁带 (905,881,620 ÷ 4,000,000,000) 就足够了。
# ufsdump S /global/phys-schost-1 905881620 |
使用此过程可以备份群集节点的根 (/) 文件系统。执行此备份过程之前,请确保群集正在无故障运行。
此过程提供了 Sun Cluster 命令的长格式。此外,大多数命令还有简短格式。这些命令除了名称长短的不同以外,其功能都是相同的。有关命令及其简短格式的列表,请参见附录 A,Sun Cluster 面向对象的命令。
在要备份的群集节点上,成为超级用户或使用一个可提供 solaris.cluster.modify RBAC 授权的角色。
将每一个正在运行的数据服务从将要备份的节点切换到群集的另一个节点。
# clnode evacuate node |
指定从中切换资源组和设备组的节点。
关闭该节点。
# shutdown -g0 -y -i0 |
将节点重新引导到非群集模式。
SPARC:键入以下内容:
ok boot -xs |
在基于 x86 的系统中,执行以下命令:
phys-schost# shutdown -g -y -i0 Press any key to continue |
在 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)”。
在引导参数屏幕中,使用方向键选择内核条目,然后键入 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. |
向命令中添加 -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 |
按 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.- |
键入 b 以将节点引导至非群集模式。
对内核引导参数命令所做的这一更改在系统引导后将失效。下次重新引导节点时,系统将引导至群集模式。如果希望引导至非群集模式,请重新执行上述步骤,并将 -x 选项添加到内核引导参数命令中。
通过创建 UFS 快照来备份根 (/) 文件系统。
将节点重新引导到群集模式。
# init 6 |
在以下示例中,根 (/) 文件系统的快照被保存至 /usr 目录下的 /scratch/usr.back.file 中。`
# fssnap -F ufs -o bs=/scratch/usr.back.file /usr /dev/fssnap/1 |
对于镜像 Solstice DiskSuite 元设备或 Solaris Volume Manager 卷,无需将其卸载或将整个镜像脱机就可以对其进行备份。您必须暂时使其中一个子镜像脱机(因而失去镜像),但备份完成后可立即使之联机并重新同步,这样就不必停止系统,也不用拒绝用户访问数据。通过使用镜像来执行联机备份,可创建活动文件系统的 “快照” 备份。
如果在某个程序将数据写入卷后又立即运行了 lockfs 命令,则可能会发生故障。要避免此故障,请暂时停止在此节点上运行的所有服务。此外,请在执行此备份过程前确保群集正在无故障运行。
此过程提供了 Sun Cluster 命令的长格式。此外,大多数命令还有简短格式。这些命令除了名称长短的不同以外,其功能都是相同的。有关命令及其简短格式的列表,请参见附录 A,Sun Cluster 面向对象的命令。
在要备份的群集节点上,成为超级用户或使用等效角色。
使用 metaset(1M) 命令确定哪个节点对备份的卷具有所有权。
# metaset -s setname |
指定磁盘集名称。
使用 lockfs(1M) 命令以及 -w 选项来锁定对文件系统的写入操作。
# lockfs -w mountpoint |
仅当镜像上还有 UFS 文件系统时才必须锁定此文件系统。例如,如果将 Solstice DiskSuite 元设备或 Solaris Volume Manager 卷设置为数据库管理软件或其他某个特定应用程序的原始设备,则无需使用 lockfs 命令。但是,您可能要运行适当的、与供应商相关的实用程序来刷新任意缓冲区并锁定访问。
使用 metastat(1M) 命令来确定子镜像的名称。
# metastat -s setname -p |
以类似于 md.tab 文件的格式显示状态。
使用 metadetach(1M) 命令来使一个子镜像从镜像脱机。
# metadetach -s setname mirror submirror |
将继续从其他子镜像进行读取。但是,对镜像进行第一次写操作后,脱机子镜像将立即不再同步。脱机子镜像重新联机后,这种不一致现象就会得到纠正。您无需运行 fsck 命令。
通过结合使用 lockfs 命令和 -u 选项,解除对文件系统的锁定并允许写入操作继续进行。
# lockfs -u mountpoint |
检查文件系统。
# fsck /dev/md/diskset/rdsk/submirror |
将脱机子镜像备份到磁带或另一介质上。
使用 ufsdump(1M) 命令或通常使用的备份实用程序。
# ufsdump 0ucf dump-device submirror |
让子镜像使用原始设备 (/rdsk) 名称,而不使用块设备 (/dsk) 名称。
使用 metattach(1M) 命令将元设备或卷重新置于联机状态。
# metattach -s setname mirror submirror |
当元设备或卷处于联机状态后,将会自动与镜像重新同步。
使用 metastat 命令可检验该子镜像是否正在重新同步。
# metastat -s setname mirror |
在下面的示例中,群集节点 phys-schost-1 是元集 schost-1 的属主,所以备份过程是从 phys-schost-1 执行的。镜像 /dev/md/schost-1/dsk/d0 由子镜像 d10、d20 和 d30 组成。
[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) ... |
VERITAS 卷管理器 将镜像卷标识为丛。不用将其卸载或使整个卷脱机就可备份丛。这是通过创建卷的快照副本并备份此临时卷来完成的,您无需停止系统或拒绝用户访问数据。
执行此备份过程之前,请确保群集正在无故障运行。
此过程提供了 Sun Cluster 命令的长格式。此外,大多数命令还有简短格式。这些命令除了名称长短的不同以外,其功能都是相同的。有关命令及其简短格式的列表,请参见附录 A,Sun Cluster 面向对象的命令。
登录到群集的任意节点,成为该群集上磁盘组的当前主节点的超级用户,或使用一个可提供 solaris.cluster.admin RBAC 授权的角色。
列出磁盘组信息。
# vxprint -g diskgroup |
确定哪个节点当前已导入该磁盘组,这个节点就是该磁盘组的主节点。
# cldevicegroup status |
创建卷的快照。
# vxassist -g diskgroup snapstart volume |
创建快照可能需要较长时间,具体情况取决于卷大小。
检验是否已创建新卷。
# vxprint -g diskgroup |
当快照完成后,所选磁盘组的 State 字段会显示 Snapdone 状态。
停止正在访问文件系统的任何数据服务。
# clresourcegroup offline resource-group |
停止所有数据服务,以确保正确备份数据文件系统。如果没有运行任何数据服务,则不必执行步骤 6 和步骤 8。
创建一个名为 bkup-vol 的备份卷,然后将快照卷附加到此卷。
# vxassist -g diskgroup snapshot volume bkup-vol |
使用 clresourcegroup 命令重新启动所有在步骤 6 中停止的数据服务。
# clresourcegroup online - zone -n node resourcegroup |
节点名称。
node 上可控制资源组的非全局区域的名称。只有在创建资源组时指定了非全局区域,您才需要指定 zone。
检验该卷目前是否已附加到新卷 bkup-vol。
# vxprint -g diskgroup |
注册对设备组配置所做的更改。
# cldevicegroup sync diskgroup |
检查备份卷。
# fsck -y /dev/vx/rdsk/diskgroup/bkup-vol |
执行一次备份,以便将卷 bkup-vol 复制到磁带或另一介质上。
使用 ufsdump(1M) 命令或常用的备份实用程序。
# ufsdump 0ucf dump-device /dev/vx/dsk/diskgroup/bkup-vol |
删除临时卷。
# vxedit -rf rm bkup-vol |
注册对磁盘组配置所做的更改。
# cldevicegroup sync diskgroup |
在以下示例中,群集节点 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 |
为确保群集配置已归档并可轻松恢复,请定期对群集配置加以备份。Sun Cluster 3.2 可将群集配置导出到一个可扩展标记语言(eXtensible Markup Language, XML) 文件。
登录到群集的任意节点,成为超级用户或使用一个可提供 solaris.cluster.read RBAC 授权的角色。
将群集配置信息导出到一个文件中。
# /usr/cluster/bin/cluster/export -o configfile |
群集命令正在将群集配置信息导出到的 XML 配置文件的名称。有关 XML 配置文件的信息,请参见 clconfiguration(5CL)
检验群集配置信息是否已成功导出至 XML 文件。
# vi configfile |