BOOT from MD by GRUB
(At your own risk)
- RAID1を/dev/hda,/dev/hdcで実現している
- bootディレクトリを1つめのパーティションに追いている
上記の場合のGRUB設定を以下にしめす。
device (hd0) /dev/hda
root (hd0,0)
install /boot/grub/stage1 (hd0,0) /boot/grub/stage2 0x8000 (hd0,0)/boot/grub/menu.lst
install /boot/grub/stage1 d (hd0) /boot/grub/stage2 0x8000 (hd0,0)/boot/grub/menu.lst
device (hd0) /dev/hdc
root (hd0,0)
install /boot/grub/stage1 (hd0,0) /boot/grub/stage2 0x8000 (hd0,0)/boot/grub/menu.lst
install /boot/grub/stage1 d (hd0) /boot/grub/stage2 0x8000 (hd0,0)/boot/grub/menu.lst
quit
この内容をGRUBでマニュアル設定するか、以下のようにバッチ実行させる。
grub --batch < raid1-boot.grub
以下がgrubコマンドの解説です。
- device (hd0) /dev/hd?
/dev/hd?をhd0に指定
- root (hd0,0)
hd0の1つめのパーティションをrootに指定
- install /boot/grub/stage1 (hd0,0) /boot/grub/stage2 0x8000 (hd0,0)/boot/grub/menu.lst
stage1を(hd0,0)にインストールし、
stage2からブロックリストをインストールします。
stage2は0x8000にロードされます。
menu.lstを指定して、STAGE2の最初のブロックにはブート時に
パーティションと設定ファイルの名前が使われるようにします。
- install /boot/grub/stage1 d (hd0) /boot/grub/stage2 0x8000 (hd0,0)/boot/grub/menu.lst
stage1を(hd0)のMBRにインストールし、
stage2からブロックリストをインストールします。
stage2は0x8000にロードされます。
stage1はstage2から見える位置にインストールされます('d'指定)。
menu.lstを指定して、STAGE2の最初のブロックにはブート時に
パーティションと設定ファイルの名前が使われるようにします。
以下はgrub上でのhelpでの各コマンドの説明です。
grub> help device
device: device DRIVE DEVICE
Specify DEVICE as the actual drive for a BIOS drive DRIVE. This
command can be used only in the grub shell.
grub> help root
root: root [DEVICE [HDBIAS]]
Set the current "root device" to the device DEVICE, then attempt
to mount it to get the partition size (for passing the partition
descriptor in `ES:ESI', used by some chain-loaded bootloaders),
the BSD drive-type (for booting BSD kernels using their native
boot format), and correctly determine the PC partition where a
BSD sub-partition is located. The optional HDBIAS parameter is a
number to tell a BSD kernel how many BIOS drive numbers are on
controllers before the current one. For example, if there is an
IDE disk and a SCSI disk, and your FreeBSD root partition is on
the SCSI disk, then use a `1' for HDBIAS.
rootnoverify: rootnoverify [DEVICE [HDBIAS]]
Similar to `root', but don't attempt to mount the partition. This
is useful for when an OS is outside of the area of the disk that
GRUB can read, but setting the correct root device is still
desired. Note that the items mentioned in `root' which derived
from attempting the mount will NOT work correctly.
grub> help install
install: install [--stage2=STAGE2_FILE] [--force-lba] STAGE1 [d] DEVICE STAGE2
[ADDR] [p] [CONFIG_FILE] [REAL_CONFIG_FILE]
Install STAGE1 on DEVICE, and install a blocklist for loading
STAGE2 as a Stage 2. If the option `d' is present, the Stage 1
will always look for the disk where STAGE2 was installed, rather
than using the booting drive. The Stage 2 will be loaded at
address ADDR, which will be determined automatically if you don't
specify it. If the option `p' or CONFIG_FILE is present, then the
first block of Stage 2 is patched with new values of the
partition and name of the configuration file used by the true
Stage 2 (for a Stage 1.5, this is the name of the true Stage 2)
at boot time. If STAGE2 is a Stage 1.5 and REAL_CONFIG_FILE is
present, then the Stage 2 CONFIG_FILE is patched with the
configuration filename REAL_CONFIG_FILE. If the option
`--force-lba' is specified, disable some sanity checks for LBA
mode. If the option `--stage2' is specified, rewrite the Stage 2
via your OS's filesystem instead of the raw device.
Last modified: Sat Jun 9 21:12:14 JST 2007