歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux綜合 >> Linux資訊 >> 更多Linux >> GRUB的交互性

GRUB的交互性

日期:2017/2/27 14:22:14   编辑:更多Linux
GRUB 最好的優點之一就是其強健的設計 -- 在不斷使用它時請別忘了這點。如果更新內核或更改它在磁盤上的位置,不必重新安裝 GRUB。事實上,如有必要,只要更新 menu.lst 文件即可,一切將保持正常。 只有少數情況下,才需要將 GRUB 引導裝入器重新安裝到引導記錄。首先,如果更改 GRUB root 分區的分區類型(例如,從 ext2 改成 ReiserFS),則需要重新安裝。或者,如果更新 /boot/grub 中的 stage1 和 stage2 文件,由於它們來自更新版本的 GRUB,很有可能要重新安裝引導裝入器。其它情況下,可以不必理睬! GRUB的最大的特點就是交互性特別強。在開機時,按一下“c”,將進入GRUB 控制台。顯示如下: GRUB version 0.5.96.1 (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> 歡迎使用 GRUB 控制台。現在,再研究命令: 我將通過GRUB 控制台繞過lilo來啟動RedHat Linux, grub> root (h 現在,按一次 Tab 鍵。如果系統中有多個硬盤,GRUB 將顯示可能完成的列表,從 "hd0" 開始。如果只有一個硬盤,GRUB 將插入 "hd0,"。如果有多個硬盤,繼續進行,在 ("hd2") 中輸入名稱並在名稱後緊跟著輸入逗號,但不要按 Enter 鍵。部分完成的 root 命令看起來如下: grub> root (hd0, 現在,繼續操作,再按一次 Tab 鍵。GRUB 將顯示特定硬盤上所有分區的列表,以及它們的文件系統類型。在我的系統中,按 Tab 鍵時得到以下列表: grub> root (hd0, (tab,按tab一下鍵) Possible partitions are: Partition num: 0, Filesystem type is fat, partition type 0x6 Partition num: 2, Filesystem type is ext2fs, partition type 0x83 Partition num: 4, Filesystem type unknown, partition type 0x7 Partition num: 5, Filesystem type is ext2fs, partition type 0x83 Partition num: 6, Filesystem type is fat, partition type 0xb Partition num: 7, Filesystem type is fat, partition type 0xb Partition num: 8, Filesystem type is ext2fs, partition type 0x83 Partition num: 9, Filesystem type unknown, partition type 0x82 如您所見,GRUB 的交互式硬盤和分區名稱實現功能非常有條理。這些,只需要好好理解 GRUB 新奇的硬盤和分區命名語法,然後就可以繼續操作了 grub> root (hd0,8) 現在已安裝了 root 文件系統,到裝入內核的時候了 grub> kernel /boot/vmlinuz-2.4.2 root=/dev/hda5 ro [Linux-bzImage, setup=0x1200, size=0xe1a30] 您已經安裝了 root 文件系統並裝入了內核。現在,可以引導了。只要輸入 "boot",Linux 引導過程就將開始。是不是很cool啊,GRUB的menu.lst更像一個linux下的腳本程序。




Copyright © Linux教程網 All Rights Reserved