iT邦幫忙

DAY 8
10

Solaris 三十 Q系列 第 8

Solaris 三十Q-08 怎麼復原分割狀態到新硬碟?(SPARC)

曾經有個經驗,就是用了數年的硬碟掛點,只好再買一顆新硬碟,但是我早已遺忘原先的硬碟分割(partition)的狀況,造成不知道該切割多少的slice跟大小。後來經前輩教導,才知道原來有這麼一個作法。
就是應該事先將硬碟的VTOC (volume table of contents,就是儲存現行硬碟內部的分割資訊)先行備份至另外的媒體上,等到更換這一顆時,就可以將原本的VTOC資訊再寫進去新硬碟。

作法很簡單:
1.利用 prtvtoc 指令將硬碟資訊讀出來,再導到一個文字檔中。

# prtvtoc /dev/dsk/c1t0d0s2 > /var/tmp/c1t0d0s2.vtoc
(/var/tmp/c1t0d0s2.vtoc內容如:

* /dev/dsk/c1t0d0s2 partition map
*
* Dimensions:
*     512 bytes/sector
*     848 sectors/track
*      24 tracks/cylinder
*   20352 sectors/cylinder
*   14089 cylinders
*   14087 accessible cylinders
*
* Flags:
*   1: unmountable
*  10: read-only
*
*                          First     Sector    Last
* Partition  Tag  Flags    Sector     Count    Sector  Mount Directory
       0      2    00          0   6349824   6349823
       1      3    01    6349824   8405376  14755199
       2      5    00          0 286698624 286698623
       3      0    00   33662208     40704  33702911
       4      4    00   14755200  10501632  25256831
       5      7    00   25256832   8405376  33662207
       6      0    00   33702912 146819328 180522239   /bsch
       7      0    00  180522240 106176384 286698623   /opt 

2.再使用 fmthard 指令將備份的/var/tmp/c1t0d0s2.vtoc 寫入新硬碟:

# fmthard –s /var/tmp/c1t0d0s2.vtoc /dev/rdsk/c0t1d0s2
fmthard:  New volume table of contents now inplace

不過,有一點請注意:如果原先/var/tmp/c1t0d0s2.vtoc的邏輯不對,那麼在fmthard回寫VTOC時,會出現錯誤。這時候只能用編輯器(如vi)將有問題的那一行描述刪除了。

註: 所謂邏輯不對的意思是指,某兩個slice的offset有重疊,這是不合理的,如果有人同時去將這兩個slice建立filesystem的話,會導致crash的。


上一篇
Solaris 三十Q-07 怎麼設定 Sun ALOM(2)?
下一篇
Solaris 三十Q-09 怎麼復原分割狀態到新硬碟?(x86/x64)
系列文
Solaris 三十 Q30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言