LPI Linux 認證/安裝引導管理器
(LPIC-1 版本 5.0)
權重:2
描述
候選人應能夠選擇、安裝和配置引導管理器。
主要知識領域
- 提供替代引導位置和備份引導選項。
- 安裝和配置引導載入程式,例如 GRUB Legacy。
- 對 GRUB 2 進行基本配置更改。
- 與引導載入程式互動。
以下列出了部分使用的檔案、術語和工具
menu.lst,grub.cfg和grub.confgrub-installgrub-mkconfig- MBR
引導載入程式安裝在 MBR (主引導記錄) 中。當系統啟動時,它會將 MBR 中的內容載入到 RAM 中。在 Linux 下,有兩個主要的引導載入程式
- Lilo:LInux LOader。
- Grub:GRand Unified Boot Loader。
引導載入程式允許您選擇要從中引導的映像。一個系統可以包含多個映像(作業系統)。
引導載入程式允許您互動式地執行命令並將引數傳遞給您要引導的映像。initrd 是用於在 RAM 上構建檔案系統以掛載其他檔案系統並執行程式的驅動程式。
GRUB 現在是許多發行版預設的引導載入程式。在安裝 Windows 和 Linux 時,先安裝 Windows,再安裝 Linux,因為 Windows 會在未經詢問的情況下覆蓋 MBR。
兩者都用於將磁碟上的映像載入到 RAM 中。GRUB 比 LILO 具有以下優勢
- 更多作業系統之前的命令。
- 支援儲存在 1024 個 BIOS 柱面限制之外的映像。
- 可以透過檔案系統訪問其配置檔案。
使用 LILO 時,每次新增新映像或更改映像都需要在 MBR 中安裝新的 LILO。
- LILO 將其引導資訊儲存在 MBR 中
- GRUB 將其引導資訊儲存在檔案系統 (menu.lst) 中。
- LILO 也有一個配置檔案 /etc/lilo.conf。
要在 MBR 上安裝 GRUB,請使用grub-install. 該命令 setup 會覆蓋 MBR。
要在 MBR 上安裝 LILO,請使用lilo. lilo 將使用/etc/lilo.conf檔案來了解要寫入 MBR 的內容。
示例/etc/lilo.conf:
# LILO global section boot = /dev/hda # LILO installation target: MBR vga = normal # (normal, extended, or ask) read-only # Mount the root file systems read-only # LILO Linux section image=/boot/vmlinuz # Image to load label=linux # Label to display root=/dev/hda1 # Root partition for the kernel initrd=/boot/initrd # Ramdisk # LILO DOS/Windows section other=/dev/hda3 label=windows # LILO memtest section image=/boot/memtest.bin label=memtest86
示例menu.lst(GRUB 配置檔案)
# GRUB default values timeout 10 # Boot the default kernel after 10 seconds default 0 # Default kernel # Grub for Linux section 0 title GNU/Linux # Title root (hd0,1) # /dev/hda2 root filesystem # Kernel and parameters to pass to the kernel kernel /boot/vmlinuz root=/dev/hda2 read-only initrd /boot/initrd boot # Grub for DOS/Windows section title Winblows root (hd0,2) # /dev/hda3 makeactive chainloader+1
* GRUB Manual * GRUB homepage * Grub wiki * Linux+Win+Grub HowTo * Linux Recovery and Boot Disk Creation with Grub. * Win32 Grub * Booting with GRUB * WinGRUB * GRUB Installer for Windows * GRUB for DOS - Bridging DOS/Windows to Unix/Linux
1) 在軟盤上安裝 Grub 並嘗試手動引導您的映像
mkfs -t ext2 /dev/fd0 mount /dev/fd0 /mnt mkdir -p /mnt/boot/grub cp /boot/grub/stage* /mnt/boot/grub/ cp /boot/grub/e2fs-stage1_5 /mnt/boot/grub/ touch /mnt/boot/grub umount /mnt grub root (fd0) setup (fd0) quit
現在使用軟盤重新啟動,並在提示符下選擇硬碟上的核心。
root (hd0,1) kernel /boot/vmlinuz root=/dev/hda2 read-only initrd /boot/initrd boot
2) 建立 /boot/grub/menu.lst 檔案,並使用 grub 實用程式將 Grub 安裝到您的硬碟驅動器。
3) 重新安裝 lilo。將 /etc/lilo.conf 中預設核心映像的 linux 標籤更改為 SuSE,並將 lilo 程式重新安裝到 MBR 中。