揮発性のメモ2

http://d.hatena.ne.jp/iww/

ほかのHDDにGRUBのインストール

ノートPC用のHDDをデスクトップにUSB接続し、GRUBをインストールする

# grub

grub> device (hd0) /dev/sdc

grub> root (hd0,0)
 Filesystem type is ext2fs, partition type 0x83

grub> setup (hd0)
 Checking if "/boot/grub/stage1" exists... yes
 Checking if "/boot/grub/stage2" exists... yes
 Checking if "/boot/grub/e2fs_stage1_5" exists... yes
 Running "embed /boot/grub/e2fs_stage1_5 (hd0)"...  15 sectors are embedded.
succeeded
 Running "install /boot/grub/stage1 (hd0) (hd0)1+15 p (hd0,0)/boot/grub/stage2 /boot/grub/menu.lst"
... succeeded
Done.

grub> quit

これで起動したところ

GRUB Loading stage1.5

GRUB loading, please wait...
Error 2

失敗


気を取り直して別の方法

# mount /dev/sdc1 /mnt
# grub-install --root-directory=/mnt /dev/sdc
grub-probe: error: Cannot find a GRUB drive for /dev/sdc1.  Check your device.map.

/usr/sbin/grub-install: line 374: [: =: unary operator expected
Installation finished. No error reported.
This is the contents of the device map /mnt/boot/grub/device.map.
Check if this is correct or not. If any of the lines is incorrect,
fix it and re-run the script `grub-install'.

(hd0)   /dev/sdc
(hd1)   /dev/hda

エラー出まくってるが Installation finished. No error reported. も出力されたのを確認。
HDDをノートPCに接続してとりあえず起動することを確認。

device.map

(hd0) /dev/sdc
(hd1) /dev/hda

menu.list

title           Debian GNU/Linux, kernel 2.6.18-5-686 (single-user mode)
root            (hd0,0)
kernel          /boot/vmlinuz-2.6.18-5-686 root=/dev/hda1 ro single
initrd          /boot/initrd.img-2.6.18-5-686

どうしてこれで/dev/hdaからの起動に成功したのかは不明。