我的機器上有兩塊硬碟:一塊 80G(從盤),一塊 4.3G(主盤)。80G 硬碟上裝有 WIN XP(C: 盤,FAT32 格式),後來我想把 Red Hat 9 裝到 4.3G 硬碟上供學習用。因為剛開始學、不敢亂動(硬碟裡有幾年收藏的重要資料),所以在安裝前先拔掉 80G 的電源,只接 4.3G 硬碟,Red Hat 9 安裝一切正常。
裝好之後再把 80G 硬碟接回去,問題就來了:在 BIOS 中設為從 HD0 開機時,GRUB 裡沒有 WIN XP 的啟動選單,只能啟動 Red Hat 9;設為從 HD1 開機時,又只能啟動 WIN XP。要在不同系統間切換就得改 BIOS,很麻煩。於是我希望在不重裝系統的前提下實現雙重開機。
我試過 grub for dos 但沒引導成功,最終透過修改 GRUB 的 grub.conf 成功實現。以下是我的設定:
# grub.conf generated by anaconda # # Note that you do not have to rerun grub after making changes to this file # NOTICE: You have a /boot partition. This means that # all kernel and initrd paths are relative to /boot/, eg. # root (hd0,0) # kernel /vmlinuz-version ro root=/dev/hda2 # initrd /initrd-version.img #boot=/dev/hda default=1 timeout=10 splashimage=(hd0,0)/grub/splash.xpm.gz title Red Hat Linux 9 (2.4.20-8) root (hd0,0) kernel /vmlinuz-2.4.20-8 ro root=LABEL=/ initrd /initrd-2.4.20-8.img title Windows XP+SP2 map (hd0) (hd1) map (hd1) (hd0) rootnoverify (hd1,0) makeactive chainloader +1
關鍵在於用 map 把兩顆硬碟的順序對調,讓 Windows 以為自己所在的是第一顆硬碟,再用 rootnoverify、makeactive 與 chainloader +1 把控制權交給 Windows 的開機磁區。要注意每個命令與後面括號之間要有空格。如果你也遇到類似問題,希望本文能供你參考。