文章轉載自:
http://www.xnlinux.cn/thread-1753-1-1.html
在linux檔案系統中硬碟分區是從1開始的,sda的第一個分區即是sda1 ,但是grub在識別硬碟分區的時候卻是從0開始的,sda1即被grub識別為hd0,0 ,只要注意到這一點就行了。
我的電腦以前裝有win7和ubuntu10.04,最近安裝了RHEL6,結果ubuntu的啟動項直接丟失了
於是進入紅帽,sudo vi/boot/grub/grub.conf
然後進入ubuntu的檔案系統,sudo vi/boot/grub/grub.conf
接著我sudo fdisk -l
將ubuntu中grub檔案所列的ubuntu的資訊按照紅帽grub檔案的格式添加到紅帽的grub檔案中,重啟,啟動項雖然有了,但是還是不能啟動,提示:Cannot mount selected partition
糾結了半天,差點把ubuntu卸掉。。。
後來google了一下錯誤資訊,發現了問題的所在,原來一切的一切都歸咎於一個數字。。。
title Ubuntu
root (hd0,7)
kernel /boot/vmlinuz-2.6.32-21-generic root=UUID=e9f9d111-8ba2-448b-95d9-92c36dc13f52 ro quiet splash
initrd /boot/initrd.img-2.6.32-21-generic
這是紅帽grub檔案中關於ubuntu的資訊,其中root(hd0,7)
注意這個7
我又sudo fdisk -l了一下
Device Boot Start End Blocks Id System
/dev/sda1 3679 10230 52628940 83 Linux
/dev/sda2 * 10231 17242 56323890 7 HPFS/NTFS
/dev/sda3 17243 38913 174072277 f W95 Ext'd (LBA)
/dev/sda4 1 3678 29542400 83 Linux
/dev/sda5 17243 24890 61432528+ 7 HPFS/NTFS
/dev/sda6 24891 31265 51207156 7 HPFS/NTFS
/dev/sda7 31266 38404 57343986 83 Linux
/dev/sda8 38405 38913 4088511 82 Linux swap / Solaris
突然發現ubuntu對應的是/dev/sda7 ,這樣的話他在grub檔案中應該對應root(hd0,6)
於是改成6,重啟,ok