歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Unix知識 >> 關於Unix >> solaris修復損壞的root分區 mirror環境

solaris修復損壞的root分區 mirror環境

日期:2017/2/28 11:10:13   编辑:關於Unix


對於生產系統的服務器,標准配置通常都會對root文件系統做mirror,Sun自然也不例外。
很多文檔針對solaris如何mirror root文件系統,本文是測試怎樣當mirror中一個disk損壞後,如何修復
測試環境是x86 solaris,但是流程根sparc一樣。
正常情況:
# metastat
d0: Mirror
Submirror 0: d10
State: Okay
Submirror 1: d20
State: Okay
Pass: 1
Read option: roundrobin (default)
Write option: parallel (default)
Size: 10240000 blocks (4.9 GB)
d10: Submirror of d0
State: Okay
Size: 10240000 blocks (4.9 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c1t0d0s0 0 No Okay Yes
d20: Submirror of d0
State: Okay
Size: 10240000 blocks (4.9 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c1t1d0s0 0 No Okay Yes
模擬損壞一塊兒硬盤,或刪除一塊兒磁盤之後
日志自然會抱錯,如果重新啟動系統,系統會自動啟動到單用戶模式
如果暫時沒有替代的磁盤可以先刪除metadb,來啟動系統
刪除之後:
# metastat
d0: Mirror
Submirror 0: d10
State: Okay
Pass: 1
Read option: roundrobin (default)
Write option: parallel (default)
Size: 10240000 blocks (4.9 GB)
d10: Submirror of d0
State: Okay
Size: 10240000 blocks (4.9 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c1t0d0s0 0 No Okay Yes
d20: Concat/Stripe
Size: 10240000 blocks (4.9 GB)
Stripe 0:
Device Start Block Dbase Reloc
c1t1d0s0 0 No Yes
d20並沒有被刪除,下面提供一個參考的過程用來完全刪除問題磁盤:
# metadetach -f d0 d20
d0: submirror d20 is detached
# metadb -d /dev/rdsk/c1t1d0s7
# metaclear d20
刪除之後:
# metastat
d0: Mirror
Submirror 0: d10
State: Okay
Submirror 1: d20
State: Okay
Pass: 1
Read option: roundrobin (default)
Write option: parallel (default)
Size: 10240000 blocks (4.9 GB)
d10: Submirror of d0
State: Okay
Size: 10240000 blocks (4.9 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c1t0d0s0 0 No Okay Yes
Device Relocation Information:
Device Reloc Device ID
c1t0d0 Yes id1,sd@f0000000048496c95000bfd270000
添加一個替換磁盤之後,重新加入mirror的步驟:
1.按照原有磁盤,用format分區
5.installgrub /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c1t1d0s0 ---新磁盤添加引導信息(solaris 10 x86 不再使用installboot)
上面刪除和添加步驟並不是最優路徑,只是自己再操作的時候根據操作步驟記錄而來,下面列一個比較優的更換磁盤的步驟:
1 替換壞硬盤
2 開機到單用戶模式下
3 metadb -d c1t1d0s7 (db是放在s7分區上的)
4 prtvtoc /dev/rdsk/c1t0d0s2|fmthard –s – /dev/rdsk/c1t1d0s2
5 metadb -a -f -c 3 c1t1d0s7
6 關機重啟到正常模式下
7 metareplace -e d10 c1t1d0s0
Copyright © Linux教程網 All Rights Reserved