想在電腦內多裝一個操作系統,以便熟悉Linux,無奈裝了兩次仍是不成功... 據我的裝機經驗我的電腦內原有Windows XP Media Center Edition,要再裝一個Ubuntu應該不會有什麼問題的... 但是每次安裝完成後重新啟動,它問也不問就啟動Windows... 理論上Ubuntu應該會自動改寫MBR,但問題出在哪裡呢? 唯有研究自己來改寫... 找到以下文章:
http://ying.homedns.org/wp/2007/11/283/及http://ying.homedns.org/wp/2007/12/286/ GRUB (GRand Unified Bootloader 縮寫) 是 linux 系統中常用的系統啟動軟體,另一個同功能的是 LILO (LInux LOader 縮寫),它的作用是接管 BIOS 交付控制權給作業系統時的第一個工作–把作業系統正確地從硬碟載入。通常一般使用者在用光碟裝完 linux 後,例如 ubuntu,系統就會自動裝好 GRUB,就像 Windows 系統一樣。然而如果有某種原因被毀損了,最常見的是在同個硬碟想有 dual system,先裝好 linux 再裝 Windows,Windows 會很不客氣毫不猶豫地直接蓋掉 GRUB,你的 linux 就此無法開機,這時就需要重建 GRUB 了…
如何重建 GRUB 的步驟如下: 使用原來的 linux 安裝光碟開機。現代的系統都是 live-cd,即開機光碟 boot 完就是可操作的系統。 開一個終端機程式,可以輸入命令。 執行 sudo grub,回答密碼。 grub> find /boot/grub/stage1,它會找原來裝 GRUB 的硬碟分區,例如 (hd1,0),即第二個硬碟的第一個分區。 grub> root (hd1,0),告訴它 linux root 在哪裡。 grub> setup (hd0),安裝 GRUB 在第一個硬碟的 MBR (Master Boot Record)。把 Windows 的 bootloader 蓋掉… 之後可以在 GRUB menu 中加入進 Windows 系統的選項,本文不討論這個。 grub> quit,結束,這樣就完成 GRUB rebuild,可以 reboot 了。 另一作法是把 GRUB 安裝在硬碟分區裡,例如 grub> setup (hd1,0),安裝 GRUB 在第二個硬碟的第一個分區,而不是 MBR。這種方法可以使用 Windows 的 boot loader 來作 dual system 啟動 使用 Windows NT/2000/2003/XP 本身的 bootloader 來 dual boot 需要一個叫 bootpart 的程式,在這裡下載。另外要注意安裝 linux 時要把 GRUB 裝在 linux 的分區,而不是裝在 MBR。
bootpart 執行後可以看到類似下面的資料,是所有硬碟的 partition 列表,
C:\>bootpart
Boot Partition 2.60 for WinNT/2K/XP (c)1995-2005 G. Vollant (info@winimage.com)
WEB : http://www.winimage.com and http://www.winimage.com/bootpart.htm
Add partition in the Windows NT/2000/XP Multi-boot loader
Run "bootpart /?" for more information
Physical number of disk 0 : 96e096d
0 : C:* type=7 (HPFS/NTFS), size= 15358108 KB, Lba Pos=63
1 : C: type=5 (Extended), size= 145476607 KB, Lba Pos=30716280
2 : C: type=7 (HPFS/NTFS), size= 145476576 KB, Lba Pos=30716343
Physical number of disk 1 : f6568938
3 : D:* type=83 (Linux native), size= 19535008 KB, Lba Pos=63
4 : D: type=5 (Extended), size= 2000092 KB, Lba Pos=39070080
5 : D: type=82 (Linux swap), size= 2000061 KB, Lba Pos=39070143 找到裝有 linux 的 partition,如上面的 3,執行下面的命令:
C:\>bootpart 3 bootlnx.sec ubuntu
意思是建立一個叫 bootlnx.sec 檔名的檔案,用第三個 partition boot,並用 “ubuntu” 的名字加入 Windows bootloader 的選單。執行完了之後,產生一個 bootlnx.sec 檔案,並在 boot.ini 中加了最後一行:
[boot loader]
timeout=5
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Windows XP Media Center Edition" /noexecute=optin /fastdetect
C:\bootlnx.sec="ubuntu"
這樣就 ok 了,重開機會看到上面的兩個選項 “Windows XP Media Center Edition” 及 “ubuntu”。 如果是使用 Windows Vista,則上面的方法方不適用,但有個更方便的程式可用,有漂亮的 UI,叫 EasyBCD (免費軟體),在這裡下載。
如何重建 GRUB 的步驟如下: 使用原來的 linux 安裝光碟開機。現代的系統都是 live-cd,即開機光碟 boot 完就是可操作的系統。 開一個終端機程式,可以輸入命令。 執行 sudo grub,回答密碼。 grub> find /boot/grub/stage1,它會找原來裝 GRUB 的硬碟分區,例如 (hd1,0),即第二個硬碟的第一個分區。 grub> root (hd1,0),告訴它 linux root 在哪裡。 grub> setup (hd0),安裝 GRUB 在第一個硬碟的 MBR (Master Boot Record)。把 Windows 的 bootloader 蓋掉… 之後可以在 GRUB menu 中加入進 Windows 系統的選項,本文不討論這個。 grub> quit,結束,這樣就完成 GRUB rebuild,可以 reboot 了。 另一作法是把 GRUB 安裝在硬碟分區裡,例如 grub> setup (hd1,0),安裝 GRUB 在第二個硬碟的第一個分區,而不是 MBR。這種方法可以使用 Windows 的 boot loader 來作 dual system 啟動 使用 Windows NT/2000/2003/XP 本身的 bootloader 來 dual boot 需要一個叫 bootpart 的程式,在這裡下載。另外要注意安裝 linux 時要把 GRUB 裝在 linux 的分區,而不是裝在 MBR。
bootpart 執行後可以看到類似下面的資料,是所有硬碟的 partition 列表,
C:\>bootpart
Boot Partition 2.60 for WinNT/2K/XP (c)1995-2005 G. Vollant (info@winimage.com)
WEB : http://www.winimage.com and http://www.winimage.com/bootpart.htm
Add partition in the Windows NT/2000/XP Multi-boot loader
Run "bootpart /?" for more information
Physical number of disk 0 : 96e096d
0 : C:* type=7 (HPFS/NTFS), size= 15358108 KB, Lba Pos=63
1 : C: type=5 (Extended), size= 145476607 KB, Lba Pos=30716280
2 : C: type=7 (HPFS/NTFS), size= 145476576 KB, Lba Pos=30716343
Physical number of disk 1 : f6568938
3 : D:* type=83 (Linux native), size= 19535008 KB, Lba Pos=63
4 : D: type=5 (Extended), size= 2000092 KB, Lba Pos=39070080
5 : D: type=82 (Linux swap), size= 2000061 KB, Lba Pos=39070143 找到裝有 linux 的 partition,如上面的 3,執行下面的命令:
C:\>bootpart 3 bootlnx.sec ubuntu
意思是建立一個叫 bootlnx.sec 檔名的檔案,用第三個 partition boot,並用 “ubuntu” 的名字加入 Windows bootloader 的選單。執行完了之後,產生一個 bootlnx.sec 檔案,並在 boot.ini 中加了最後一行:
[boot loader]
timeout=5
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Windows XP Media Center Edition" /noexecute=optin /fastdetect
C:\bootlnx.sec="ubuntu"
這樣就 ok 了,重開機會看到上面的兩個選項 “Windows XP Media Center Edition” 及 “ubuntu”。 如果是使用 Windows Vista,則上面的方法方不適用,但有個更方便的程式可用,有漂亮的 UI,叫 EasyBCD (免費軟體),在這裡下載。
所有步驟我都做好,可惜仍然是失敗,系統提示“無法以該分區啟動,請放入系統光碟”。
到底問題在那裡呢?...
沒有留言:
張貼留言