dracut 维基     https://dracut.wiki.kernel.org/index.php/Main_Page

          http://www.360doc.com/content/13/0428/09/12139495_281449877.shtml

dracut  官方手册  https://www.kernel.org/pub/linux/utils/boot/dracut/dracut.html#dracutkernel7

https://www.kernel.org/pub/linux/utils/boot/dracut/

基本介绍

dracut 是一个事件驱动的 initramfs 基础设施。dracut(工具)被用来通过拷贝工具和文件,从一个已经安装的系统创建一个 initramfs 镜像,并将镜像与dracut框架结合在一起。通常发现在 /usr/lib/dracut/modules.d/.

不像已经存在的initramfs框架,dracut的框架尝试有尽可能更少的硬编码进入initramfs。initramfs在生命中有一个基本的目标:获取已经挂载的rootfs,以致我们能够过渡到真正的rootfs。这是所有驱动装置的可用性。因此,取代脚本硬编码去做各种事情,dracut的 initramfs 依赖 udev 去创建符号链接到设备节点,接着,当rootfs的设备节点出现的时候,它被挂载和根切换到rootfs设备。 这个有助于保持在initramfs里要求的时间尽可能的少,以致一些事情,如5s钟启动,作为一个initramfs的存在结果不是不可能的。

在dracut中,大部分的initramfs生成器功能由一群生成模块提供,这些模块是被主要的dracut工具采购,来安装特定的功能进入initramfs。他们存在于这些模块的子目录。和使用由dracut-functions提供的功能去做他们的工作。

dracut 作为新一代的 initramfs 系统,和前一代的initramfs系统的 mkinitrd 的不同点在于, dracut设计上就考虑到了映像尺寸的问题,尽量避免硬编码,以提高生成的 cpio 映像载入内存的速度。实际上,由于initramfs的唯一作用就是挂载rootfs(因此不需要把一堆无用的比如 plymouth 等都装进去),它主要依赖 udev 去获取 rootfs 的设备节点,一旦 rootfs 节点出现则立刻切换过去。按照官方维基的说法:5秒启动不是梦。另外它采用了模块化的方式,使用者可自由在 %{_libdir}/dracut/modules.d 下创建他需要的特殊模块,可扩展性很强。最后它的使用方式和 mkinitrd 非常接近,迁移成本较低。

 dracut 用于制作initrd启动镜像文件, dracut-network会为镜像内添加nfs等网络支持.

centos 7.2

版本: dracut-033-359.el7.x86_64

     dracut-config-rescue-033-360.el7_2.x86_64

     dracut-033-360.el7_2.x86_64
     dracut-network-033-360.el7_2.x86_64

centos 6

  dracut-004-32.el6.noarch
  dracut-kernel-004-32.el6.noarch

命令行工具:

  dracut     create initial ramdisk images for preloading modules。  dracut创建虚拟磁盘映像,提供给内核,预加载块设备模块(例如 IDE,SCSI或者RAID),通过加载这些设备模块访问根文件系统。

      dracut [OPTION...] [<image> [<kernel version>]]

   创建一个带有kernel版本号,为kernel使用的 initramfs 镜像。如果 <kernel version> 被省略,那么使用实际运行的内核版本号。如果 <image> 被省略或为空,那么缺省的位置 /boot/initramfs-<kernel version>.img 被使用

   在启动时,内核解包这个存档进入内存,挂载和使用它作为初始化根文件系统。所有发现的根设备发生在这个早期的用户空间。

   完整的内核命令行选项,详看 dracut.cmdline(7).

     如果被降到一个紧急shell,当启动你的 initramfs时,文件 /run/initramfs/rdsosreport.txt 被创建,这个文件能被安全(手动挂载)的成为一个分区(通用 /启动)或一个USB盘.  通过在内核命令添加 rd.debug 产生附件的调试信息。 /run/initramfs/rdsosreport.txt 包含所有的日志和一些工具的输出。这个文件应该被联系到关于dracut问题的任何报告。

  lsinitrd    tool to show the contents of an initramfs image。if <image> is omitted, then lsinitrd uses the default image /boot/<machine-id>/<kernel-version>/initrd or /boot/initramfs-<kernel-version>.img.

       lsinitrd [OPTION...] [<image> [<filename> [<filename> [...] ]]]

      lsinitrd [OPTION...] -k <kernel-version>

    lsinitrd 显示一个 initramfs 镜像的内容。 如果 <image> 被省略,那么 lsinitrd 用 这个缺省的镜像   /boot/<machine-id>/<kernel-version>/initrd 或者 /boot/initramfs-<kernel-version>.img

    OPTIONS
      -h, --help           print a help message and exit.

      -s, --size            sort the contents of the initramfs by size.

      -f, --file <filename>        print the contents of <filename>.

      -k, --kver <kernel version>  inspect the initramfs of <kernel version>.

  mkinitrd  is a compat wrapper, which calls dracut to generate an initramfs   调用 dracut 来产生 initramfs。

      mkinitrd [OPTION...] [<initrd-image>] <kernel-version> 

    mkinitrd 通过调用 dracut 去创建一个 initramfs 带有<kernel-version>版本的镜像 <initrd-image> 镜像。

    注意: 如果需要生成一个更细粒度控制的镜像,“dracut”应该被直接调用。

    OPTIONS

      --version          print info about the version

      -v, --verbose         increase verbosity level

      -f, --force          overwrite existing initramfs file.

      *--image-version       append the kernel version to the target image <initrd-image>-<kernel-version>.

      --with=<module>      add the kernel module <module> to the initramfs.

      --preload=<module>     preload the kernel module <module> in the initramfs before any other kernel modules are loaded. This can be used to ensure a certain device naming, which should in theory be avoided and the use of symbolic links in /dev is encouraged.

      --nocompress       do not compress the resulting image.

      --help            print a help message and exit.

配置

  /etc/dracut.conf            see dracut.conf5

  /etc/dracut.conf.d/*.conf          see dracut.conf5

 /usr/lib/dracut/dracut.conf.d/*.conf   see dracut.conf5

  Configuration in the initramfs
  /etc/conf.d/              Any files found in /etc/conf.d/ will be sourced in the initramfs to set initial values. Command line options will override these values set in the configuration files.

  /etc/cmdline              Can contain additional command line options. Deprecated, better use /etc/cmdline.d/*.conf.

  /etc/cmdline.d/*.conf          Can contain additional command line options.

服务

  dracut-cmdline.service

  dracut-initqueue.service

  dracut-mount.service

  dracut-pre-mount.service

  dracut-pre-pivot.service

  dracut-pre-trigger.service

  dracut-pre-udev.service

  dracut-shutdown.service

日志

  /var/log/dracut.log      initramfs 镜像创建的日志文件

  /tmp/dracut.log            initramfs 镜像创建的日志文件, 如果 /var/log/dracut.log 没有被写。

参考:

  PXE启动服务器及客户端镜像制作  http://blog.csdn.net/beck_chen/article/details/52672324

dracut 基本介绍的更多相关文章

  1. Linux操作系统的文件查找工具locate和find命令常用参数介绍

    Linux操作系统的文件查找工具locate和find命令常用参数介绍 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.非实时查找(数据库查找)locate工具  locate命 ...

  2. 13.1 CentOS系统启动流程介绍

    CentOS系统启动流程介绍 本章我们将学习 Linux 启动流程和内核模块管理相关的内容.通过本章我们将学习如下内容: Linux 系统的组成及特点 CentOS 系统的启动流程 开机启动成 gru ...

  3. 『学了就忘』Linux日志管理 — 90、Linux中日志介绍

    目录 1.日志相关服务 2.系统中常见的日志文件 1.日志相关服务 在CentOS 6.x中日志服务已经由rsyslogd取代了原先的syslogd服务.RedHat认为syslogd已经不能满足在工 ...

  4. 如何快捷地修改虚拟机镜像——libguestfs-tools工具集介绍

    前言 在使用云服务器产品时,由于问题修复.功能添加.软件更新等原因,往往需要对已有系统镜像进行二次修改. 这种情况下,最为简单的做法是:使用原镜像创建实例,在实例中进行修改,修改完毕后再转镜像.这种做 ...

  5. CSS3 background-image背景图片相关介绍

    这里将会介绍如何通过background-image设置背景图片,以及背景图片的平铺.拉伸.偏移.设置大小等操作. 1. 背景图片样式分类 CSS中设置元素背景图片及其背景图片样式的属性主要以下几个: ...

  6. MySQL高级知识- MySQL的架构介绍

    [TOC] 1.MySQL 简介 概述 MySQL是一个关系型数据库管理系统,由瑞典MySQL AB公司开发,目前属于Oracle公司. MySQL是一种关联数据库管理系统,将数据保存在不同的表中,而 ...

  7. Windows Server 2012 NIC Teaming介绍及注意事项

    Windows Server 2012 NIC Teaming介绍及注意事项 转载自:http://www.it165.net/os/html/201303/4799.html Windows Ser ...

  8. Linux下服务器端开发流程及相关工具介绍(C++)

    去年刚毕业来公司后,做为新人,发现很多东西都没有文档,各种工具和地址都是口口相传的,而且很多时候都是不知道有哪些工具可以使用,所以当时就想把自己接触到的这些东西记录下来,为后来者提供参考,相当于一个路 ...

  9. JavaScript var关键字、变量的状态、异常处理、命名规范等介绍

    本篇主要介绍var关键字.变量的undefined和null状态.异常处理.命名规范. 目录 1. var 关键字:介绍var关键字的使用. 2. 变量的状态:介绍变量的未定义.已定义未赋值.已定义已 ...

随机推荐

  1. linux Ubuntu18.04 安装配置MySQL

    1.安装 ubuntu上安装mysql非常简单只需要几条命令就可以完成. 1. sudo apt-get install mysql-server   2. apt-get install mysql ...

  2. A1012 The Best Rank (25)(25 分)

    A1012 The Best Rank (25)(25 分) To evaluate the performance of our first year CS majored students, we ...

  3. jQuery+Asp.net 实现简单的下拉加载更多功能

    原来做过的商城项目现在需要增加下拉加载的功能,简单的实现了一下.大概可以整理一下思路跟代码. 把需要下拉加载的内容进行转为JSON处理存在当前页面: <script type="tex ...

  4. windows下,cmd 运行 python 脚本,选中文字就停止运行了【已解决】

    参考资料: https://jingyan.baidu.com/article/ce09321bb95dda2bff858f26.html 问题原因: cmd 里面,快速编辑模式会暂停程序 解决步骤: ...

  5. 使用dnspod遭遇的奇特问题以及背后的原因与临时解决方法

    由于园子里有不少用户在使用dnspod,我们觉得有必要将这两天blogjava.net域名在dsnpod遇到的奇特问题分享一下,以免再有人踩着这个坑. 12月11日,我们登录到dnspod的后台时,大 ...

  6. C#入门篇-4:使用运算符

    using System; using System.Text; using System.Collections; using System.Collections.Generic; using S ...

  7. [oldboy-django][2深入django]rest-framework教程

    # rest-framework教程 - settings.py INSTALL-APPS = [ 'snippets', # app 'rest-framework', ] - 创建model # ...

  8. Map的常用方法keySet()、entrySet()

    Map是java中的接口,Map.Entry是Map的一个内部接口. Map提供了一些常用方法,如keySet().entrySet()等方法,keySet()方法返回值是Map中key值的集合:en ...

  9. firewalld的防火墙

    firewalld的介绍与简单应用 CentOS7的默认防火墙是firewalld,在之前使用iptables时,关闭了firewalld服务,现在反过来关闭iptables服务,打开firewall ...

  10. 【bzoj2179】FFT快速傅立叶 FFT

    题目描述 给出两个n位10进制整数x和y,你需要计算x*y. 输入 第一行一个正整数n. 第二行描述一个位数为n的正整数x. 第三行描述一个位数为n的正整数y. 输出 输出一行,即x*y的结果. 样例 ...