新系統開機

  1. 新製作好的隨身碟開機,如果無法順利完成整個開機過程,至少會出現 grub-shell,如同 grub.conf 的設定,指定正確的 root, kernel, initrd 應該可以開機。以下是 grub (非 grub 2),這個 shell 一樣可以使用 TAB 來補齊或提示參數。
    [ 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>
    
  2. root 指定核心所在位置 (hd0,0),成功會出現檔案系統訊息。
    grub> root (hd0,0)
     Filesystem type is ext2fs, partition type 0x83
    
  3. 指定核心及根目錄掛載點,最後一定要加上參數 selinux=0 關閉 SELinux,否則會開機後會無法登入。
    grub> kernel /vmlinuz-2.6.32-573.el6.x86_64 root=/dev/mapper/vg_crt-root selinux=0
     [Linux-bzImage, setup=0x3c00, size=0x5de280]
    
  4. 指定 initrd 檔。
    grub> initrd /initramfs-4.8.1-1.el6.elrepo.x86_64.img
     [Linux-initrd @ 0x361f1000, 0x1dfe1b5 bytes]
    
  5. 開機。
    grub> boot
    
  6. 開機後檢查目前隨身碟編號 sdc,重新安裝 grub 至 sdc,出現錯誤。
    [root@deyu ~]# df -h
    Filesystem            Size  Used Avail Use% Mounted on
    /dev/mapper/vg_crt-root
                           12G  6.5G  4.7G  59% /
    tmpfs                 3.9G   80K  3.9G   1% /dev/shm
    /dev/sdc1             190M   72M  105M  41% /boot
    /dev/mapper/vg_crt-home
                          190M   23M  153M  13% /home
    
    [root@deyu ~]# grub-install /dev/sdc
    /dev/sdc does not have any corresponding BIOS drive.
    
  7. 必須以 --recheck 選項重新安裝 grub 到 sdc。
    [root@deyu ~]# grub-install --recheck /dev/sdc
    Probing devices to guess BIOS drives. This may take a long time.
    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'.
    
    (fd0)   /dev/fd0
    (hd0)   /dev/sda
    (hd1)   /dev/sdb
    (hd2)   /dev/sdc
    
  8. 重新開機,SELinux targeted policy relabel 所以要發點時間。
    [root@deyu ~]# reboot