RIGHT:[[Sun 関係覚え書き]]
Sun のマシンでディスクラベルが飛んでしまったときは,
format コマンドで復旧させることができる.
format コマンドで壊れたディスクを選択すると,
label を書き込むか聞かれるので n と答える.
# format
Searching for disks...done
c0t1d0: configured with capacity of 34.0GB
AVAILABLE DISK SELECTIONS:
0. c0t0d0 <ST34321A cyl 8892 alt 2 hd 15 sec 63>
/pci@1f,0/pci@1,1/ide@3/dad@0,0
1. c0t1d0 <ST34321A cyl 8892 alt 2 hd 15 sec 63>
/pci@1f,0/pci@1,2/ide@3/dad@0,0
Specify disk ( enter its number ): 1
selecting c0t0d0
[disk formatted]
Disk not labeled. Label it now? n
//---
バックアップされたディスクラベルがないか verify コマンドで
検索し,見つかったラベルが正しければ backup コマンドでラベルを書き込んで
終了する.
format> verify
Warning: Check the current partitioning and 'label' the disk or use the
'backup' command.
Backup label contents:
Volume name = < >
ascii name = <ST34321A cyl 8892 alt 2 hd 15 sec 63>
pcyl = 8892
ncyl = 8890
acyl = 2
nhead = 15
nsect = 63
Part Tag Flag Cylinders Size Blocks
0 root wm 0 - 127 128.00MB (128/0/0) 262144
...
format> backup
Disk has a primary label, still continue? y
Searching for backup labels...found.
Restoring primary label.
format> q
//---
また,こうやってバックアップから戻せる場合はラッキーだが,
もしものために正常なときにディスクラベルのバックアップを取っておくとよい.
# format /dev/rdsk/c0t1d0s2
format> save
Saving new disk and partition definitions
Enter file name["./format.dat"]:
これで,カレントディレクトリに
format.dat という名前で出力される.
このファイルを format コマンドの "-x" オプションで指定すると
type コマンドにて同じディスクラベルが作成できるようになる.
また,念のためにこのファイルを紙に打ち出しておくとよい.