GRUB學習

一、GRUB 簡介

系統啓動引導管理器,是在計算機啓動後運行的第一個程序,他是用來負責加載、傳輸控制到操作系統的內核,一旦把內核掛載,系統引導管理器的任務就算完成退出,系統引導的其它部份,比如系統的初始化及啓動過程則完全由內核來控制完成。

二、GRUB軟件包版安裝

在linux系統中查看有沒有安裝grub-0.97-13.2包,如過沒有安裝此包,那麼可以在光盤中找到grub-0.97-13.2進行安裝即可。一般在安裝完系統後該包已經被安裝到系統中。如果沒有rpm包可以下載tar包進行編譯安裝。(grub-0.97-13.2是安裝grub到mbr中的工具包)
[root@rhel5 ~]# rpm -qa grub
grub-0.97-13.2
[root@rhel5 ~]#

三、GRUB的配置文件grub.conf的寫法

 1. 設備命名命名習慣

首先GRUB要求設備名被括在一個括號中。fd表示軟盤,hd 表示硬盤(不區分IDE還是SCSI)。其次設備是從0開始編號。分區也是如此,分區和設備之間用一個逗號分開。
下面給出幾個例子 :
(fd0) :表示整個軟盤
(hd0,1)表示系統的第一個硬盤的第2個分區
(hd0,0):表示系統中的第一個硬盤的第一個分區。
如果沒有指定某個分區,則表示使用整個設備,否則只使用指定的分區。

 2. grub.conf的寫法

default:定義默認引導的操作系統。0 表示第一個操作系統,1表示第2個,依此類推。
hiddenmenu:用於啓動時隱藏菜單,除非在timeout之前按下 ESC 才能看到菜單。
timeout:定義多少秒內如果用戶沒有按下鍵盤上的某個按鍵,就自動引導 default 所指定的操作系統。
splashimage:指定啓動的背景圖片,一般爲壓縮文件。路徑爲絕對路徑。
title:定義引導項目的名稱。
root:指定boot分區所在磁盤及分區,如:root (hd0,0)。
kernel:指定kernel文件所在絕對目錄地址,如:kernel /boot/vmlinuz-2.6.18-92.el5 ro root=LABEL=/ rhgb quiet。
initrd:指定ramdisk盤所在絕對目錄地址,如:initrd /boot/initrd-2.6.18-92.el5.img。
 
注意:
kernel與initrd這兩個設置項中,指定的路徑都是絕對路徑。因爲這兩個文件都存放在/boot目錄。而且/boot所在的分區已經在root (hd[0-n],[0-n])中指定,所以就無需再指明kernel與initrd在哪個分區了。如果boot分區爲獨立分區,那麼前面的/boot省略掉。如果boot分區爲非獨立分區,那麼必須加上/boot。

 3.boot分區爲獨立分區

[root@RHEL5 grub]# cat grub.conf
default=0
#啓動第一個操作系統。
timeout=5
#超時時間爲5秒。
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux Server (2.6.18-92.el5) #設置項目標題。
        root (hd0,0)
#設置boot分區所在位置,第一個硬盤的第一分區。
        kernel /vmlinuz-2.6.18-92.el5 ro root=LABEL=/ rhgb quiet
#設置kernel所在位置。注意這裏的root指的系統根所在位置,與上面的root不同。
        initrd /initrd-2.6.18-92.el5.img
        #設置initrd所在位置。
[root@RHEL5 grub]#

 4.boot分區非獨立分區

[root@rhel5 ~]# cat /boot/grub/grub.conf
default=0
#啓動第一個操作系統。
timeout=5
#超時時間爲5秒。
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux Server (2.6.18-92.el5) #設置項目標題。
        root (hd0,0)
#設置boot分區所在位置,第一個硬盤的第一分區。
        kernel /boot/vmlinuz-2.6.18-92.el5 ro root=LABEL=/ rhgb quiet
#設置kernel所在位置。注意這裏的root指的系統根所在位置,與上面的root不同。
        initrd /boot/initrd-2.6.18-92.el5.img
#設置initrd所在位置。
[root@rhel5 ~]#

四、GRUB和stage文件

 

 1. stage文件

GRUB含有幾個images文件,兩個必需的文件stage1和 stage2,可選的爲stage1_5和兩個網絡引導的文件nxgrub和pxegrub。stage1 是用於引導GURB的一個必須的映象文件。通常它是被嵌入到 MBR。或者一個分區的引導扇區之中。因爲 PC 的引導扇區是 512 字節,所以 stage1也是512字節。stage1的作用就是從一個本地磁盤加載stage 2 或者stage1_5 。因爲大小的限制,stage1 對stage2 或者stage1_5的位置進行編碼。
stage1與stage2文件一般位於/boot/grub/目錄下,在這個目錄下還有很多stage1_5的文件,而且都是以文件系統格式命名的。它們的目的是在stage1和stage2之間搭建一個橋樑,也就是stage1加載stage1_5, 然後stage1_5加載stage2。stage1 和stage1_5的不同之處是 stage1無法識別文件系統,stage1_5可以。因爲 Stage2 太大了,無法被嵌入到某個固定的區域,而stage1_5可以安裝在 MBR 之後的位置。

 2.grub啓動方式

 1)stage1_5 -> stage2 方式

首先監測是否是合適的文件系統的驅動,如果存在就使用文件系統邏輯的方式stage2 ;如果找不到就用blocklist的方式再找stage2,找到了掛起來,找不到報錯。

 2)stage1 -> stage2方式

如果確認stage1_5沒有被安裝在MBR之後, stage1就會使用記錄的stage2的blocklist尋找stage2,找到後掛起來,找不到報錯。

五、GRUB三種安裝方式

在linux系統中可以執行grub命令。進入grub的命令界面,在這裏面可以使用一些常用的命令。也可以對不太瞭解的命令進行幫助查看。可以使用TAB鍵對命令進行補全操作,系統會給予提示信息。如下:
[root@RHEL5 ~]# grub
Probing devices to guess BIOS drives. This may take a long time.
    GNU GRUB  version 0.97  (640K lower / 3072K upper memory)
 [ Minimal BASH-like line editing is supported.  For the first word, TAB
   lists possible command completions.  Anywhere else TAB lists the possible
   completions of a device/filename.]
 
grub> help
blocklist FILE                         boot
cat FILE                               chainloader [--force] FILE
clear                                  color NORMAL [HIGHLIGHT]
configfile FILE                        device DRIVE DEVICE
displayapm                             displaymem
find FILENAME                          geometry DRIVE [CYLINDER HEAD SECTOR [
halt [--no-apm]                        help [--all] [PATTERN ...]
hide PARTITION                         initrd FILE [ARG ...]
kernel [--no-mem-option] [--type=TYPE] makeactive
map TO_DRIVE FROM_DRIVE                md5crypt
module FILE [ARG ...]                  modulenounzip FILE [ARG ...]
pager [FLAG]                           partnew PART TYPE START LEN
parttype PART TYPE                     quit
reboot                                 root [DEVICE [HDBIAS]]
rootnoverify [DEVICE [HDBIAS]]         serial [--unit=UNIT] [--port=PORT] [--
setkey [TO_KEY FROM_KEY]               setup [--prefix=DIR] [--stage2=STAGE2_
terminal [--dumb] [--no-echo] [--no-ed terminfo [--name=NAME --cursor-address
testvbe MODE                           unhide PARTITION
uppermem KBYTES                        vbeprobe [MODE]
grub> help root
root: root [DEVICE [HDBIAS]]
    Set the current "root device" to the device DEVICE, then attempt
    to mount it to get the partition size (for passing the partition
    descriptor in `ES:ESI', used by some chain-loaded bootloaders),
    the BSD drive-type (for booting BSD kernels using their native
    boot format), and correctly determine  the PC partition where a
    BSD sub-partition is located. The optional HDBIAS parameter is a
    number to tell a BSD kernel how many BIOS drive numbers are on
    controllers before the current one. For example, if there is an
    IDE disk and a SCSI disk, and your FreeBSD root partition is on
    the SCSI disk, then use a `1' for HDBIAS.
rootnoverify: rootnoverify [DEVICE [HDBIAS]]
    Similar to `root', but don't attempt to mount the partition. This
    is useful for when an OS is outside of the area of the disk that
    GRUB can read, but setting the correct root device is still
    desired. Note that the items mentioned in `root' which derived
    from attempting the mount will NOT work correctly.
grub>

 1.install命令

命令格式:
install: install [--stage2=STAGE2_FILE] [--force-lba] STAGE1 [d] DEVICE STAGE2 [ADDR] [p] [CONFIG_FILE] [REAL_CONFIG_FILE]
STAGE1:指定stage1文件所在絕對路徑。
DEVICE:指定vstage1裝載的位置。
STAGGE2:指定stage2文件所在絕對路徑。
ADDR:指定裝載stage2的位置,如果不寫,系統自動決定。
例如:
boot爲獨立分區時:
grub>root (hd0,0)
grub>install /grub/stage1 (hd0) /grub/stage2 p /grub/grub.conf
 
boot爲非獨立分區時:
grub>root (hd0,0)
grub>install (hd0,0)/boot/grub/stage1 (hd0) (hd0,0)/boot/grub/stage2 p (hd0,0)/boot/grub/grub.conf
該句可以寫成如下這樣:
grub>root (hd0,0)
grub>install /boot/grub/stage1 (hd0) /boot/grub/stage2 p /boot/grub/grub.conf
注意:
boot分區爲獨立分區與非獨立分區時,安裝方法有區別。

 2.setup命令

命令格式:
setup [--prefix=DIR] [--stage2=STAGE2_FILE] [--force-lba] INSTALL_DEVICE [IMAGE_DEVICE]
INSTALL_DEVICE:指定安裝grub的位置。
IMAGE_DEVICE:指定要安裝的鏡象文件。
例如:
[root@RHEL5 ~]# grub
Probing devices to guess BIOS drives. This may take a long time.
    GNU GRUB  version 0.97  (640K lower / 3072K upper memory)
 [ Minimal BASH-like line editing is supported.  For the first word, TAB
   lists possible command completions.  Anywhere else TAB lists the possible
   completions of a device/filename.]
grub> root (hd0,)
 Possible partitions are:
   Partition num: 0,  Filesystem type is ext2fs, partition type 0x83
   Partition num: 1,  Filesystem type unknown, partition type 0x82
   Partition num: 2,  Filesystem type is ext2fs, partition type 0x83
grub> root (hd0,0)
 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>

 3.grub-install命令

grub-install拷貝grub鏡象文件到DIR/boot目錄中(可以通過參數--root-directory指定目錄),並用grub shell安裝grub到MBR中。
命令格式:
grub-install [OPTION] install_device
例如:
[root@RHEL5 ~]# grub-install hd0
Installation finished. No error reported.
This is the contents of the device map /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'.
# this device map was generated by anaconda
(hd0)     /dev/sda
[root@RHEL5 ~]#

 4.區別

這3種方式中,最常用的是grub-install,其中install是最底層的方式。setup是更高一層的方式,而grub-install是最高級最簡單的方式。grub-install命令安裝grub到MBR中的時候利用的安裝源是/usr/share/grub/i386-redhat/下的stage1、stage2和各種stage1_5。而install命令與setup命令安裝grub的安裝源是/boot/grub目錄中的stage1、stage2和各種stage1_5。所以要使用這兩種安裝方法來安裝grub到MBR中的時候,確保/boot/grub目錄中的stage1、stage2和各種stage1_5必須存在。同時grub-install命令安裝的grub只是利用stage1_5 -> stage2 方式的文件系統方式去查找,如果stage2不存在,那麼系統就不能啓動。setup命令安裝的grub是stage1_5 -> stage2 方式去查找stage2,首先監測是否是合適的文件系統的驅動,如果存在就使用文件系統邏輯的方式查找stage2 ;如果找不到就用blocklist的方式再找stage2。install命令安裝的grub使用stage1 -> stage2方式去查找


六:測試

 1. boot爲獨立分區

該測試boot分區爲獨立分區。分區情況如下:
[root@RHEL5 ~]# fdisk -l
Disk /dev/sda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14          78      522112+  82  Linux swap / Solaris
/dev/sda3              79        3916    30828735   83  Linux
[root@RHEL5 ~]#

 1) grub-install命令測試

首先使用grub-install命令對已安裝好的系統進行重新安裝grub(因爲系統默認的安裝方式是用install安裝的)。
[root@RHEL5 ~]# grub-install hd0
Installation finished. No error reported.
This is the contents of the device map /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'.
# this device map was generated by anaconda
(hd0)     /dev/sda
[root@RHEL5 ~]#
執行完成之後,使用rm命令刪除/boot/grub下的stage2文件,重啓系統。會看到有如下的錯誤出現:
   這個時候我們只能進入linux rescue模式對系統進行修復了,而且只可以使用grub-install命令對系統進行修復。因爲/boot/grub下的stage2文件已經被我們刪掉了。原因是的安裝源已被破壞。這個時候插入光盤,設置爲cdrom啓動,輸入linux rescue回車進入rescue模式中。掛起你的系統到/mnt/sysimage目錄下。執行命令grub-install hd0命令來重新安裝grub系統可以正常啓動。具體操作如下:
 回車
    選配置繼續。(幾步的語言選擇和網絡設置省略)
   選擇ok後,出現sh-3.2#後,執行以下操作。
   完成後重新啓動系統。可以看到系統正常啓動成功了。
 備註:
那麼在什麼情況下使用grub-install命令來重新安裝grub呢?
1:grub被擦掉的時候。2:/boot/grub目錄下的所有鏡像文件都給刪除時。 2:使用grub-install命令安裝的grub且boot/grub目錄下stage2文件被誤刪除時(有人會考慮到把/usr/share/grub/i386-redhat/下的stage2拷貝到/boot/grub目錄中,此方法是不成功的)。

 2) setup命令測試

使用setup命令重新安裝grub到MBR中。
[root@RHEL5 ~]# grub
Probing devices to guess BIOS drives. This may take a long time.
    GNU GRUB  version 0.97  (640K lower / 3072K upper memory)
 [ Minimal BASH-like line editing is supported.  For the first word, TAB
   lists possible command completions.  Anywhere else TAB lists the possible
   completions of a device/filename.]
grub> root (hd0,0)
 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> quit
[root@RHEL5 ~]#
使用rm命令刪除/boot/grub/目錄中的stage2文件重啓系統。系統仍然可以啓動,而且重新生成了stage2文件。如下:
[root@RHEL5 grub]# cd
[root@RHEL5 ~]# cd /boot//grub/
[root@RHEL5 grub]# ls stage2
stage2
[root@RHEL5 grub]#
現在使用shred命令刪除stage2文件,再使用rm命令把stage2文件刪除。重新啓動系統。
[root@RHEL5 grub]# shred -v stage2
shred: stage2: pass 1/25 (random)...
shred: stage2: pass 2/25 (ffffff)...
shred: stage2: pass 3/25 (492492)...
shred: stage2: pass 4/25 (888888)...
shred: stage2: pass 5/25 (924924)...
shred: stage2: pass 6/25 (249249)...
shred: stage2: pass 7/25 (cccccc)...
shred: stage2: pass 8/25 (222222)...
shred: stage2: pass 9/25 (db6db6)...
shred: stage2: pass 10/25 (777777)...
shred: stage2: pass 11/25 (999999)...
shred: stage2: pass 12/25 (eeeeee)...
shred: stage2: pass 13/25 (random)...
shred: stage2: pass 14/25 (dddddd)...
shred: stage2: pass 15/25 (000000)...
shred: stage2: pass 16/25 (555555)...
shred: stage2: pass 17/25 (111111)...
shred: stage2: pass 18/25 (444444)...
shred: stage2: pass 19/25 (aaaaaa)...
shred: stage2: pass 20/25 (333333)...
shred: stage2: pass 21/25 (bbbbbb)...
shred: stage2: pass 22/25 (b6db6d)...
shred: stage2: pass 23/25 (666666)...
shred: stage2: pass 24/25 (6db6db)...
shred: stage2: pass 25/25 (random)...
[root@RHEL5 grub]#rm –rf stage2
[root@RHEL5 grub]#reboot
這個時候系統不能再啓動了,出現如下顯示:
現在要恢復系統的話,只能是使用grub-install命令對系統進行恢復。修復方法與上面相同。

 3) install命令測試

使用install命令重新寫MBR。如下:
[root@RHEL5 ~]# grub
Probing devices to guess BIOS drives. This may take a long time.
    GNU GRUB  version 0.97  (640K lower / 3072K upper memory)
 [ Minimal BASH-like line editing is supported.  For the first word, TAB
   lists possible command completions.  Anywhere else TAB lists the possible
   completions of a device/filename.]
grub> root (hd0,0)
 Filesystem type is ext2fs, partition type 0x83
grub> install /grub/stage1 (hd0) /grub/stage2 p /grub/grub.conf
grub> quit
[root@RHEL5 ~]#
使用rm命令刪除/boot/grub/目錄中的stage2文件重啓系統。系統仍然可以啓動,而且重新生成了stage2文件。如下:
[root@RHEL5 grub]# cd
[root@RHEL5 ~]# cd /boot//grub/
[root@RHEL5 grub]# ls stage2
stage2
[root@RHEL5 grub]#
現在使用shred命令刪除stage2文件,再使用rm命令把stage2文件刪除。重新啓動系統。
[root@RHEL5 grub]# shred -v stage2
shred: stage2: pass 1/25 (random)...
shred: stage2: pass 2/25 (ffffff)...
shred: stage2: pass 3/25 (492492)...
shred: stage2: pass 4/25 (888888)...
shred: stage2: pass 5/25 (924924)...
shred: stage2: pass 6/25 (249249)...
shred: stage2: pass 7/25 (cccccc)...
shred: stage2: pass 8/25 (222222)...
shred: stage2: pass 9/25 (db6db6)...
shred: stage2: pass 10/25 (777777)...
shred: stage2: pass 11/25 (999999)...
shred: stage2: pass 12/25 (eeeeee)...
shred: stage2: pass 13/25 (random)...
shred: stage2: pass 14/25 (dddddd)...
shred: stage2: pass 15/25 (000000)...
shred: stage2: pass 16/25 (555555)...
shred: stage2: pass 17/25 (111111)...
shred: stage2: pass 18/25 (444444)...
shred: stage2: pass 19/25 (aaaaaa)...
shred: stage2: pass 20/25 (333333)...
shred: stage2: pass 21/25 (bbbbbb)...
shred: stage2: pass 22/25 (b6db6d)...
shred: stage2: pass 23/25 (666666)...
shred: stage2: pass 24/25 (6db6db)...
shred: stage2: pass 25/25 (random)...
[root@RHEL5 grub]#rm –rf stage2
[root@RHEL5 grub]#reboot
這個時候系統不能再啓動了,出現如下顯示:

 2.boot爲非獨立分區

該測試系統分區如下:
[root@rhel5 grub]# Last login: Tue Apr 28 08:02:03 2009 from 192.168.88.81
[root@rhel5 ~]# fdisk -l
Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        2544    20434648+  83  Linux
/dev/sda2            2545        2609      522112+  82  Linux swap / Solaris
[root@rhel5 ~]#
boot分區與根在同一分區中。
grub-install命令與setup命令與boot爲獨立分區時使用方法一樣。而install命令略有不同。就是在指定路徑的時候不能省略boot目錄。如下:
grub>root (hd0,0)
grub>install /boot/grub/stage1 (hd0) /boot/grub/stage2 p /boot/grub/grub.conf
 
以下爲測試結果:
使用install命令重新寫MBR。如下:
[root@RHEL5 ~]# grub
Probing devices to guess BIOS drives. This may take a long time.
    GNU GRUB  version 0.97  (640K lower / 3072K upper memory)
 [ Minimal BASH-like line editing is supported.  For the first word, TAB
   lists possible command completions.  Anywhere else TAB lists the possible
   completions of a device/filename.]
grub> root (hd0,0)
 Filesystem type is ext2fs, partition type 0x83
grub>install /boot/grub/stage1 (hd0) /boot/grub/stage2 p /boot/grub/grub.conf
grub> quit
[root@RHEL5 ~]#
使用rm命令刪除/boot/grub/目錄中的stage2文件重啓系統。系統仍然可以啓動。
現在使用shred命令刪除stage2文件,再使用rm命令把stage2文件刪除。重新啓動系統。
[root@RHEL5 grub]# shred -v stage2
shred: stage2: pass 1/25 (random)...
shred: stage2: pass 2/25 (ffffff)...
shred: stage2: pass 3/25 (492492)...
shred: stage2: pass 4/25 (888888)...
shred: stage2: pass 5/25 (924924)...
shred: stage2: pass 6/25 (249249)...
shred: stage2: pass 7/25 (cccccc)...
shred: stage2: pass 8/25 (222222)...
shred: stage2: pass 9/25 (db6db6)...
shred: stage2: pass 10/25 (777777)...
shred: stage2: pass 11/25 (999999)...
shred: stage2: pass 12/25 (eeeeee)...
shred: stage2: pass 13/25 (random)...
shred: stage2: pass 14/25 (dddddd)...
shred: stage2: pass 15/25 (000000)...
shred: stage2: pass 16/25 (555555)...
shred: stage2: pass 17/25 (111111)...
shred: stage2: pass 18/25 (444444)...
shred: stage2: pass 19/25 (aaaaaa)...
shred: stage2: pass 20/25 (333333)...
shred: stage2: pass 21/25 (bbbbbb)...
shred: stage2: pass 22/25 (b6db6d)...
shred: stage2: pass 23/25 (666666)...
shred: stage2: pass 24/25 (6db6db)...
shred: stage2: pass 25/25 (random)...
[root@RHEL5 grub]#rm –rf stage2
[root@RHEL5 grub]#reboot
這個時候系統不能再啓動了,出現如下顯示:
同樣現在要恢復系統的話,只能是使用grub-install命令對系統進行恢復。恢復後系統就可以正常啓動了。

七、修復grub.conf

當系統中的grub.conf文件被刪除掉後。在沒有備份的情況下我們只能用grub交互模式來寫grub.conf文件讓系統重新啓動起來。正如下圖所示:
這臺測試機的分區如下:
 [root@rhel5 ~]# fdisk -l
 Disk /dev/sda: 21.4 GB, 21474836480 bytes
 255 heads, 63 sectors/track, 2610 cylinders
 Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
 /dev/sda1   *           1        2544    20434648+  83  Linux
 /dev/sda2            2545        2609      522112+  82  Linux     swap / Solaris
[root@rhel5 ~]#
boot分區爲非獨立分區。grub.conf文件內容如下:
[root@rhel5 grub]# cat grub.conf
default=0
timeout=5
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux Server (2.6.18-92.el5)
        root (hd0,0)
        kernel /boot/vmlinuz-2.6.18-92.el5 ro root=LABEL=/ rhgb quiet
        initrd /boot/initrd-2.6.18-92.el5.img
現在嘗試用如下操作修復grub.conf文件來啓動系統。
輸入完成後按回車開始正常啓動系統。也可以寫成下面這樣使系統可以正常啓動。不使用卷標指定根,直接使用設備名。
正常進入系統之後在重新編寫grub.conf文件。

八、附錄

grub的詳細使用說明參考info grub的幫助內容或登陸http://www.gnu.org/software/grub/grub.html參考官方說明對grub更深瞭解。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章