9-6. ディザスタ・リカバリの検討 -------------------------------------------------------------------------------- SunOS 4.1.4-JLE、時を経てお役にたつ時がきましたよ。捨てんでよかった−。 インタ− ネットサ−バの Solaris 2.6 で予備ディスクを作りたい。 いきなり本番稼働サ−バでや るのは恐ろしい。ディスクがパ−にならんとも限らない。Solaris 2.6 でも SunOS 4.1.4 でもディスクの追加など扱いは、やることはほとんど同じみたいである。先ずは SunOSの マシンで存分テスト、触ってみることにする。"9-7. SunOS 4.1.4 のディスクの扱い" で やってみた。後は、ここで思い切ってディスクをフルバックアップしてみるだけである。 -------------------------------------------------------------------------------- (1) EWSディスクのバックアップ `23/03 * バックアップの概要 外付けディスクまたはテ−プ装置などにディスクのコピ−を取る。mirror や rsync を使 うのはどうか、使い方がここでは違うか。rsync でも別のディスクにコピ−するのに使う ことができる。市販のバックアップソフトの NetVault と VERITAS はどうか、 基本的に はテ−プにバックアップをとるソフトである。最初はフルバックアップ、それ以降は差分 バックアップをとる。数セットのテ−プを用意して、使い回すとか話がある。差分バック アップには増分(インクリメンタル)とか変更(消去やファイル名変更)でのバックアッ プもある。EWSのOSにあるコマンド dump/restore や ufsdump/ufsrestore でも、こ のような差分バックアップはとれる。ディスク全体のバックアップを取る、OSも含めた 予備としてのディスクのコピ−を作るには dd コマンドを使うのが便利である。しかしデ ィスクの仕組みをよく理解しないといけない。多分 ufsdump/ufsrestore コマンドでパ− ティション単位で全体をコピ−して、予備ディスクを作るのが確実なような気がするが。 [ バックアップの単位 ] ファイル単位 ------- tar をそのままかア−カイブ。cpio とか afio。 ディレクトリ単位 ---- tar をそのままかア−カイブ。 パ−ティション単位 -- ufsdump/ufsrestore, dump/restore, dd。 ディスク全体 -------- dd( convert and copy a file/ファイルの変換とコピー ) [ バックアップの種類 ] 差分バックアップ ---- ufsdump/ufsrestore, dump/restore。 フルバックアップ ---- dd, ufsdump/ufsrestore, dump/restore。 スナップショット ---- ある瞬間のディスクの状態をそのままコピ−する。 用語:Solaris のスライスという言い方は、パ−ティションと同義語である。パ−ティシ ョンはディスクを分割して異なるOSを入れる場合、その分割したのをパ−ティションと 呼ぶ。そのため、1つのOSでディスクの領域を分割するのは、区別してスライスと呼ぶ ようである。しかし、普通はパ−ティションと言うことが多いので、本書でも特に問題が ない限り、パ−ティションと呼ぶことにする。 * ufsdump/ufsrestore コマンドについて Solaris 2.6 にあるコマンド。ファイルのパ−ミッションもコピ−できる。dump/restore は SunOS 4.1.x にあったもので、BSD 系UNIXに昔からあるコマンドでINDY IRIX 5.3 にもある。dump/restore は Solaris 2.x では、 ufsdump/ufsrestore という名称になっ て機能拡張されている。Solaris 2.6 で # man dump とやると、マニュアルが出て来るが このコマンドは違うようである。# which dump とやっても出て来ない。 ディスクのフル バックを別なディスクに取るには、以下のようにパ−ティション毎にコピ−していく。そ して後からル−トパ−ティションに、ブ−トブロックをインスト−ルする手順になる。次 はパ−ティション /var を /mnt にコピ−する例。/dev/dsk/c0t3d0s7 は /var にマウン トされているとする。 # cd /mnt # ufsdump 0f - /dev/rdsk/c0t3d0s7 | ufsretore xf - ↑ ・0 はダンプレベルで、0 はファイルシステム全体をコピ−する。 ・f はデバイス名で、ここでは - を表わし、標準出力である。 ・b オプションをブロック化因数、デフォルトは20ブロックである。 [ マニュアル man での説明 ] If dump_file is specified as `-', ufsrestore reads from the standard input. This allows ufsdump(1M) and ufsrestore to be used in a pipeline to copy a file system: example# ufsdump 0f - /dev/rdsk/c0t0d0s7 | (cd /home;ufsrestore xf -) * dd コマンドについて ディスクイメ−ジのバックアップである。ディスクを物理的にそのままコピ−する。簡単 で速くバックアップを取ることができる。OSなどをインスト−ルしたそのままのディス クのコピ−を、別のディスクに作るのに用いられるとある。このため、同じ容量のディス クでないとダメなのか。いや、それだけではダメである。ディスクのジオメトリも一致し てないとコピ−できない。パ−ティションは例えばシリンダの何番から何番と決められる。 同じシリンダの10個分とかいっても、容量はジオメトリ値のセクタ数が異なると違って くる。ひょっとかすると、同じ容量または多目にシリンダの数をコピ−先のディスクに確 保すればいいかも知れない。コピ−して、パ−ティションの余ったところは、まだデ−タ が何もないですよとパディングすればいいのでないか。ブ−トブロックは、別途インスト −ルする必要はない。ともかく、コピ−し終わったらコピ−先のディスクを fsck でエラ −が出ないか確認すること。dd コマンドの使いこなしは、 ディスクのジオメトリ値がど うマシンの中で振る舞うのか、その理解にかかっている。 基本的には、同じジオメトリを持つディスクを用意する。 SunOS 4.1.x や Solaris では パ−ティションの2番が伝統的に、ディスク全体を表わす。コピ−元ディスクのパ−ティ ション2番のデバイス名を指定して、用意したディスクにコピ−する。物理的なコピ−な ので、そのまま各パ−ティションの情報なども全部コピ−される。下のコマンドでの指示 の bs=63b は63コのブロック単位でコピ−することを意味している。 dd のデフォルト では bs=1b の1ブロック単位である。一度に書き込むサイズが大きい程、 速くコピ−で きる。物理的に全く同じジオメトリのディスクなら、下の指定でいい。しかし物理的なの は違っていて、論理的にジオメトリ値を合わすような場合でも、ジオメトリ値の中の回転 速度だけはオリジナルのジオメトリ値にしておいた方がいいように思う。そのためにはコ ピ−先ディスクにジオメトリ値をセットし、その値が上書きされないように、 dd コマン ドでは第1セクタを除けてコピ−するようにする。この場合は、1セクタ単位のコピ−と なるので bs=63b といった複数ブロック毎にコピ−する指定はできない。 # dd if=コピ−元ディスク2番 of=コピ−先ディスク2番 bs=63b * Solaris 2.6 での基本操作と知識 [ マシンを止める ] # shutdown -y -g 0 -i 0 << # shutdown -y -g0 -i0 と間隔を詰めるとダメ。 # init 0 << またはこのコマンドを打つ。 ウィンドウ画面 CDE( Common Desktop Environment )で、shutdown コマンドは which で 見ると /usr/ucb/shutdown である。ここではもう1つの/usr/sbin/shutdown を使うこと とする、こちらは CDE を使わない端末画面で which で出て来るコマンドである。 [ シングルユ−ザモ−ドにする ] ok boot -s << init 0 で ok プロンプトが出たところで、これをやる。 [ OpenBoot モ−ドでのコマンド ] ok boot -r << カ−ネルを再構築する。ディスクのデバイスを追加する。 ok show-disks << デバイスのパスを表示する。show-devs というのもある。 ok probe-scsi << SCSI の状態を表示する。SEAGATE ST32430N と出て来る。 ok probe-ide << これは Ultra 10 など IDE ディスクの DOS/V マシン用。 ok probe-scsi-all << SCSI ホストアダプタを増設した場合に使う。 ok devalias << デバイスの別名をリストする。デバイスの本名は長い。 # find / -name probe-scsi とやってコマンドを探したが出てこなかった。 * Solaris 2.6 での SCSI 番号とパ−ティション番号 パ−ティションの番号 0 : /root 3,4,7 : ユ−ザ用 ↓ 1 : swap c0t1d0s2 2 : ディスク全体 c0t3d0s6 5 : /opt オプションソフト用 c1t1d0s6 6 : /usr システム共有領域用 ↑↑↑ SCSI コントロ−ラの番号、最初のが0番。増設したのが1番。 || SCSI ID の番号。 | ドライブ番号、ハ−ドディスクは0番が決まりである。 (2) ハ−ドディスクについて `23/04 * ディスクの構造 ディスクはなかなかばらせない。けど、ばらしてみたらよくわかる。 5インチの IDE デ ィスクを見たが、円盤の Platter は最大3枚しか入らない。 ばらしたのには2枚入って いた。ヘッドは4個あった。円盤はまるで鏡だった。外周と内周でトラックのセクタ数が 違うと、MOだとその筋が見えると雑誌に書いてあったが、そんなのは見えなかった。 ア−ム ←→ これら固定されていて一体になって動く。 |---------‖ Platter 〓 ‖ ディスクには物理的に固有のヘッド、トラックと ----------|---------- ‖ セクタがある。円盤はその裏表にデ−タを書き込 (円盤) | 〓 Head ‖ むことができる。ヘッドはデ−タの検出装置であ | |---------‖ り、円盤が幾つあってもヘッドがなければ用を成 | 〓 ‖ さないので、円盤の数が幾つというのはあまり言 ----------|---------- ‖ わない。トラックは円盤をたくさんの同芯円で区 | 〓 ‖ 切ったもの。円盤の最外周が0番である。1つの | |---------‖ トラックを円周にそって分割したのをセクタとい | 〓 ‖ う。セクタとヘッドは1番から数える。シリンダ ----------|---------- ‖ は円盤の同じトラックを集めたもの、トラックと Spindle ‖ 同じく0番から数える。 第1セクタ、1番目のセクタ。第1セクタにラベル情報が書かれている。 ↓ -------------------------- | 1 | 2 | 3 | 4 | ディスクを一本のテ−プとみなす。 -------------------------- 0 1 2 3 ( 通常1ブロック=512バイト=1セクタ ) ↑ 最初のブロック、ブロックは0番から数える。 * Solaris 2.6 と SunOS 4.1.4 で共通の事柄 増設したいディスクを SCSI 接続し、マシンをリブ−トする。ディスプレイの電源を先ず ON、本体から遠い SCSI デバイスから電源を入れて、最後に本体の電源を入れる。本体 の電源を入れてから後、外付けディスクの電源を入れても認識しない。ただし、いったん 外付けディスクを認識してしまえば、電源を切ったり入れたりしても後、認識する。 SCSI 番号とデバイス名の対応は ID=3 sd0, ID=1 sd1, ID=2 sd2, ID=0 sd3 である。 内 臓ディスクの1番目は ID=3、2番目は ID=1、外付けの1番目は ID=2 である。内臓ディ スクの2番目が入ってなければ、外付けの1番目は ID=1 でも構わない。かちあわなけれ ば SCSI ID は何でも構わない。CD-ROM ドライブは慣習的に ID=6、テ−プは ID=4である。 ディスク増設の手順は、format コマンドで物理フォ−マット -> パ−ティション切る -> ラベルを付ける -> newfs で論理フォ−マット -> マウントして使う。物理フォ−マット するには、ディスクのジオメトリ情報が必要である。パ−ティションはシリンダ、トラッ ク、セクタ単位とかブロック単位とかで指定できるが、シリンダ単位が分かり易い。 フリ−ソフトの scsiinfo コマンドでジオメトリを調べることができる。あるいは、誰か が調べたのがインタ−ネット上にある。/etc/format.dat ファイルにその情報を追加する。 format コマンドはこの format.dat を参照して、 物理フォ−マットしたりパ−ティショ ンを切ることができる。format の type コマンドで適当な disk_type を選べばいい。あ るいは、その場でジオメトリ値を手入力することもできる。 format コマンドで出て来るのは、論理的なジオメトリ情報である。scsiinfo で出て来る のは物理的なジオメトリ情報である。format の label コマンドでディスクにラベルを書 き込んでも、物理的なジオメトリ情報は変わらない。 書き込まれるラベルは format.dat の disk_type の ncyl,acyl,pcyl,nhead,nsect,rpm とディスクの名前、 それにパ−ティ ション情報である。その他の bpt,asect,ctlr などは書き込まれないようである。 ディスクを format コマンドの format で物理フォ−マットする際に使うパラメ−タ、ジ オメトリ情報は cylinders = ncyl、alternate cylinders = acyl、physical cylinders= pcyl、heads = nhead、sectors/track = nsect、rpm of drive = rpm、disk type nameで ある。ncyl、acyl などは format.dat の disk_type で使われている値である。 SunOS 4.1.4 の場合、ディスクのラベルは第1セクタに作られる。ディスクの名前、ジオ メトリ情報、パ−ティション情報が記録される。ここでのジオメトリ情報は論理的な値と 思われる。物理的なジオメトリ情報はどこか別な場所にあるようである。多分 Solarisで も同じことだと思う。ちゃんと説明している資料が見つからない。 パ−ティションを newfs で論理フォ−マットする。 newfs しないと、ただの論理的なデ ィスクであり、スワップ領域で使えるのみである。newfs することによって、ファイルシ ステムができ、初めてファイルやディレクトリを作ることができるようになる。1つのパ −ティション=1つのファイルシステム。SunOS 4.1.x は1パ−ティション 2 GB まで。 ディスクのチュ−ニングについて少し。個々のファイルは全部、OSの中で i-node 番号 で管理される。i-node 1個につき1個のファイルに対応する。 ファイルの管理サイズは デフォルトで 2048 byte(2K) で、この値は newfs でパ−ティション毎に変更できる。2K 以下のファイルが大量にある場合は、値を小さくした方が有効にディスクを使うことがで きる。もう一つおまけ、ディスクの円盤の内側より外周りの方が速度は速い。 Solaris ではパ−ティションの0番はル−ト /(root)、1番はスワップ(swap)、2番はデ ィスク全体(backup) を示す。6番はユ−ザ(usr) 用と決められている。 /tmp、/var/tmp などの一時ファイルのディレクトリは、バックアップしなくてもいい。 swap もキャッシ ュ用のディレクトリも、/proc も取る必要はない。/proc はプロセスが使っているところ で、一時的なものである。マシンをシャットダウンすると中味は消える。 ディスクのフォ−マットなどのやり方は Solaris 9 でも、変わってないみたい。 以前は 有償だった Solstice DiskSuite。 Solaris 9 では Solaris Volume Manager という名前 になって無償で入っている。このソフトはパ−ティション単位でミラ−リングをするよう になっている。有償ソフトだった割には設定するのは、かなりややこしそうである。 他のディスクにフルバックアップした際どうなる。筐体を開き、壊れた内臓ディスクを外 し、バックアップして保管していたディスクと入れ替えるか?。そんなめんどうなことし なくても "ok boot バックアップディスクのデバイス名" で、ディスクを外付けしたまま、 このディスクを指定し、マシンを起動できる。 * ディスクの一般的な事柄 1個の SCSI コントロ−ラには、Narrow SCSI タイプで7台、WIDE SCSI タイプで15台、 鎖状に SCSI デバイスを接続できる。飽くまでも論理的な話で数台がいいとこだろう。全 体の SCSI ケ−ブルの長さにも制限がある。 SCSI コントロ−ラは SCSI ホストアダプタ とも言われ、SCSI ID は伝統的に7番である。SCSI コントロ−ラが違えば、同じSCSI ID を付けても問題ない。デバイスは SCSI コントロ−ラ何某の SCSI ID 何番と認識する。 バックアップをとる時は、dd でも ufsdump コマンドでも、シングルユ−ザモ−ドでやる のが望ましい。コピ−元のパ−ティションはマウントされている。コピ−先のパ−ティシ ョンはマウントしなくてもいい、しない方がいい?。ほとんどのデ−モンは停止している。 マルチユ−ザモ−ドでも、マウントを外して作業できればそれでも構わないらしい。 tar はファイル、ディレクトリ、リンクを対象にできる。GNU tar は加えて、特殊ファイ ル(デバイスファイル、パイプ)も保存できるとか。 cpio( CoPy file archives In and Out) は特殊ファイルも保存できる、System V 系のコマンドである。 cpio はバックアッ プするファイル名のリストを与えてバックアップする。 find コマンドと組み合わせて使 うらしい。afio は cpio の強化版ということである。 ディスクが壊れるのは、パ−ティション単位で壊れる。 /var パ−ティションが壊れても /usr パ−ティションは問題ないというようなことである。 この場合 /var だけ復旧させ ればいい。例えば /var パ−ティションをテ−プにコピ−しておいて戻す。あるいは/var を外付けディスクにコピ−しておいて、そちらにマウントし直すのでもいい。 ディレクトリを丸ごとコピ−する際、ツリ−が深くなるとパス名が、tar で扱える長さを 越えると失敗する。# (cd /src/dir;tar cf - .)|(cd /dst/dir;tar xvfp -)。GNU のtar ならだいじょうぶとか。GNU の cp コマンドはシンボリックリンク、ハ−ドリンク、FIFO、 デバイスファイルも正しくコピ−できる。# cp -av /s/d d/d。 dd コマンドで BadSpot までコピ−してしまう。それが問題になることがある。 BadSpot とはディスクの傷のこと。製造過程でできたのが初期BadSpot と使用している過程ででき るのがある。大容量になってディスクの構造が精密になってきた分、使用中に傷ができる 割合が増えてきているとのこと。BadSpot を管理するのがディフェクトリストである。 ス−パブロックはディスクの各パ−ティションの先頭に作られる。ファイルやディレクト リを管理している。i ノ−ドリスト。ファイルへのポインタをもっている。シリンダのグ ル−プ毎にス−パブロックと i ノ−ドリストがある。ufsdump コマンドは i ノ−ドリス トもバックアップする。 "1パ−ティション=1ファイルシステム"であると先に記した。ファイルシステムはOS に依存するもので、いろいろなのがある。Windows OSでは FAT16 は Windows 3.1 まで 2GB、FAT32 は Windows 95/98 で 2TB 対応。 BSD OS系では FFS は 2GB、FFFS は 4TB 対応。SGI の IRIX 5.x は EFS で 8GB、IRIX 6.x は XFS という具合である。 ブロックデバイスとキャラクタデバイス。キャラクタデバイスは RAW デバイス ともいう。 RAW は生という意味である。ちなみに Raw Fish といったら刺身のこと。ディスクへのア クセスはOSを通さず、つまりファイルシステムを通さずに行う。ディスクのマウントは ファイルシステム管理下にあるブロックデバイスに対して行なう。 どうもディスクのジオメトリ値と言うのは昔のことで、今は論理的な意味合いしかないみ たいである。だから、結構何でもどんな値にしてもいいのでないか。一本のテ−プのよう にみなし、何番目のセクタであるか、OSの中では分かればいいみたいだ。ジオメトリの 物理的な値は scsiinfo、prtvtoc コマンドで RAW デバイスを指定。論理的な値は dmesg、 format、iostat -En でブロックデバイスを指定で出て来る。 (3) ディスクのジオメトリ値について `23/03 * ジオメトリの値が違っているのは インタ−ネットサ−バのメ−ルストアの SPARCstation 5、OSは Solaris 2.6 のディス クでジオメトリの値がどうなっているか調べてみた。SPARCstation 5 の本体は、 横置き の平べったい筐体である。マシン稼働中でも、筐体背面の2本のネジを外して、筐体の上 面のカバ−を開けることができる。ディスクは1個あって、Seagate ST32430WC と書いて あった。手持ちのディスクに Seagate ST32430N があって、Seagate のサイトでスペック を見たら、ジオメトリの値は同じだった。しかし、dmesg や format コマンドなどで出て 来るジオメトリの値と較べると、どうもおかしい。Seagate のサイトでのジオメトリ値と 実際ここにあるディスクの値も異なっているようだし。結局のところ、ディスクにはあら かじめ書き込まれた物理的なジオメトリ値と、書き換え自由な論理的なジオメトリ値があ る。そう解釈すれば納得が行くことが分かった。 [ Seagate のサイトに掲載されているディスクのスペック ] http://www.seagate.com/support/disc/specs/scsi/st32430w.html ST32430W/WD/WC のディスクのスペックが載っている。値は同じである。 ST32430W | ST32430N -----------------------------------------|--------- AVERAGE SECTORS PER TRACK ----- 116 | ← TRACKS ----------------------- 35,928 | ← CYLINDERS -------------------- 3992 | ← HEADS__PHYSICAL -------------- 9 | ← UNFORMATED CAPACITY(MB) ------ 2600 | 2590 FORMATED CAPACITY(XXSECTORS) -- 2147 | 2140 シリンダ数3992、ヘッド数9、1トラックあたりの平均セクタ数116。1トラ ック当たりの平均セクタ数と言うのは、円盤の外周りと内周でセクタ数が違ってくる タイプのディスクだからではないのか。 * マシン内臓ディスクのジオメトリ情報 # dmesg のディスクのところ Feb 14 19:56 SunOS Release 5.6 Version Generic_105181-23 [UNIX(R) System V Release 4.0] | sd3 at esp0: target 3 lun 0 sd3 is /iommu@0,10000000/sbus@0,10001000/espdma@5,8400000/esp@5,8800000/sd@3,0 # iostat -En ディスクのメ−カ名と型番 c0t3d0 Soft Errors: 0 Hard Errors: 0 Transport Errors: 0 Vendor: SEAGATE Product: ST32430W SUN2.1G Revision: 0666 Serial No: 00979741 RPM: 5400 Heads: 19 Size: 2.13GB <2127708160 bytes> Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0 Illegal Request: 0 Predictive Failure Analysis: 0 ※(2733+1)*19*80*512=2127708160 と値は一致する。シリンダは最外周で0番から始 まるので1プラスする。 # format 関係するところだけ表示した 0. c0t3d0 /iommu@0,10000000/sbus@0,10001000/espdma@5,8400000/esp@5,8800000/sd@3,0 partition> print Current partition table (original): Total disk cylinders available: 2733 + 2 (reserved cylinders) Part Tag Flag Cylinders Size Blocks 0 root wm 0 - 134 100.20MB (135/0/0) 205200 1 swap wu 135 - 307 128.40MB (173/0/0) 262960 2 backup wm 0 - 2732 1.98GB (2733/0/0) 4154160 3 unassigned wm 0 0 (0/0/0) 0 4 usr wm 308 - 1655 1000.47MB (1348/0/0) 2048960 5 unassigned wm 1656 - 1790 100.20MB (135/0/0) 205200 6 unassigned wm 1791 - 2060 200.39MB (270/0/0) 410400 7 var wm 2061 - 2731 498.01MB (671/0/0) 1019920 135*19*80*512 =105062400 Bytes 205200 Blocks = 135*19*80 Blocks 105062400/1024= 102600 KBytes 102600/1024 = 100.195 MBytes 2733*19*80=4154160 Sectors /etc/format.dat 関係するところだけ表示した ----------------------------------------------------------------------------- |# This is the list of Sun supported disks for embedded SCSI. |disk_type = "SUN2.1G" \ | : ctlr = SCSI : fmt_time = 4 \ | : ncyl = 2733 : acyl = 2 : pcyl = 3500 : nhead = 19 : nsect = 80 \ | : rpm = 5400 : bpt = 44823 | |# This is the list of partition tables for embedded SCSI controllers. |partition = "SUN2.1G" \ | : disk = "SUN2.1G" : ctlr = SCSI \ | : 0 = 0, 62320 : 1 = 41, 197600 : 2 = 0, 4154160 : 6 = 171, 3894240 # prtvtoc /dev/rdsk/c0t3d0s0 << パ−ティションの番号は、 他の番号でも * /dev/rdsk/c0t3d0s0 partition map 構わない。c0t3d0s4 でも c0t3d0s1 でも * 出て来るのは一緒である。 * Dimensions: * 512 bytes/sector * 80 sectors/track * 19 tracks/cylinder * 1520 sectors/cylinder * 3500 cylinders * 2733 accessible cylinders * * Flags: * 1: unmountable * 10: read-only * * Unallocated space: * First Sector Last * Sector Count Sector * 4152640 1520 4154159 * * First Sector Last * Partition Tag Flags Sector Count Sector Mount Directory 0 2 00 0 205200 205199 / 1 3 01 205200 262960 468159 2 5 00 0 4154160 4154159 4 4 00 468160 2048960 2517119 /usr 5 0 00 2517120 205200 2722319 /opt 6 0 00 2722320 410400 3132719 /iscan/tmp 7 7 00 3132720 1019920 4152639 /var # scsiinfo -F /dev/rdsk/c0t3d0s0 << トロント大学からscsiinfo-4.7-sunos5.6 disk_type = "SEAGATE ST32430W SUN2.1G" \ 取って来た。 : ctlr = SCSI : fmt_time = 5 \ : trks_zone = 9 : atrks = 18 : asect = 8 \ : ncyl = 3984 : acyl = 2 : pcyl = 3992 : nhead = 9 : nsect = 117 \ : rpm = 5411 : bpt = 68796 partition = "SEAGATE ST32430W SUN2.1G" \ : disk = "SEAGATE ST32430W SUN2.1G" : ctlr = SCSI \ : 2 = 0, 4195152 * scsiinfo プログラムの入手と概要 scsiinfo プログラムは ftp.cdf.toronto.edu に SunOS 4.1.3用の実行モジュ−ルがある ので取ってくる。/pub/scsiinfo/binary/scsiinfo-4.5/scsiinfo-4.5-sunos4.1.3 を取っ きて、ファイル名を scsiinfo にすればいい。 # scsiinfo -V scsiinfo ver 4.5 $Id: patchlevel.h,v 3.18 1998/02/28 02:07:33 jdd Exp $ Compiled for SunOS 4.1.3: ESP PTISP NOTCH FORMAT # scsiinfo -h scsiinfo: illegal option -- h Usage: scsiinfo [-V][-o][-r device][-f diskdev][-F diskdev][-N diskdev] [-c][-s][-p][-q][-K kernelimage][-C coreimage] マウントしている、していないに関わらず、物理的に繋がっているディスクの一覧を出す。 実行モジュ−ルが SunOS 4.1.3 用なので、ワ−ニングが出るが問題ない。 # scsiinfo scsiinfo: WARNING: compiled for SunOS 4.1.3; this is SunOS 4.1.4-JL. Results may esp0: sd2 tgt 2 lun 0: be incorrect. Synchronous(4.0MB/sec) Clean CanReconnect esp0: sd1 tgt 1 lun 0: Synchronous(4.0MB/sec) Clean CanReconnect esp0: sd0 tgt 3 lun 0: Synchronous(4.0MB/sec) Clean CanReconnect * 外付けディスクを接続したところ 外付けディスクの ST32430N は、まだフォ−マットもしていない。外付けディスクを接続 して、マシンを ok boot -r で起動する。Solaris 2.6 では新しく接続したデバイスを自 動認識してくれる。物理的なジオメトリ情報を # format で出してくる。SunOS 4.1.x で は、このような場合のディスクは # format コマンドでは unknown と出る。 # dmesg | sd1 at esp0: target 1 lun 0 sd1 is /iommu@0,10000000/sbus@0,10001000/espdma@5,8400000/esp@5,8800000/sd@1,0 WARNING: /iommu@0,10000000/sbus@0,10001000/espdma@5,8400000/esp@5,8800000/sd@1,0 (sd1): corrupt label - wrong magic number Vendor 'SEAGATE', product 'ST32430N', 4197405 512 byte blocks sd3 at esp0: target 3 lun 0 sd3 is /iommu@0,10000000/sbus@0,10001000/espdma@5,8400000/esp@5,8800000/sd@3,0 | # format Searching for disks...done c0t1d0: configured with capacity of 2.00GB AVAILABLE DISK SELECTIONS: 0. c0t1d0 /iommu@0,10000000/sbus@0,10001000/espdma@5,8400000/esp@5,8800000/sd@1,0 1. c0t3d0 /iommu@0,10000000/sbus@0,10001000/espdma@5,8400000/esp@5,8800000/sd@3,0 Specify disk (enter its number): 0 selecting c0t1d0 [disk formatted] Disk not labeled. Label it now? y << ディスクにアクセスして物理的なジオメ トリ情報を取得した。それを論理的なジ FORMAT MENU: オメトリ値としてディスクに書き込む。 disk - select a disk type - select (define) a disk type partition - select (define) a partition table current - describe the current disk format - format and analyze the disk repair - repair a defective sector label - write label to the disk analyze - surface analysis defect - defect list management backup - search for backup labels verify - read and display labels save - save new disk/partition definitions inquiry - show vendor, product and revision volname - set 8-character volume name ! - execute , then return quit format> format Ready to format. Formatting cannot be interrupted and takes 34 minutes (estimated). Continue? n << フォ−マットするのは止める。 # # iostat -En c0t1d0 Soft Errors: 0 Hard Errors: 0 Transport Errors: 0 Vendor: SEAGATE Product: ST32430N Revision: 0300 Serial No: 00405146 RPM: 5411 Heads: 9 Size: 2.15GB <2148456960 bytes> Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0 Illegal Request: 0 Predictive Failure Analysis: 0 ※(3984+1)*9*117=2148456960。 # scsiinfo -F /dev/rdsk/c0t1d0s0 << 内臓ディスク c0t3d0s0 と値は一致した。 disk_type = "SEAGATE ST32430N" \ : ctlr = SCSI : fmt_time = 5 \ : trks_zone = 9 : atrks = 18 : asect = 8 \ : ncyl = 3984 : acyl = 2 : pcyl = 3992 : nhead = 9 : nsect = 117 \ : rpm = 5411 : bpt = 68796 partition = "SEAGATE ST32430N" \ : disk = "SEAGATE ST32430N" : ctlr = SCSI \ : 2 = 0, 4195152 # prtvtoc /dev/rdsk/c0t1d0s0 * /dev/rdsk/c0t1d0s0 partition map * * Dimensions: * 512 bytes/sector * 117 sectors/track * 9 tracks/cylinder * 1053 sectors/cylinder * 3986 cylinders * 3984 accessible cylinders * * Flags: * 1: unmountable * 10: read-only * * First Sector Last * Partition Tag Flags Sector Count Sector Mount Directory 0 2 00 0 262197 262196 1 3 01 262197 262197 524393 2 5 01 0 4195152 4195151 6 4 00 524394 3670758 4195151 # mount /dev/dsk/c0t1d0s6 /mnt mount: /dev/dsk/c0t1d0s6 はこのファイルシステムのタイプではありません。 このディスクは確か INDY で使っていたのでないか。# format の partition コマンドで パ−ティションの情報が出てきた。しかしマウントしようとしたら、このファイルシステ ムのタイプではないと出て、できなかった。/mnt はマウント・ポイントで、 先に適当な 名前でディレトリを作っておくこと。 (4) Solaris 2.6 での dd コマンド `23/05 -------------------------------------------------------------------------------- メ−ルストアのホストのディスクの予備をここでは作成する。内臓の SCSI ホストアダプ タの SCSI の口に、外付けディスクを SCSI ID 1番で接続する。 コピ−は dd コマンド で内臓ディスクのフルバックアップを、稼働させたままマルチユ−ザモ−ドで取ってみる。 -------------------------------------------------------------------------------- * メ−ルストアのホストのディスクの状態 # df -k Filesystem Kバイト used avail capacity Mounted on /dev/dsk/c0t3d0s0 96031 53641 32787 63% / /dev/dsk/c0t3d0s4 962582 733758 171070 82% /usr /proc 0 0 0 0% /proc fd 0 0 0 0% /dev/fd /dev/dsk/c0t3d0s7 479367 153358 278073 36% /var /dev/dsk/c0t3d0s6 192807 9 173518 1% /iscan/tmp /dev/dsk/c0t3d0s5 96031 81427 5001 95% /opt swap 160328 204 160124 1% /tmp /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/c0t3d0s1 - - swap - no - |/dev/dsk/c0t3d0s0 /dev/rdsk/c0t3d0s0 / ufs 1 no - |/dev/dsk/c0t3d0s4 /dev/rdsk/c0t3d0s4 /usr ufs 1 no - |/dev/dsk/c0t3d0s7 /dev/rdsk/c0t3d0s7 /var ufs 1 no - |/dev/dsk/c0t3d0s6 /dev/rdsk/c0t3d0s6 /iscan/tmp ufs 2 yes - |/dev/dsk/c0t3d0s5 /dev/rdsk/c0t3d0s5 /opt ufs 2 yes - |swap - /tmp tmpfs - yes - * dd によるディスクのフルバックアップ 1) バックアップ用ディスクを付ける 外付けで SCSI ID 1番としてここでは付ける。 2) ok boot -r これで追加したデバイスをマシンに認識させる。 3) # format の format バックアップ用のディスクをフォ−マットする。 4) # format の partition パ−ティションの2番だけは作る必要がある。 5) # dd if=/dev/rdsk/c0t3d0s2 of=/dev/rdsk/c0t1d0s2 bs=10b フルバックアップ。 6) # mount /dev/dsk/c0t1d0s2 /mnt マウント情報をバックアップのディスクにする。 # vi /mnt/etc/vfstab /etc/vfstab を c0t3d0.. を c0t1d0.. にする。 7) ok boot disk1 コピ−したディスクでブ−トする。これで完了。 ※第1セクタを飛ばして全部コピ−する場合。 # dd if=/dev/rdsk/c0t3d0s2 ibs=1b skip=1 of=/dev/rdsk/c0t1d0s2 obs=1b seek=1 [ バックアップ用ディスクを準備する ] Seagate ST32430N を外付けディスクとして SCSI ID 1番でマシンに接続する。以下はま だフォ−マットもしていない状態である。 Solaris 2.6 では、ok boot -r をやることに より、自動的に追加したディスクを認識する。なぜかパ−ティション情報も作られていた。 ※`26/03 いや勘違いだ、以下の Specify disk で '1' を選んでいる。これは最初からあ ったディスクだ。こうやって間違いは起こる。教訓としてこの下りこのままにしておく。 # format Searching for disks...done c0t1d0: configured with capacity of 2.00GB AVAILABLE DISK SELECTIONS: 0. c0t1d0 /iommu@0,10000000/sbus@0,10001000/espdma@5,8400000/esp@5,8800000/sd@1,0 1. c0t3d0 /iommu@0,10000000/sbus@0,10001000/espdma@5,8400000/esp@5,8800000/sd@3,0 Specify disk (enter its number): 1 format> part << partition の略。 partition> print Current partition table (original): Total disk cylinders available: 2733 + 2 (reserved cylinders) Part Tag Flag Cylinders Size Blocks 0 root wm 0 - 134 100.20MB (135/0/0) 205200 1 swap wu 135 - 307 128.40MB (173/0/0) 262960 2 backup wm 0 - 2732 1.98GB (2733/0/0) 4154160 3 unassigned wm 0 0 (0/0/0) 0 4 usr wm 308 - 1655 1000.47MB (1348/0/0) 2048960 5 unassigned wm 1656 - 1790 100.20MB (135/0/0) 205200 6 unassigned wm 1791 - 2060 200.39MB (270/0/0) 410400 7 var wm 2061 - 2731 498.01MB (671/0/0) 1019920 2003/05/15 とうとうフォ−マットの "y" を押してしまいました。続いて dd コマンドも 叩いてしまいました。とても怖い操作です。SI業者さんでも、お客さんとこのマシンを バックアップを取るはずが、ハ−ドディスクをフォ−マットしてしまったとか、あるそう です。お金で解決したとかエライことで!。 # format Searching for disks...done AVAILABLE DISK SELECTIONS: 0. c0t1d0 /iommu@0,10000000/sbus@0,10001000/espdma@5,8400000/esp@5,8800000/sd@1,0 1. c0t3d0 /iommu@0,10000000/sbus@0,10001000/espdma@5,8400000/esp@5,8800000/sd@3,0 Specify disk (enter its number): 0 selecting c0t1d0 [disk formatted] FORMAT MENU: disk - select a disk type - select (define) a disk type partition - select (define) a partition table current - describe the current disk format - format and analyze the disk repair - repair a defective sector label - write label to the disk analyze - surface analysis defect - defect list management backup - search for backup labels verify - read and display labels save - save new disk/partition definitions inquiry - show vendor, product and revision volname - set 8-character volume name ! - execute , then return quit format> type AVAILABLE DRIVE TYPES: 0. Auto configure 1. Quantum ProDrive 80S | 13. SUN1.3G 14. SUN2.1G 15. SUN2.9G 16. SEAGATE-ST32430N-0300 << /etc/format.dat ファイルには追加され 17. other てはいない。でも前は、これはなかった。 Specify disk type (enter its number)[16]: 14 selecting c0t1d0 [disk formatted] format> format Ready to format. Formatting cannot be interrupted and takes 34 minutes (estimated). Continue? y << これでフォ−マットが開始する。 Beginning format. The current time is Thu May 15 16:45:39 2003 Formatting... done ここまで30分 Verifying media... pass 0 - pattern = 0xc6dec6de 2732/18/14 ここまで30分 pass 1 - pattern = 0x6db6db6d 2732/18/14 ここまで25分 Total of 0 defective blocks repaired. format> partition | partition> print フォ−マットしたパ−ティションはこんなんになった。 Current partition table (SUN2.1G): Total disk cylinders available: 2733 + 2 (reserved cylinders) Part Tag Flag Cylinders Size Blocks 0 root wm 0 - 40 30.43MB (41/0/0) 62320 1 swap wu 41 - 170 96.48MB (130/0/0) 197600 2 backup wu 0 - 2732 1.98GB (2733/0/0) 4154160 3 unassigned wm 0 0 (0/0/0) 0 4 unassigned wm 0 0 (0/0/0) 0 5 unassigned wm 0 0 (0/0/0) 0 6 usr wm 171 - 2732 1.86GB (2562/0/0) 3894240 7 unassigned wm 0 0 (0/0/0) 0 partition> q format> q # [ フルバックアップ ] # dd if=/dev/rdsk/c0t3d0s2 of=/dev/rdsk/c0t1d0s2 bs=10b 読み込まれたブロック数は 415416+0 << 15分で終わった。これらメッセ−ジは 書き出されたブロック数は 415416+0 最後に出て来る。それまでは何も出ない。 [ マウントしてみる ] # mount /dev/dsk/c0t1d0s2 /mnt mount: /dev/dsk/c0t1d0s2 の状態が OK でありません。 読み取り/書き込みのためにマウントを試みました。 mount: fsck を実行してからもう一度実行してください。 # fsck /dev/rdsk/c0t1d0s2 ** /dev/rdsk/c0t1d0s2 ** Last Mounted on / ** Phase 1 - Check Blocks and Sizes ** Phase 2 - Check Pathnames ** Phase 3 - Check Connectivity ** Phase 4 - Check Reference Counts ** Phase 5 - Check Cyl groups << ここまで1〜2分。 FILE SYSTEM STATE IN SUPERBLOCK IS WRONG; FIX? y << 一瞬で以下が出て終わる。 1385 files, 87970 used, 8061 free (189 frags, 984 blocks, 0.1% fragmentation) # mount /dev/dsk/c0t1d0s2 /mnt *** ちゃんとマウントできました *** # ls /mnt TT_DB devices iscan mnt proc usr bin etc kernel net sbin var cdrom export lib opt temp.doc vol dev home lost+found platform tmp xfn # ls -l /mnt/var << この状態ではル−トしかマウントされていないので、/mnt/var 合計 0 には何もない。# ls /mnt/etc とやればファイルは出てくる。 -------------------------------------------------------------------------------- さあ、ここまで出来た。後はマシンを止めて ok boot disk1 とやって、 ちゃんとブ−ト してくれるかだ。どうする、思い切ってやるか。もう夜の8時近くで皆、家へ帰ったから。 -------------------------------------------------------------------------------- (5) Solaris 2.6 での ufsdump コマンド `23/05 -------------------------------------------------------------------------------- ここではWWWサ−バのホストを考える。内臓ディスクの他に8ギガの外付けディスクを 追加している。WWWのコンテンツでデ−タ量が多くなったためである。2つのディスク があるので、dd コマンドでコピ−はできない。ここでは ufsdump コマンドを用いる。 -------------------------------------------------------------------------------- * WWWホストのディスクの状態 # df -k Filesystem Kバイト used avail capacity Mounted on /dev/dsk/c0t3d0s0 48023 16971 26250 40% / /dev/dsk/c0t3d0s6 721751 582029 81982 88% /usr /proc 0 0 0 0% /proc fd 0 0 0 0% /dev/fd /dev/dsk/c0t3d0s3 76967 29036 40235 42% /var /dev/dsk/c0t1d0s6 8783407 1923100 6772473 23% /usr1 << 外付けディスク。 /dev/dsk/c0t3d0s7 785750 205000 525748 29% /export/home /dev/dsk/c0t3d0s5 173015 63249 92465 41% /opt swap 163888 24 163864 1% /tmp /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/c0t3d0s1 - - swap - no - |/dev/dsk/c0t3d0s0 /dev/rdsk/c0t3d0s0 / ufs 1 no - |/dev/dsk/c0t3d0s6 /dev/rdsk/c0t3d0s6 /usr ufs 1 no - |/dev/dsk/c0t1d0s6 /dev/rdsk/c0t1d0s6 /usr1 ufs 2 yes - |/dev/dsk/c0t3d0s3 /dev/rdsk/c0t3d0s3 /var ufs 1 no - |/dev/dsk/c0t3d0s7 /dev/rdsk/c0t3d0s7 /export/home ufs 2 yes - |/dev/dsk/c0t3d0s5 /dev/rdsk/c0t3d0s5 /opt ufs 2 yes - |swap - /tmp tmpfs - yes - # format Searching for disks...done AVAILABLE DISK SELECTIONS: 0. c0t1d0 /iommu@0,10000000/sbus@0,10001000/espdma@5,8400000/esp@5,8800000/sd@1,0 1. c0t3d0 /iommu@0,10000000/sbus@0,10001000/espdma@5,8400000/esp@5,8800000/sd@3,0 Specify disk (enter its number): 0 selecting c0t1d0 [disk formatted] Warning: Current Disk has mounted partitions. | format> partition ディスク c0t1d0 は2番パ−ティションが全部になっていた。 | partition> print Current partition table (original): Total disk cylinders available: 20905 + 2 (reserved cylinders) Part Tag Flag Cylinders Size Blocks 0 unassigned wm 0 0 (0/0/0) 0 1 unassigned wu 0 0 (0/0/0) 0 2 backup wu 0 - 20904 8.51GB (20905/0/0) 17852870 3 unassigned wm 0 0 (0/0/0) 0 4 unassigned wm 0 0 (0/0/0) 0 5 unassigned wm 0 0 (0/0/0) 0 6 usr wm 0 - 20904 8.51GB (20905/0/0) 17852870 7 unassigned wm 0 0 (0/0/0) 0 partition> quit *** ここからさらに表示を省略 *** format> disk Specify disk (enter its number)[0]: 1 selecting c0t3d0 format> partition partition> print Current partition table (original): Total disk cylinders available: 2733 + 2 (reserved cylinders) Part Tag Flag Cylinders Size Blocks 0 root wm 0 - 67 50.47MB (68/0/0) 103360 1 swap wu 68 - 270 150.66MB (203/0/0) 308560 2 backup wm 0 - 2732 1.98GB (2733/0/0) 4154160 3 var wm 271 - 378 80.16MB (108/0/0) 164160 4 unassigned wm 0 0 (0/0/0) 0 5 unassigned wm 379 - 621 180.35MB (243/0/0) 369360 6 usr wm 622 - 1632 750.35MB (1011/0/0) 1536720 7 home wm 1633 - 2732 816.41MB (1100/0/0) 1672000 * ufsdump によるディスクのフルバックアップ 内臓ディスクの SCSI ID は3番、外付けディスクには SCSI ID 1番が付いている。外付 けディスクはニュ−テック製 9.1GB、68ピンの SCSI インタ−フェ−スである。この外 付けディスクにディ−ジチェ−ンして、バックアップ用のディスクを付ける。SCSI ID は 2番とする。マシンを一度シャットダウンし、ok boot -r で追加ディスクを認識させる。 # shutdown -g 0 -i s << シングルユ−ザモ−ドで作業してみよう。 # format の format << ディスクをフォ−マットする。 # format の partition << パ−ティションを作成する。ここがちょっとノウハウ。 # newfs /dev/rdsk/c0t2d0s0 << 各パ−ティションのファイルシステムを作成する。 # newfs /dev/rdsk/c0t2d0s4 # newfs /dev/rdsk/c0t2d0s7 # newfs /dev/rdsk/c0t2d0s6 # newfs /dev/rdsk/c0t2d0s5 # mount /dev/dsk/c0t3d1s0 /mnt # vi /mnt/etc/vfstab << マウント情報を外付けディスクにする。 | /dev/dsk/c0t2d0s1 - - swap - no - /dev/dsk/c0t2d0s0 /dev/rdsk/c0t2d0s0 / ufs 1 no - /dev/dsk/c0t2d0s6 /dev/rdsk/c0t2d0s6 /usr ufs 1 no - /dev/dsk/c0t2d0s4 /dev/rdsk/c0t2d0s4 /usr1 ufs 2 yes - << 注。 /dev/dsk/c0t2d0s3 /dev/rdsk/c0t2d0s3 /var ufs 1 no - /dev/dsk/c0t2d0s7 /dev/rdsk/c0t2d0s7 /export/home ufs 2 yes - /dev/dsk/c0t2d0s5 /dev/rdsk/c0t2d0s5 /opt ufs 2 yes - | ブ−トブロックをパ−ティション番号0のル−ト / に # cd /usr/platform/sun4m/lib/fs/ufs ↓ 入れる。 # /usr/sbin/installboot bootblk /dev/rdsk/c0t1d0s0 [ ブ−トブロックはどこにある ] # uname -a SunOS hostB 5.6 Generic_105181-23 sun4m sparc SUNW,SPARCstation-5 # cd /usr/platform # ls -F SUNW,S240@ SUNW,SPARCstation-20@ SUNW,Sun_4_600@ SUNW,SPARCclassic@ SUNW,SPARCstation-4@ sun4c/ SUNW,SPARCclassic-X@ SUNW,SPARCstation-5@ sun4d/ SUNW,SPARCengine-EC-3@ SUNW,SPARCstation-LX@ sun4m/ SUNW,SPARCstation-10@ SUNW,SPARCstation-LX+@ sun4u/ SUNW,SPARCstation-10,SX@ SUNW,SPARCsystem-600@ # ls -l SUNW,SPARCstation-5 lrwxrwxrwx 1 root root 5 ... SUNW,SPARCstation-5 -> sun4m # cd /usr/platform/sun4m/lib/fs/ufs # ls -l -r--r--r-- 1 root sys 7036 ... bootblk 注.外付けディスクの方はバックアップせずに、バックアップ用にコピ−したディスクで も外付けディスクをマウントして使うという手も考えられる。それなら dd コマンド でのコピ−で済ますことができる。その方が簡単でいいかも知れない。 * SI業者用の非常バックアップのやり方 スライスごとに ufsdump コマンドでバックアップをとっておく。 マシンのディスクがク ラッシュしたら、新しいディスクに Solaris のOSを入れて、 バックアップのファイル をレストアするのである。実際、保守契約しているSI業者さんのエンジニアがこのやり 方でファイアウォ−ルのマシンを復活させるのを目のあたりにしました。すごい!。前に 作業に来たエンジニアがバックアップを取っていたのです。 小生は Solaris 2.6 のOS の箱を出して CD-ROM を差し出し、バックアップのファイルの在りかを、エンジニアさん に教えただけです。ということで、そのバックアップの取り方です。先ずディスクの状態 を # df -k で見る。このWWWでは外付けディスクの /usr1 がバックアップのエリアと して使えそうである。ufsdump コマンドはスライス単位のバックアップ、基本的に同じ程 度の容量のファイルができる。このことは注意したい。そしてバックアップを取ったファ イルを、ここでは xxx.dump のことだが、別なマシンにコピ−しておくのである。 # ufsdump 0f /usr1/BACKUP/rut.dump / このやり方は「Solaris 9 システム管理 # ufsdump 0f /usr1/BACKUP/usr.dump /usr ハンドブック」の P.115〜117 にも出て # ufsdump 0f /usr1/BACKUP/var.dump /var いた。シングルユ−ザモ−ドでやらなく # ufsdump 0f /usr1/BACKUP/opt.dump /opt ても、言うほど問題ないと書いてあった。 # ufsdump 0f /usr1/BACKUP/hom.dump /export/home ------------------------------------------------------------------------------------ [ 付録 ] scsiinfo プログラムの入手、参考文献など * scsiinfo プログラムの入手とオプション ディスクの情報を取るのは以下のようにやる。RAW デバイスの適当なパ−ティョンを指定 する。/dev/rsd0a や /dev/rsd0g でもいい。/dev/rsd0 はだめである。 # scsiinfo -F /dev/rsd0c partition のとこは、このコマンドが気 disk_type = "SEAGATE ST1480 SUN0424" \ を利かせて、 パ−ティション c だけ作 : ctlr = SCSI : fmt_time = 1 \ る場合の情報を出している。 : trks_zone = 9 : asect = 2 \ : ncyl = 1462 : acyl = 2 : pcyl = 1476 : nhead = 9 : nsect = 64 \ : rpm = 4412 : bpt = 37632 partition = "SEAGATE ST1480 SUN0424" \ : disk = "SEAGATE ST1480 SUN0424" : ctlr = SCSI \ : c = 0, 842112 # scsiinfo -f /dev/rsd0c Vendor: SEAGATE Model: ST1480 SUN0424 Revision: 5826 Serial: 00511706 Device Type: Disk Data Transfer Width(s): 8 Supported Features: SYNC_SCSI LINK_CMD TAG_QUEUE Formatted Capacity: 843284 sectors (422 MB) Sector size: 512 bytes Physical Cylinders: 1476 Heads: 9 Sectors per track (Avg.): 64 Tracks per zone: 9 Alternate Sectors per zone: 2 Alternate Tracks per volume: 9 Rotational speed: 4412 rpm Cache: Read-Only # scsiinfo -f /dev/rsd1c scsiinfo: Drive doesn't report rpm; assuming 3600. << ディスクに問い合わせした Vendor: HP が、プラッタの回転数は報 Model: C3323-300 告されなかった。多分3600 Revision: 4269 rpm だろうと出ている。 Serial: Unknown Device Type: Disk Data Transfer Width(s): 8 Supported Features: REL_ADDR SYNC_SCSI LINK_CMD TAG_QUEUE Formatted Capacity: 2056008 sectors (1.03 GB) Sector size: 512 bytes Physical Cylinders: 2982 Heads: 7 Sectors per track (Avg.): 120 Tracks per zone: 6723 Alternate Sectors per zone: 0 Alternate Tracks per volume: 490 Rotational speed: 3600 rpm Cache: Read-Write # scsiinfo -f /dev/sd0a << RAW デバイスを指定しないと、こんなように出る。 scsiinfo: /dev/sd0a must be a raw SCSI device. [ scsiinfo の入手とコンパイル ] ソ−スファイルからコンパイルするには、ftp.cdf.toronto.edu から scsiinfo-4.6.shar, 187041 May 14 1999 なんかを取ってくる。# unshar scsiinfo-4.6.shar とやって展開し、 Makefile を SunOS 4.1.x 用に少し修正する。純正Cコンパイラで1分もかからなかった。 % unshar scsiinfo-4.6.shar << SunOS のマシンには unsharコマンド /usr/local/source/SCSI/scsiinfo-4.6.shar: がなかったので、unshar コマンドが shar: Extracting "COPYRIGHT" (947 characters) 入っていた INDY で展開した。 | shar: Extracting "notch.h" (334 characters) shar: Creating directory "include" shar: Creating directory "include/sundev" shar: Extracting "include/sundev/dmaga.h" (0 characters) shar: Creating directory "include/sys" shar: Creating directory "include/sys/scsi" shar: Creating directory "include/sys/scsi/adapters" shar: Extracting "include/sys/scsi/adapters/espcmd.h" (0 characters) shar: Creating directory "include/ptisp" shar: Extracting "include/ptisp/ispmail4.h" (5583 characters) shar: Extracting "include/ptisp/ptisp4.h" (10773 characters) shar: Extracting "include/ptisp/ispmail5.h" (6107 characters) shar: Extracting "include/ptisp/ispvar5.h" (17616 characters) shar: End of shell archive. # cd /usr/local/bin/SCSI # make cc -DSUNOS_VERSION=\"`/usr/bin/uname -r`\" -DISP_SUPPORT -DESP_SUPPORT -DFAS_SUPPORT -DGLM_SUPPORT -DPTISP_SUPPORT -DNOTCH_REPORT -g -Iinclude -target sun4 -c scsiinfo.c cc -DSUNOS_VERSION=\"`/usr/bin/uname -r`\" -DISP_SUPPORT .. sun4 -c utils.c cc -DSUNOS_VERSION=\"`/usr/bin/uname -r`\" -DISP_SUPPORT .. sun4 -c uscsi.c cc -DSUNOS_VERSION=\"`/usr/bin/uname -r`\" -DISP_SUPPORT .. sun4 -c format.c cc -DSUNOS_VERSION=\"`/usr/bin/uname -r`\" -DISP_SUPPORT .. sun4 -c common.c cc -DSUNOS_VERSION=\"`/usr/bin/uname -r`\" -DISP_SUPPORT .. sun4 -c esp.c cc -DSUNOS_VERSION=\"`/usr/bin/uname -r`\" -DISP_SUPPORT .. sun4 -c isp.c cc -DSUNOS_VERSION=\"`/usr/bin/uname -r`\" -DISP_SUPPORT .. sun4 -c fas.c cc -DSUNOS_VERSION=\"`/usr/bin/uname -r`\" -DISP_SUPPORT .. sun4 -c ptisp.c cc -DSUNOS_VERSION=\"`/usr/bin/uname -r`\" -DISP_SUPPORT .. sun4 -c glm.c cc -DSUNOS_VERSION=\"`/usr/bin/uname -r`\" -DISP_SUPPORT .. sun4 -c sunos5.c cc -DSUNOS_VERSION=\"`/usr/bin/uname -r`\" -DISP_SUPPORT .. sun4 -c sunos4.c cc -DSUNOS_VERSION=\"`/usr/bin/uname -r`\" -DISP_SUPPORT .. sun4 -c notch.c /bin/rm -rf scsiinfo cc -o scsiinfo scsiinfo.o utils.o uscsi.o format.o .. sunos4.o notch.o -lkvm これで別に # make install しなくても、このディレクトリにできた scsiinfo をそのま ま使えばいい。# chmod +x scsiinfo をやって実行権を付ければ、即使える。 [ ftp.cdf.toronto.edu サイトの中味 ] % ftp ftp.cdf.toronto.edu Name (ftp.cdf.toronto.edu:katou): anonymous 331 Guest login ok, send your complete e-mail address as password. Password: ftp> cd pub/scsiinfo ftp> ls -rw-r--r-- 1 jdd utstaff 1506 Jul 16 2001 ANNOUNCEMENT lrwxrwxrwx 1 jdd utstaff 12 Feb 9 2000 README -> ANNOUNCEMENT drwxr-xr-x 6 jdd utstaff 1024 Jul 25 2001 binary drwxr-xr-x 2 jdd utstaff 512 Aug 3 2001 contrib -rw-r--r-- 1 jdd utstaff 187041 May 14 1999 scsiinfo-4.6.shar -rw-r--r-- 1 jdd utstaff 198732 Jul 17 2001 scsiinfo-4.7.shar ftp> cd binary ftp> ls -rw-r--r-- 1 jdd utstaff 148 Jul 25 2001 README drwxr-xr-x 2 jdd utstaff 512 May 14 1999 scsiinfo-4.5 drwxr-xr-x 2 jdd utstaff 512 Jul 25 2001 scsiinfo-4.6 drwxr-xr-x 2 jdd utstaff 512 May 13 2002 scsiinfo-4.7 drwxr-xr-x 2 jdd utstaff 512 Aug 2 2001 weikart ftp> ls scsiinfo-4.5 -rwxr-xr-x 1 jdd utstaff 36135 Feb 27 1998 scsiinfo-4.5-sunos4.1.1 -rwxr-xr-x 1 jdd utstaff 36603 Feb 27 1998 scsiinfo-4.5-sunos4.1.2 -rwxr-xr-x 1 jdd utstaff 36604 Feb 27 1998 scsiinfo-4.5-sunos4.1.3 -rwxr-xr-x 1 jdd utstaff 38432 Feb 27 1998 scsiinfo-4.5-sunos5.4 -rwxr-xr-x 1 jdd utstaff 43576 Feb 27 1998 scsiinfo-4.5-sunos5.5.1 -rwxr-xr-x 1 jdd utstaff 47880 Jan 8 1999 scsiinfo-4.5-sunos5.6 -rwxr-xr-x 1 jdd utstaff 93544 Apr 16 1999 scsiinfo-4.5.1-sunos5.7-64bit ftp> ls scsiinfo-4.7 -rwxr-xr-x 1 jdd utstaff 79200 Jul 16 2001 scsiinfo-4.7-sunos5.3 -rwxr-xr-x 1 jdd utstaff 41216 Jul 16 2001 scsiinfo-4.7-sunos5.4 -rwxr-xr-x 1 jdd utstaff 46296 Jul 16 2001 scsiinfo-4.7-sunos5.5 -rwxr-xr-x 1 jdd utstaff 104644 Jul 16 2001 scsiinfo-4.7-sunos5.5.1 -rwxr-xr-x 1 jdd utstaff 51320 Jul 16 2001 scsiinfo-4.7-sunos5.6 -rwxr-xr-x 1 jdd utstaff 53636 Jul 16 2001 scsiinfo-4.7-sunos5.7-32bit -rwxr-xr-x 1 jdd utstaff 111092 Jul 16 2001 scsiinfo-4.7-sunos5.8-32bit -rwxr-xr-x 1 jdd utstaff 128144 Jul 16 2001 scsiinfo-4.7-sunos5.8-64bit -rwxr-xr-x 1 jdd utstaff 129384 May 13 2002 scsiinfo-4.7-sunos5.8HW0202-64bit * 参考文献など http://www.linux.or.jp/JF/JFdocs/Large-Disk-HOWTO-14.html > 14.2 同じディスクが異なるジオメトリを持っている?。/dev/hdb の方はカ−ネルのブ −トパラメ−タ /etc/lilo.conf の `hdb=1232,255,63' を、BIOS が再マップしている。 /dev/hdd の方は /etc/lilo.conf にないので、BIOS がディスクに問い合わせしている。 ブ−トパラメ−タ `hdx=C,H,S' は、シリンダ,ヘッド,セクタ数である。 「Unix バックアップ&リカバリ」 2001/08, 本体価格 6,600 円。ISBN4-87311-049-1。 > えらい高い本だな。名古屋の本屋を丸善など探したがおいてなかった。UNIXなどの ファイルサ−バなどのバックアップに関する本というのは、この本ぐらいしかない?。 「Sun のマニュアル 特記事項:SMCC周辺機器」Solaris 2.5.1 用、1996/06。 > ディスクドライブ、テ−プドライブの設定について。マニュアル一式を購入したのに入 っていたのかな。Solaris 2.6 のパッケ−ジの箱には、該当するのは入ってなかった。 http://www.iopro.net/ IDE ミラ−リングユニット R-IDE2 シリ−ズ。 > 2002/06 頃から発売。1つの IDE を2つの IDE に分岐するユニットにより構成される。 ドライバ不要ハ−ドウェアミラ−リングユニット。両方とに書き込む単純な仕組みのよ うな気がする。数年前、こんなんができるはずだと DOS/V 自作の友人と話していた。 「テクインフォ」CTCと保守契約しているユ−ザに発行の雑誌。 > 2002/05, P.58, Ultra 10 を外付けの CD-ROM から起動する。2002/03, P.59 に複数の ファイルシステムを1本のテ−プに ufsdump する、ufsrestore で戻す記事あり。 「UNIX MAGAZINE」1999/03, P.83〜92,"連載 BSD をハックする バックアップとリストア" > 長期間、連続運転しているマシンを止める際は、バックアップをとっておいた方がいい。 「UNIX MAGAZINE」1993/03,04,05, "ワ−クステ−ションの基礎知識、ハ−ドディスク−1、 > 2、3"。1ではハ−ドディスクの機械的構造が詳しい。2ではハ−ドディスクの動作 原理などが詳しい。3は SCSI ディスクの増設-Sun 編、format.dat について。 「UNIX MAGAZINE」1993/06, "特集ドン!ときたら困るけど、ネットワ−ク管理(2)" > ラベルとは、シリンダ数、ヘッド数、1トラックあたりのセクタ数とパ−ティション情 報のこと。これらをディスクの先頭に書き込む。 「UNIX MAGAZINE」2002/09, P.124〜130, "横着プログラミング8 pdumpfs" > 毎日のスナップショットを保存する。高林哲氏作成、Namazu の開発者。 「UNIX MAGAZINE」2003/01, P.142〜146, "ワ−クステ−ションの音"。 > Ultra 5 にアイオ−デ−タ機器の RAID カ−ド R-IDE2-PCI を入れて、ミラ−リングさ せようとしたがうまく行かなかった。IDE インタ−フェ−スの先が2つにわかれていて、 両方に書き込む。OSにドライバはいらない。 「UNIX MAGAZINE」2003/02, P.124〜142, "ワ−クステ−ションの音"。 > ブ−トブロックのインスト−ル。Solaris 9 に付属する "Solaris Volume manager" 以 前の "Solaris DiskSuite" を利用してミラ−リングしてみる。 このソフトはパ−ティ ション単位でミラ−リングする。予備ディスクを作るのだが、ちょっと手順は複雑。 「UNIX MAGAZINE」2003/05, P.32〜, "特集:Solaris 9 の管理と運用"。 > ufsdump/ufsrestore とmt。Solaris 9 にはスナップショットの仕組みが標準で入った。 fssapコマンド。スナップショットを利用した ufsdump によるバックアップ例。スナッ プショットはある時点のディスクの状態を、マシンを止めずにそのままコピ−する。 「Solaris のシステム管理(第1巻)」 SunSoft 1995年10月発行。 > P.790〜792 ディスクをクロ−ン化する方法(d)。最初にコピ−元とコピ−先のディスク が同じジオメトリを持っていること。 クロ−ンディスクを認識するため /reconfigure ファイルを作成する。# sys-unconfig をやるとか。 * いろいろ参考に [ メ−ルストアにディスクを追加した場合 ] 外付けディスクをマシンに付けて、一度マシンをリブ−トして追加したディスクをマシン に認識させた。その後、外付けディスクの電源を切った時、再度電源を入れた時の様子。 # ./scsiinfo -F /dev/rdsk/c0t1d0s0 電源を入れるとちゃんと認識する。 /dev/rdsk/c0t1d0s0: I/O error ./scsiinfo: SCSI INQUIRY failed. # format Searching for disks...done AVAILABLE DISK SELECTIONS: 0. c0t1d0 /iommu@0,10000000/sbus@0,10001000/espdma@5,8400000/esp@5,8800000/sd@1,0 1. c0t3d0 /iommu@0,10000000/sbus@0,10001000/espdma@5,8400000/esp@5,8800000/sd@3,0 Specify disk (enter its number): [ Sun のマニュアルの「Solaris のシステム管理(第1巻)」によれば ] 先ずコピ−用のディスクを接続する。 # touch /reconfigure デバイスを再構成するため、空のファイル /reconfigure を作 # init 0 る。その後 ok boot で再構成する。または /reconfigureファ ok boot イルはなしで、ok boot -r とやってもいい。 # dd や ufsdump ディスクをコピ−する。コピ−したディスクの vfstab もちゃ # init 0 んとして。# sys-unconfig て、やらないかんのかな?。 ok boot disk1 -s # sys-unconfig # boot disk1 [ メ−ルストアのディスクのいじる前 ] # format Searching for disks...done AVAILABLE DISK SELECTIONS: 0. c0t3d0 /iommu@0,10000000/sbus@0,10001000/espdma@5,8400000/esp@5,8800000/sd@3,0 Specify disk (enter its number): 0 selecting c0t3d0 [disk formatted] FORMAT MENU: disk - select a disk type - select (define) a disk type partition - select (define) a partition table current - describe the current disk format - format and analyze the disk repair - repair a defective sector label - write label to the disk analyze - surface analysis defect - defect list management backup - search for backup labels verify - read and display labels save - save new disk/partition definitions inquiry - show vendor, product and revision volname - set 8-character volume name ! - execute , then return quit format> part << partition の略。 PARTITION MENU: 0 - change `0' partition 1 - change `1' partition 2 - change `2' partition 3 - change `3' partition 4 - change `4' partition 5 - change `5' partition 6 - change `6' partition 7 - change `7' partition select - select a predefined table modify - modify a predefined partition table name - name the current table print - display the current table label - write partition map and label to the disk ! - execute , then return quit partition> print Current partition table (original): Total disk cylinders available: 2733 + 2 (reserved cylinders) Part Tag Flag Cylinders Size Blocks 0 root wm 0 - 134 100.20MB (135/0/0) 205200 1 swap wu 135 - 307 128.40MB (173/0/0) 262960 2 backup wm 0 - 2732 1.98GB (2733/0/0) 4154160 3 unassigned wm 0 0 (0/0/0) 0 4 usr wm 308 - 1655 1000.47MB (1348/0/0) 2048960 5 unassigned wm 1656 - 1790 100.20MB (135/0/0) 205200 6 unassigned wm 1791 - 2060 200.39MB (270/0/0) 410400 7 var wm 2061 - 2731 498.01MB (671/0/0) 1019920 partition> q | << FORMAT MENU: が表示される。 format> verify Primary label contents: Volume name = < > ascii name = pcyl = 3500 ncyl = 2733 acyl = 2 nhead = 19 nsect = 80 Part Tag Flag Cylinders Size Blocks 0 root wm 0 - 134 100.20MB (135/0/0) 205200 1 swap wu 135 - 307 128.40MB (173/0/0) 262960 2 backup wm 0 - 2732 1.98GB (2733/0/0) 4154160 3 unassigned wm 0 0 (0/0/0) 0 4 usr wm 308 - 1655 1000.47MB (1348/0/0) 2048960 5 unassigned wm 1656 - 1790 100.20MB (135/0/0) 205200 6 unassigned wm 1791 - 2060 200.39MB (270/0/0) 410400 7 var wm 2061 - 2731 498.01MB (671/0/0) 1019920 format> q # * SS5 メ−ルストアだったマシンで `25/12 [ マルチユ−ザモ−ドでコピ−した場合の考察 ] 本当は、バックアップ用のディスクをコピ−する時は、シングルユ−ザモ−ドにしてやる のが望ましい。そうでなければ、メ−ルストアならば、このホストでの sendmail を止め る。メ−ルリレ−の sendmail はそのまま稼働させ、外からのメ−ルを受けておく。メ− ルストアでは他に InterScan のソフトがあるぐらいで、 これも停止させればそれで問題 なくコピ−できるような気がする。 sendmail を止めずに、マルチユ−ザモ−ドのままで バックアップしたらどうなるか。 今まさにメ−ルがきた、sendmail デ−モンがメモリの 中でメ−ルを受けている。この時にこのメ−ル領域をディスクにコピ−しているとしよう。 宙に浮いてディスクにはコピ−されないだろう。しかし、元のマシンはそのまま処理する のでメ−ルはちゃんと処理される。多分、メ−ル領域をなめているその時間に来たメ−ル の幾つかがコピ−されることになるのでないか。 コピ−したディスクに繋ぎかえて稼働させると、先に □ メ−ルリレ− 届いた同じメ−ルがもう一度届くということになるで | ないか。もし、そうならばマルチユ−ザモ−ドでバッ --------------------- クアップしても特に問題ないんじゃないのか。クラス | タリングの場合でも、タイミングによってごく稀にメ □ □ メ−ルストア −ルが宙ぶらりんになって、どこかへ行ってしまうこ | | とがあると、Linux でのテスト・レポ−トがあった。 ----------------------- [ 一応 ok boot disk1 をやってみました ] メ−ルストアのマシンを SS5 から V210 に変更して、 マシンが空いたので dd で作った 外付けディスクからブ−トしてみました。# init 1 で止めて ok boot disk1。 GUIの ロッグイン画面が出る前後でおかしなメッセ−ジが出て、無限ル−プみたいになってしま う。仕方ないので Stop+A で止めた。#init 1 はシングルユ−ザモ−ドでマシンを起動す る指示である、ファイルシステムは全部マウントする。#init s もシングルユ−ザモ−ド の指示だがル−トなど最小限のファイルシステムをマウントするだけである。 cssd: starting ccv.sh (pid#341) これら3行が繰り返し出る。341 部は変わる。 cssd: The process "kkcv.sh" has been exited with retcode #9728 ccv: AF_UNIX bind (path: /dev/ccv): Read-only file system 外付けディスク内の /etc/rc2.d/S90loc.ja.cssd を K90.. に変更してみる。ok boot -s でサ−ビスモ−ドで起動して # mount /dev/dsk/c0t1d0s0 /mnt で、外付けディスクをマ ウント。# cd /mnt/etc/rc2.d で作業すればいい。 # init 1 で停止、ok boot disk1 で 再度起動。変なメッセ−ジは出なくなったが、root でロッグインできない。 パスワ−ド を受け付けない。またまた仕方ないのでさっきと同じように、外付けディスク内のshadow ファイルの root アカウントのパスワ−ド部を消した。GUIのロッグイン画面からは跳 ねられる。それでコンソ−ルからロッグインしたら、パスワ−ドなしで入ることができた。 そしてここで # passwd コマンドでパスワ−ドを設定しようとしたら、パスワ−ドデ−タ ベ−スが busy と出てできない。ならば /etc/passwd と /etc/shadow を /mnt/etc にコ ピ−したらどうだ。これもだめだった。いろいろ関係しているみたいでした。難しい。 どうもマシンの起動の様子を見ていたら、内臓のディスクをアクセスしている。ならば筐 体を開けて内臓ディスクを取り外し、外付けディスクだけにした。これで ok boot disk1 をやった。Hostname: xxx の次に、mount: /dev/dsk/c0t3d0s4 no such device と出て後、 幾つかのエラ−が出て終わり。結局これでも起動しなかった。もう一つ何か操作をしない といけないようだ。SunOS 4.1.4 に外付けディスクを付けたのは、ok boot disk1 だけで うまくいったのに。 [ 2つ目の内臓ディスクを付けてみた ] ある懇意にしているSI業者さんからもらった SCSI ディスク。IBM製 2.1 GB モデル、 1996/10/29 発表。Ultrastar 2ES シリ−ズ。Ultra SCSI/Ultra WIDE SCSI インタ−フェ −ス。最大転送速度 40 MB/sec ( Ultra WIDE SCSI 接続時 )。5400rpm、平均シ−ク速度 8.5 msec。コネクタは SCA-2 タイプというのだった。 こんなのがあるとは、これまで知 らなかった。デ−タ幅 16 bit、ピン数 80。電源コネクタはなくて、80ピンの内に入っ ているとのこと。ホットスワップ対応。何のことはない、SS5 に内臓されていたディスク Seagate ST32430WC も、このコネクタだった。ディスク装着の"ゲタ"でコネクタ部が見え なかったので、筐体のカバ−を開けただけでは分からなかったのだ。始めから入っていた ディスク ST32430WCは、筐体のディスク部の下に付いていた。このもう1つは上に付けた、 ジャンパ−ピンの状態は、下の方右から3本にキャップ、右側上から4つ目にキャップ。 # scsiinfo -F /dev/rdsk/c0t1d0s0 IBM MODEL: DCAS-32160 E182115S、 disk_type = "IBM DCAS32160SUN2.1G" \ P/N: 73H7733 2160 MB MLC: E60259A : ctlr = SCSI : fmt_time = 5 \ : trks_zone = 24564 : atrks = 0 : asect = 0 \ : ncyl = 8237 : acyl = 2 : pcyl = 8188 : nhead = 3 : nsect = 171 \ : rpm = 5400 : bpt = 100548 partition = "IBM DCAS32160SUN2.1G" \ : disk = "IBM DCAS32160SUN2.1G" : ctlr = SCSI \ : 2 = 0, 4225581 その後1年ちょっと経って。 メ−ルストアだったホストを SS5 のメ−ルリレ−のホスト として、先ず設定しておいた。その状態をフルバックアップした。シングルユ−ザモ−ド で dd コマンドをかけた。初め bs=10b としたら1時間たっても終わらなかった。多分メ −ルストアだった名残りで一杯ユ−ザのディレクトリがあるので時間がかかったのかも知 れない。しびれを切らして Ctrl+C やったら 393349+0 records in と出た。 コピ−した 途中の段階までが出て来て、まだ完了してないと思う。 bs=10b だと多分 415416+0 が完 了だと思う。bs=63b だとまた違った値が出て来る。dd やった後、一応 fsck もかけてみ たが何も問題はなかった。そしてディスクを交換してマシンをリブ−トした。何もエラ− やワ−ニングらしきものは出ず、メ−ルの動作も問題なかった。 dd コマンドは3がコピ −元、1がコピ−先。これが肝です。これさえ間違わなければ特に恐れることはない。 # init 0 ok boot -s パスワ−ドを入れてくれと出るので入れる。 # dd if=/dev/rdsk/c0t3d0s2 of=/dev/rdsk/c0t1d0s2 bs=63b 65939+1 records in 65939+1 records out