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方式去查找。
  • 相关阅读:
    【磁盘/文件系统】第五篇:CentOS7.x__btrfs文件系统详解
    【python】-- IO多路复用(select、poll、epoll)介绍及实现
    【python】-- 事件驱动介绍、阻塞IO, 非阻塞IO, 同步IO,异步IO介绍
    【python】-- 协程介绍及基本示例、协程遇到IO操作自动切换、协程(gevent)并发爬网页
    【python】-- 多进程的基本语法 、进程间数据交互与共享、进程锁和进程池的使用
    【python】-- 队列(Queue)、生产者消费者模型
    【python】-- 信号量(Semaphore)、event(红绿灯例子)
    【python】-- GIL锁、线程锁(互斥锁)、递归锁(RLock)
    【python】-- 继承式多线程、守护线程
    【python】-- 进程与线程
  • 原文地址:https://www.cnblogs.com/black-mamba/p/4883775.html
Copyright © 2011-2022 走看看