BigAdmin System Administration Portal
已提交的技术提示:使用 Solaris Volume Manager 软件进行引导磁盘镜像
Print-friendly VersionPrint-friendly Version
此内容由 BigAdmin 用户提交。虽然可能会对此内容稍加编辑以增强可读性,但 Sun Microsystems 尚未验证其技术准确性。如果您发现了错误,或者希望对此文章发表评论,请联系提交者,或使用文章底部的评论字段。社区提交可能未遵循 Sun 商标准则。有关 Sun 商标的信息,请参见 http://www.sun.com/suntrademarks/
 
 

使用 Solaris Volume Manager 软件进行引导磁盘镜像

作者:Sivakanth Mundru

适用的操作系统版本:Solaris 9 操作系统、带有 Solstice DiskSuite 4.2.1 软件以及修补程序 108693-06 的 Solaris 8 操作系统 (SPARC Platform Edition)

注:我不能保证这种方法适用于所有人,请根据需要进行调整。

以下步骤可能使用了随机的控制器和目标,它们可能会因主机而异。

另外,最好在多个控制器中进行镜像,而不是在同一个控制器中进行镜像,并且仍将该控制器作为单一故障点。

1) 重要预防措施:

先复制 /etc/vfstab/etc/system,然后再继续执行操作:

cp -p /etc/system /etc/system.orig."date"

cp -p /etc/vfstab /etc/vfstab.orig."date"

如果 /etc/system 出现混乱,我们仍可从 OK 提示符中使用 boot -a 命令,并使用以下内容进行指定:

/etc/system.orig."date"

2) 确保使用额外的磁盘对根磁盘进行镜像,并且该磁盘上没有数据。

3) 创建一个 25 MB 的小分片(10 MB 也可以)以存储“根磁盘”上的卷数据库,并标记该磁盘。

如果根磁盘上没有任何空间,请删除并重新添加交换空间以创建一个小分片。

确保在执行此操作时系统中没有大量的活动。

3.1) 要列出交换空间,请使用:swap -l

(将多个分片配置为交换空间时适用。)

3.2) 执行以下命令:

swap -d swap-name ( /dev/dsk/c?ct?d?s?)

通过减少交换分区的大小或柱面长度,更改分区表以包含新的分片。

3.3) 执行以下命令:

swap -a swap-name ( /dev/dsk/c?t?d?s?) 

4) 根磁盘和根镜像上的 VTOC(卷目录)必须相同。可使用 prtvtocfmthard 来复制 VTOC。

# prtvtoc /dev/rdsk/c?t?d?s2 | fmthard -s - /dev/rdsk/c?t?d?s2

5) 在根磁盘上创建的小分片中创建元数据库:

# metadb -f -a -c3 c?t?d?s6 (此处分片 6 是我的小分片)
# metadb -a -c3 c?t?d?s6 (分片 6 在根镜像上)

6) 现在,我们可以为分区表中的每个分片创建一个镜像。

对于根或 / 分区:

# metainit -f d10 1 1 c?t?d?s? 

# metainit d20 1 1 c?t?d?s?

(创建一个 md d0 并附加一个子镜像)
# metainit d0 -m d10 

(为根 (/) 元设备设置系统文件,即,
     更改为 /etc/system 和 /etc/vfstab)
# metaroot d0 

# lockfs -fa (清除所有已挂载 UFS 文件系统上不正确的文件锁定)

7) 其他元磁盘的命名约定如下所示。(不熟悉此软件的用户须知:我们不会在其他文件系统上执行 metarootlockfs 步骤。)

子镜像将被命名为 d10d20,依此类推。

d10 中,1 是子镜像编号,而 0 是分片编号。

如果分区/分片 1 上有交换空间,我们将执行以下命令:

# metainit -f d11 1 1 c?t?d?s1

# metainit d21 1 1 c?t?d?s1

# metainit d1 -m d11

8) 对引导磁盘上包含的所有文件系统重复执行此操作。

9) 对 /etc/vfstab 进行更改。metaroot 命令已更新了根磁盘的 md 条目。

/etc/vfstab 的样例副本如下所示:

#device device mount FS fsck mount mount
#to mount to fsck point type pass at boot options
#
fd - /dev/fd fd - no -
/proc - /proc proc - no -
##/dev/dsk/c1t1d0s1 - - swap - no -
/dev/md/dsk/d1 - - swap - no -
/dev/md/dsk/d0 /dev/md/rdsk/d0 / ufs 1 no -
##/dev/dsk/c1t1d0s7 /dev/rdsk/c1t1d0s7 /export/home ufs 2 yes -
/dev/md/dsk/d7 /dev/md/rdsk/d7 /export/home ufs 2 yes -
##/dev/dsk/c1t1d0s3 /dev/rdsk/c1t1d0s3 /opt/uc4 ufs 2 yes -
/dev/md/dsk/d3 /dev/md/rdsk/d3 /opt/uc4 ufs 2 yes -
swap - /tmp tmpfs - yes -

10) 使用 dumpadm 配置转储设备。

11) 在 /etc/system 文件的 mdd 信息部分中输入以下条目:

set md:mirrored_root_flag=1

当根磁盘不可用时,存储在根磁盘上的数据库副本也将不可用。

Solaris Volume Manager 软件要求超过 50% 的数据库可用才能正常引导,否则,它可能会提示数据库副本数量不足。前面已进行了一些更改,以使 Solaris Volume Manager 软件在引导时至少具有 50% 的副本。

12) 执行以下命令:

sync; sync; init 6

13) 在系统引导后,附加其他子镜像:

# metattach d0 d20

(注:是 "metattach" 而不是 "metaattach")

# metattach d1 d21 

依此类推。

14) 要查看是否完成了文件系统同步,请执行以下命令:

metastat | grep progress 

15) 为主磁盘和镜像磁盘确定引导设备的设备路径:

ls -l /dev/dsk/c1t1d0s0 /dev/dsk/c1t0d0s0
lrwxrwxrwx 1 root root 43 Dec 23 17:51 /dev/dsk/c1t0d0s0 -> \
   ../../devices/pci@1c,600000/scsi@2/sd@0,0:a
lrwxrwxrwx 1 root root 43 Dec 23 17:51 /dev/dsk/c1t1d0s0 -> \
   ../../devices/pci@1c,600000/scsi@2/sd@1,0:a

# eeprom "nvramrc=devalias rootdisk /pci@1c,600000/scsi@2/disk@1,0 
devalias rootmirror /pci@1c,600000/scsi@2/disk@0,0"

(请注意,在使用 ls -l 输出时将 "sd" 更改为 "disk"。)

# eeprom "use-nvramrc?=true"

也可以更改 boot-device 值,以使系统在其中某个设备不可用时尝试从镜像磁盘进行引导。

# eeprom boot-device="rootdisk rootmirror net"

16) 在完成同步后,删除根磁盘以对系统进行测试。

The information and links on this page have been provided by a BigAdmin user. The submitter is solely responsible for such information and links. Sun is not responsible for the availability of external sites or resources, and does not endorse and is not responsible or liable for any content, advertising, products, or other materials on or available from such sites or resources. Sun will not be responsible or liable, directly or indirectly, for any actual or alleged damage or loss caused by or in connection with use of or reliance on the information posted here, or goods or services available on or through any external site or resource.
 
 
BigAdmin
  
 
BigAdmin Upgrade Hub