次のページ 前のページ 目次へ

3. ブート可能な RAID

Linux 上での RAID0/1/5 の基本的な設定は、他の文書で詳細にそれを取り上げ ているので、この文書では取り上げません。ルートの RAID 設定と、 標準的な LILO でそれをブート可能なものとする問題に取り組みます。 LILO の (man ページで はない) ソースと raidtools-0.90 と一緒のそれぞれ文書は、ブート動作の詳細 とシステムのブート時のパラメータを、汎用的な RAID 設定についても取り上げ ています。

ここでは2つのシナリオを取り上げます。そのシナリオは、RAID のブート可能 なルートの設定と、既存の RAID でないシステムを RAID のブート可能な ルートへデータ損失無く変換することです。

3.1 標準的な LILO で RAID 1 からブートする

ブート情報を冗長にし保守を簡単にするには、小さい RAID1 を設定しそれをシ ステムディスクの /boot にマウントします。LILO はデバイス 0x9?? を認識せ ず、ブート時そのデバイスの情報を見つけられません。それはその時に RAID サ ブシステムが使える状態になっていないからです。単純な対処として、 ドライブ (群) の構成 (geometry) 情報を LILO に渡すことができます。その情 報から、LILO は、 カーネルが RAID1 パーティション上にあっても、カーネルをロードするた めに必要な情報である"位置"を決定できます。これは、RAID1 パー ティションが標準的なパーティションと同じことによりますが、RAID1 パーティ ションの最後には RAID スーパブロックが書かれています。ブート可能な RAID セットは、ディスクドライブの最初の 1024 メガバイト内に位置しなければなり ません。理論的に、RAID パーティションの始点は 1024 メガバイト内のどこに でも位置できますが、実際には、ブートのための RAID の全体を最初のブロック に位置させるまで、動作させることができませんでした。これは、たぶん、私が まぬけな何かをしたからですが、当時は間違った結果の検討をしませんでした。 それ以来、単純に、ブート可能な RAID を最初のパーティションに位置させ、全 ての私のシステムを設定しています。私はルートが RAID であるシステムの構成 を持っており、それは、/boot にブート可能な RAID1 をマウントするもので、 ルートの RAID セットは次に示すものです――RAID1, RAID5, RAID10 そして RAID1-10 (1つのミラーと1つのRAID0 のセット)。最後のはたいへん特異な LILO ファイルのペアを持ちます。それは、ディスク構成が同じでないからです が、しかしながら、主要なことは初期のブートプロセスにとって同じです。 RAID10 と RAID1-10 のルートのマウントは initrd を使うことが必要 で、ブートプロセスが initrd の環境に移行した後ルートをマウント します。 例として取り上げたシステムの設定ファイルを付録としますので、参照してくだ さい。

従来の LILO の設定ファイルは、素でこのようになっているでしょう――

# lilo.conf - assumes drive less than 1024
        boot = /dev/hda
        delay = 40               # extra, but nice
        vga = normal             # not normally needed
        image = /bzImage
        root = /dev/hda1
        read-only
        label = Linux

RAID の LILO の設定ファイルのペアはこのようになります――

# lilo.conf.hda - primary ide master
        disk=/dev/md0
        bios=0x80
        sectors=63
        heads=16
        cylinders=39770
        partition=/dev/md1
        start=63
        boot=/dev/hda
        map=/boot/map
        install=/boot/boot.b
        image=/boot/bzImage
        root=/dev/md0
        read-only
        label=LinuxRaid

# ---------------------

# lilo.conf.hdc - secondary ide master
        disk=/dev/md0
        bios=0x80                # see note below
        sectors=63
        heads=16
        cylinders=39770
        partition=/dev/md1
        start=63
        boot=/dev/hdc            # this is the other disk
        map=/boot/map
        install=/boot/boot.b
        image=/boot/bzImage
        root=/dev/md0
        read-only
        label=LinuxRaid

BIOS=lineについて

bios がプライマリディスクが無いか、検出に失敗した場合、賢い (大抵、賢くないのですが)bios ならば、セカンダリディスクから、自動的に ブートしてくれます (訳注;上記に示したとおり、bios=0x80)。 しかし、賢くない bios の場合は、lilo.conf.hdc の BIOS=line に bios=0x81 と書きます。 これは IDE bios よりも SCSI bios にありがちです。 筆者においては、最初のブートドライブが異常終了した場合、死んでいる ドライブ C: を置き換えるために、単にプライマリドライブとセカンダリドライブ と交換するつもりで、bios=0x80 のままです。

訳注;賢い?

筆者のいう大抵の bios を A-BIOS, 賢い bios を B-BIOS とし、ちょっとだけ 考察します。

A-BIOS では IDE の primary master は 1番目 、secondary slave は 4番目と ハードウェア的に番号付けを行います。ハードディスクの有無に関知しません。 従って、ユーザは 必ず、primary の ケーブルに master に設定したハードディ スクを取り付けなければなりません。

B-BIOS ではIDE の primary master から順に secondary slave まで、 調べて、ハードディスクが見つかった順に、番号付けをします。ハードディスクが 無い場合や、CDROMの場合、番号は割り当てられません。ユーザは特にケーブルや、 master/slave の設定に気を付ける必要はありません。

さて、エラーが発生した場合を考えてみます。 両 BIOS とも 1番目のハードディスクから、起動するように、ユーザは設定しました。 primary master にあったハードディスクが故障し、primary slave に ハードディスクがあった場合、primary master のハードディスクが認識されず、 primary slave が最初のハードディスクと認識されます。尚、primary master の ハードディスクは boot 直前までは、正常に動作していたもので、primary slave の ハードディスクには boot loader は入っていません。

A-BIOS では 1番目の故障してる primary master のハードディスクの認識に失敗し、 エラーになります。

B-BIOS では 現在 1番目の primary slave の boot loader の無いハードディスク から、boot しようとして、エラーになります。

A-BIOS では、すぐに primary master の問題に気が付くでしょう。

B-BIOS では、primary master の問題に気が付くでしょうか? boot loader の 問題(そのとおりなのですが)と勘違いして OS の再インストール等をして、 primary slave の内容を破壊してしまうかもしれません。

しかしながら筆者は、B-BIOS を賢いと表現しています。

ドライブの構成情報は、fdisk コマンドで得られます――

fdisk -ul (L の小文字)
fdisk -ul /dev/hda

Disk /dev/hda: 16 heads, 63 sectors, 39770 cylinders
Units = sectors of 1 * 512 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/hda1            63     33263     16600+  fd  Linux raid autodetect
/dev/hda2         33264    443519    205128   82  Linux swap
/dev/hda3        443520  40088159  19822320   fd  Linux raid autodetect

* note the listing of the START of each partition

3.2 RAID ブートのための lilo.conf の詳細な説明

RAID の lilo.conf ファイルを以下に示し、各エントリの詳細をコメントとしま す。

# lilo.conf.hda - primary ide master
#       the location of the /boot directory that will be
#       designated below as containing the kernel, map, etc...
#       note that this is NOT the actual partition containing
#       the boot image and info, but rather the device
#       that logically contains this directory.
#       in this example, /dev/md1 is mounted on /dev/md0/boot
     disk=/dev/md0

#       tell LILO which bios device to use for boot, i.e. C: drive
     bios=0x80

#       tell LILO the geometry of the device
#       this is usually but not always the "logical" 
#       geometry. Check the /proc file system or watch
#       the boot messages when the kernel probes for the drive
#       
     sectors=63
     heads=16
     cylinders=39770

#       this is a dummy entry to make LILO happy so it
#       will recognize the raid set 0x9?? and then find
#       the START of the boot sector. To really see
#       what this was for, read the documentation 
#       that comes with the LILO source distribution.
#       This parameter "must" be different than the
#       disk=  entry above. It can be any other mdx
#       device, used or unused and need not be the one 
#       that contains the /boot information
#       
     partition=/dev/md1

#       the first sector of the partition containing /boot information
     start=63

#       the real device that LILO will write the boot information to
     boot=/dev/hda

#       logically where LILO will put the boot information
     map=/boot/map
     install=/boot/boot.b

#       logically where lilo will find the kernel image
     image=/boot/bzImage

#       standard stuff after this
#       root may be a raid1/4/5 device
     root=/dev/md0
     read-only
     label=LinuxRaid


次のページ 前のページ 目次へ