BigAdmin System Administration Portal
社群提交的技術祕訣
Print-friendly VersionPrint-friendly Version
This content is submitted by a BigAdmin user. It has not been reviewed for technical accuracy by Sun Microsystems, though it may have been lightly edited to improve readability. If you find an error or would like to comment on the article, please contact the submitter or use the comment field at the bottom of the article. Community submissions may not follow Sun trademark guidelines. For information on Sun trademarks, please see http://www.sun.com/suntrademarks/.
 
 

使用 Solaris 磁碟區管理員軟體進行開機磁碟鏡像

Sivakanth Mundru 著,2004 年 7 月

適用的作業系統版本:Solaris 9 作業系統 (OS)、附有 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 (Slice 6 is my small slice here)
# metadb -a -c3 c?t?d?s6 (Slice 6 on rootmirror)

6) 此時我們即可為分割區表中的每個磁碟片段建立鏡像。

針對根或分割區:

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

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

(create a md d0 and attach one submirror)
# metainit d0 -m d10 

(set up system files for root (/) metadevice, that is, 
     changes to /etc/system and /etc/vfstab)
# metaroot d0 

# lockfs -fa (clear improper file locks on all mounted UFS file systems) 

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。根的 md 項目將會由 metaroot 指令所更新。

/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 磁碟區管理員軟體必須在有 50% 以上的資料庫可用時,才能正常啟動,否則它可能會顯示資料庫複本數量不足的訊息。前述變更是為了讓 Solaris 磁碟區管理員軟體在至少有 50% 的可用副本時即可啟動。

12) 執行:

sync; sync; init 6

13) 系統啟動後,請附加其他子鏡像:

# metattach d0 d20

(注意:這是「metattach」,而不是「metaattach」)

# metattach d1 d21 

等項目。

14) 若要察看 FS 同步化是否已完成,請執行下列動作:

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"

您也可以變更開機裝置值,使系統嘗試從鏡像開機,以免其中一項裝置無法使用。

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

Comments (latest comments first)

Discuss and comment on this resource in the BigAdmin Wiki

Unless otherwise licensed, code in all technical manuals herein (including articles, FAQs, samples) is provided under this License.


BigAdmin