zoukankan      html  css  js  c++  java
  • 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) 
    root (hd0,0) 
     Filesystem type is ext2fs, partition type 0x83 
    grub> install /grub/stage1 (hd0) /grub/stage2 p /grub/grub.conf 
    install /grub/stage1 (hd0) /grub/stage2 p /grub/grub.conf 
    boot为非独立分区时
    grub>root (hd0,0) 
    grub>install /boot/grub/stage1 (hd0) /boot/grub/stage2 p /boot/grub/grub.conf
    2、setup命令
         setup [--prefix=DIR] [--stage2=STAGE2_FILE] [--force-lba] INSTALL_DEVICE [IMAGE_DEVICE] 
         INSTALL_DEVICE:指定安装grub的位置。 
         IMAGE_DEVICE:指定要安装的镜象文件。 
    例如:
    grub> root (hd0,0) 
    root (hd0,0) 
     Filesystem type is ext2fs, partition type 0x83 
    grub> setup (hd0) 
    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)"...  26 sectors are embedded. 
    succeeded 
     Running "install /grub/stage1 (hd0) (hd0)1+26 p (hd0,0)/grub/stage2 /grub/grub.conf"... succeeded 
    Done.
    3、grub-install命令
         grub-install拷贝grub镜象文件到/boot目录中(可以通过参数--root-directory指定目录),并用grub shell安装grub到MBR中。
    grub-install [OPTION] install_device
    例如:
    [root@client ~]# grub-install hd0  (或者是grub-install /dev/sda也行)
    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
     
     
    注意:
    grub-install命令安装grub到MBR中的时候利用的安装源是/usr/share/grub/x86_64-RedHat/下的stage1、stage2和各种stage1_5。它利用stage1_5 -> stage2 方式的文件系统方式去查找,如果stage2不存在,那么系统就不能启动。
    install、setup命令安装grub的安装源是/boot/grub目录中的stage1、stage2和各种stage1_5。所以这两种安装方法来安装grub到MBR中的时候,确保/boot/grub目录中的stage1、stage2和各种stage1_5必须存在。setup命令利用stage1_5 -> stage2方式去查找stage2,首先监测是否有合适的文件系统驱动,存在就使用文件系统逻辑的方式查找stage2 ;如果不存在就用blocklist的方式再找stage2。Install命令利用stage1 -> stage2方式去查找。
  • 相关阅读:
    mac 版 Pycharm 激活
    最快的 maven repository--阿里镜像仓库
    java-Object
    java --replaceAll方法
    正则表达式中^[a-z]与[^a-z]有区别吗
    keyListener用的健值表,保留一份
    java播放背景音乐 mp3和mav都可以播放
    腾讯云ubuntu远程桌面
    nginx 配置转发到其他多台服务器
    java 键盘监听事件
  • 原文地址:https://www.cnblogs.com/black-mamba/p/4883775.html
Copyright © 2011-2022 走看看