標籤:
1、使用隨身碟安裝Centos時,磁碟分割劃分要注意:系統(包含Win7)只能4個主要磁碟分割,所以只能在刪除一個主要磁碟分割或者在擴充分區的空閑分區內建立目錄。
2、Centos在安裝步驟的最後,引導載入程式的選項只有“安裝在隨身碟”一項,註:不可輕易選擇安裝在MBR上,會覆蓋掉Win7系統的引導載入程式。
所以我們先選擇將引導載入程式安裝在隨身碟上,然後再修複。
3、Centos修複grub啟動程序載入程式
參考並轉自:http://blog.csdn.net/llhwin2010/article/details/8435153
用隨身碟安裝CentOS,如果使用預設的boot掛載,會將引導安裝在隨身碟上,必須用隨身碟啟動,遇到這種情況可以通過grub手動寫入引導。(我在另一台伺服器上安裝時手動設定boot但是裝好停留在Grub無法啟動,這個沒深入研究了,在這裡就先說手動修改引導方法,給遇到同樣問題的人蔘考,如有錯誤,歡迎拍磚)
進入grub
Linux代碼
- [[email protected] home]# /sbin/grub
找到grub的位置
Linux代碼
- grub> find /grub/stage1
- (hd0,6)
如果提示Error 15: File not found,則嘗試 find /boot/grub/stage1 或者 find stage1 (hd0,6)代表的第1個硬碟的第7個分區,相應的(hd0,0)代表的就是第一個硬碟第一個分區,這一步其實就是告訴我們引導是否被寫入了隨身碟中
[因為正常情況下,我們的電腦裡只有一塊硬碟,所以第二個硬碟是指隨身碟。(hd1 --> hd0 )至於分區,在使用空閑磁碟空間建立目錄時,會顯示裝置名稱如/dev/sda‘x‘,所在分區即為‘x-1‘,或者使用df命令查看/boot目錄的所在磁碟]
下面進入正題
我們將引導寫入(hd0,6),即第一個磁碟第一個分區中,我在這裡的系統硬碟是這個,具體可以在linux下用df指令查看
Linux代碼
- grub> root (hd0,6) [ 以我的系統為例,我的Centos系統中目錄/boot的分區號為6,所以此處該為root (hd0,6) ]
- Filesystem type is ext2fs, partition type 0x83
-
- grub> setup (hd0)
- Checking if "/boot/grub/stage1" exists... no
- Checking if "/grub/stage1" exists... yes
- Checking if "/grub/stage2" exists... yes
- Checking if "/grub/e2fs_stage1_5" exists... yes
- Running "embed /grub/e2fs_stage1_5 (hd0)"... 15 sectors are embedded.
- succeeded
- Running "install /grub/stage1 (hd0) (hd0)1+15 p (hd0,0)/grub/stage2 /grub/grub.conf"... succeeded
- Done.
-
- grub> reboot
然後修改啟動的 /boot/grub/menu.lst 或者 /boot/grub/grub.conf CentOS下這兩個檔案是綁定的,改一個即可
Linux代碼
- [[email protected] home]# vi /boot/grub/menu.lst
-
- # 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,6) [與上面/boot分區號對應]
- # kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00
- # initrd /initrd-version.img
- #boot=/dev/sdb
- default=0
- timeout=5
- splashimage=(hd0,6) /grub/splash.xpm.gz
- hiddenmenu
- title CentOS (2.6.18-274.3.1.el5)
- root (hd0,6)
- kernel /vmlinuz-2.6.18-274.3.1.el5 ro root=/dev/VolGroup00/LogVol00
- initrd /initrd-2.6.18-274.3.1.el5.img
- title CentOS (2.6.18-238.el5)
- root (hd0,6)
- kernel /vmlinuz-2.6.18-238.el5 ro root=/dev/VolGroup00/LogVol00
- initrd /initrd-2.6.18-238.el5.img
- title Other
- rootnoverify (hd0,6)
- chainloader +1
把當中的(hd1,0)都改成(hd0,6),splashimage=(hd0,6)/grub/splash.xpm.gz 這個是開機引導背景圖片的位置,改不改都關係不大,重啟CentOS就可以正常啟動了
Win7下安裝雙系統Centos,並修複Centos引導載入程式安裝在隨身碟上的問題