kexec fast reboots linux_kexec -l --append-程序员宅基地

Using kexec for fast reboots on Oracle Linux with UEK

 

A feature that's not often talked about in Linux is kexec. kexec is part of an infrastructure that allows the Linux kernel to load a kernel directly. Basically jump right into executing the new kernel immediately instead of going to a standard reset -> system power-on -> bios/firmware initialize -> memory/device discovery -> bootloader -> linux kernel.

在Linux中经常谈到的一个功能是kexec。 kexec是允许Linux内核直接加载内核的基础结构的一部分。 基本上直接跳到执行新内核而不是去标准重置 - >系统开机 - > bios / firmware初始化 - >内存/设备发现 - > bootloader  - > linux内核。

kexec's mechanism is most commonly used with kdump. Basically with kdump, when a crash or panic occurs, a new kernel is booted after the crash while the memory is preserved from the previous kernel's runtime. The new kernel can then capture this data and generate the dump which then can go to local disk, remote disk or anywhere else for that matter. In order to use kdump, you basically have to allocate/reserve memory for this dump kernel. This is done by adding crashkernel=xxx@yyy to the grub command line when booting. The crash kernel image is then loaded and will be executed when a crash or panic occurs. Even though kdump is a bit cumbersome to set up, it allows for really great flexibility and is very powerful in helping with debugging issues.

kexec的机制最常用于kdump。 基本上使用kdump,当发生crash或panic时,在crash之后引导新内核,同时从先前内核的运行时保留内存。然后,新内核可以捕获此数据并生成转储,然后转储可以转到本地磁盘,远程磁盘或其他任何地方。为了使用kdump,你基本上必须为这个转储内核分配/保留内存。 这是通过在启动时将crashkernel = xxx @ yyy添加到grub命令行来完成的。然后加载崩溃内核映像,并在发生崩溃或崩溃时执行。尽管kdump设置起来有点麻烦,但它具有非常大的灵活性,并且在帮助调试问题方面非常强大。

For those interested in kdump, there's a good blog out there test kdump on Oracle Linux.

 Or for those that just want to read the documentation that's part of the Linux kernel tree : kdump.

对于那些对kdump感兴趣的人,有一个很好的博客在Oracle Linux上测试kdump。

  或者那些只想阅读Linux内核树文档的人:kdump。

Anyway, this entry is not about kdump. kdump is great but I wanted to talk about the use of kexec proper and how it can help with doing fast reboots of your systems. Both Oracle Linux 5 and Oracle Linux 6 have support for reboot to use kexec as the reboot mechanism (see /etc/init.d/halt for details). When a standard reboot command is executed, init goes to 6 and /etc/init.d/halt gets run. This script, when it sees that kexec has been configured with a kernel image, will just execute kexec -e. In a standard reboot (not reboot -f) the normal shutdown scripts get executed and at the end where the system normally does a reset.

无论如何,这个条目不是关于kdump。 kdump很棒,但我想谈谈kexec的使用以及它如何帮助你快速重启你的系统。 Oracle Linux 5和Oracle Linux 6都支持重新启动以使用kexec作为重启机制(有关详细信息,请参阅/etc/init.d/halt)。 执行标准重启命令时,init转到6并且/etc/init.d/halt运行。当该脚本看到kexec已经配置了内核映像时,它将只执行kexec -e。在标准重启(不是reboot -f)中,正常的shutdown脚本被执行,并且系统最终确实重启了。

This reset then makes the system hard reset, jump into the bios, does a memory test, finds devices, initialize the devices and firmware, boot the bootdevice bootloader, start the kernel.

此重置然后使系统硬复位,跳转到BIOS,进行内存测试,查找设备,初始化设备和固件,启动bootdevice引导程序,启动内核。

To set up kexec you should run the following command shortly after you boot the system. If you want to automate this, it makes sense to add this to your rc scripts. We will look at integrating this more into the OS management scripts for Oracle Linux to make it easier for the system administrators.

要设置kexec,应在引导系统后立即运行以下命令。 如果要自动执行此操作,将其添加到rc脚本中是有意义的。 我们将考虑将其更多地集成到Oracle LinuxOS管理脚本中,以使系统管理员更容易。

kexec -l --append="`cat /proc/cmdline`"

    --initrd=/boot/initrd-`uname -r`.img /boot/vmlinuz-`uname -r`

 

In my case I am running 2.6.32-200.13.1.el5uek.

Once this is done, the new kernel image is prepared, memory is allocated and you now can do one of 2 things :

在我的情况下,我运行2.6.32-200.13.1.el5uek。

完成此操作后,将准备新的内核映像,分配内存,您现在可以执行以下两项操作之一:

 

- run reboot : halt at the tail end of a normal reboot (shutdown all services) will execute directly into this new kernel image, exactly the same way as you booted the OS to get to this point.

- 运行reboot:在正常重启的尾端停止(关闭所有服务)将直接执行到这个新的内核映像,这与启动操作系统到目前为止完全相同。

 

- you wish to do a very fast reboot without shutdown (reboot -f). then you do

sync; umount -a ; kexec -e

- 你希望在没有关机的情况下进行非常快速的重启(reboot -f)。 然后你做

 

In this case, you bypass all the service shutdown scripts and instantly jump start the new kernel, this is by far the fastest way to restart your box.

在这种情况下,您绕过所有服务关闭脚本并立即启动新内核,这是重启盒子的最快方法。

The total amount of time saved is highly dependent on your server. Basically time a system startup all the way to grub executing the kernel image, that's the amount of time you will save on a subsequent reboot. This can range from a number of seconds (15,20) to, sometimes, several minutes.

节省的总时间在很大程度上取决于您的服务器。 基本上,系统启动的时间一直到grub执行内核映像,这就是你在后续重启时节省的时间。 这可以是几秒(15,20)到有时几分钟。

One caveat with the use of kexec and instant restarts without going through device resets is that, in some cases, the devices might act badly or the driver might not be doing the right thing. Before you really use this on your system, test it first to ensure that the drivers for the hardware you have and the devices themselves are doing the right thing (tm).

使用kexec和即时重启而不经过设备重置的一个警告是,在某些情况下,设备可能表现不佳或者驱动程序可能没有做正确的事情。 在您真正在系统上使用它之前,首先进行测试,以确保您拥有的硬件驱动程序和设备本身正在做正确的事情(tm)。

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/mounter625/article/details/87935872

智能推荐

BP-1-3 Introduction of C++_in c++, a legal identifier may contain these kinds-程序员宅基地

文章浏览阅读115次。Chapter 01 Introduction of Programming3. Introduction of C++A C++ program must have a function named main defined in only one source document.3.1 Lexer in C++symbol setlettersnumbersspecial characterswordIdentifier is composed of letter_in c++, a legal identifier may contain these kinds of characters:

Http重定向https MPM模块 HTTPd常见配置 sendfile 20190227-程序员宅基地

文章浏览阅读3.4k次。Web访问响应模型(Web I/O)单进程I/O模型:启动一个进程处理用户请求,而且一次只处理一个,多个请求被串行响应多进程I/O模型:并行启动多个进程,每个进程响应一个连接请求复用I/O结构:启动一个进程,同时响应N个连接请求实现方法:多线程模型和事件驱动多线程模型:一个进程生成N个线程,每线程响应一个连接请求事件驱动:一个进程处理N个请求复用的多进程I/O模型:启动M个进程,每个进程响应N个连..._httpd启动需要什么pam模块

vue解决 vue-style-loader ,css-loader错误_!!vue-style-loader!css-loader-程序员宅基地

文章浏览阅读4.2k次。最近在学习vue框架,使用webpack打包vue项目,在执行npm run start的时候 出现如下错误:This dependency was not found:* !!vue-style-loader!css-loader?{"minimize":false,"sourceMap":false}!../../node_modules/vue-loader/lib/style-co..._!!vue-style-loader!css-loader

工业相机的接口选择及比较_相机接口中,传输距离最远的是-程序员宅基地

文章浏览阅读2k次。​在了解工业相机接口之前,让我们大概先了解一下什么是工业相机,一般对工业相机的定义大概是机器视觉系统中的一个关键组件,其最本质的功能就是将光信号转变成有序的电信号。选择合适的相机也是机器视觉系统设计中的重要环节,相机的选择不仅直接决定所采集到的图像分辨率、图像质量等,同时也与整个系统的运行模式直接相关。因为没有一个标准的命名,所以工业相机还被称作工业摄像头、工业摄像机、工业照相机等等。从其芯类型中..._相机接口中,传输距离最远的是

关于在ubuntu常用的一些代码_ubuntu的二级文件系统登录界面代码-程序员宅基地

文章浏览阅读483次。注:最近自己搞了一台谷歌云服务器,自己要试着搭建内网穿透,用到了一些ubuntu的操作语言,先记录下,以后再补充1.切换到最高权限用户 sudo su2.切换目录 - cd #切换到根目录 - cd /root #切换到根目录下的root文件夹 - cd .. #返回到当前目录的上级目录3.查看当前目录下的所有文件 - ls -a #查看所有文件 - ls -a..._ubuntu的二级文件系统登录界面代码

文件修改的基本步骤_改文件-程序员宅基地

文章浏览阅读588次,点赞4次,收藏4次。文件修改的基本步骤Python_改文件

随便推点

Asp.net Mvc 使用EF6 code first 方式连接MySQL总结-程序员宅基地

文章浏览阅读121次。最近由于服务器变更为Linux系统.MsSql for Linux什么时候出来到生产环境使用还是要很长时间的.于是考虑使用Mysql数据库,ORM使用EF.于是先踩下坑顺便记录一下,有需要的tx可以参考下.当你考虑使用EF连接Mysql的时候肯定是已经在网上搜了一堆教程.网上教程基本都是使用控制台做演示.跟着一步步来姿势没错的话可能会正常运行,但项目中使用分层后,把数据层剥离出去,再使用..._mvc6使用ef code

android中popupwindow弹出后,屏幕背景变成半透明_andorid popupwindow弹出后背景-程序员宅基地

文章浏览阅读1k次。android中popupwindow弹出后,屏幕背景变成半透明这个效果很普通。实现的方法也很多。我使用的可能是最简单的一种,就是设置一下getWindows的透明度。不多说上代码/** * 设置添加屏幕的背景透明度 * @param bgAlpha */ public void backgroundAlpha(float bgAlpha) { WindowManager._andorid popupwindow弹出后背景

Backup And Recovery User's Guide-为完全数据库恢复做准备-确定数据库的DBID-程序员宅基地

文章浏览阅读72次。确定数据库的DBID 当需要恢复服务器参数文件或控制文件时,必须知道DBID。应该将DBID和其它数据库基本信息记录在一起。 如果没有数据库的DBID的记录,则可以在不打开数据库的情况下在下面的..._在应用备份恢复时,必须知道目标数据库的dbid

solr <一>用 Java客户端 建索引+分页查询_java 利用solr搜索引擎客户端如何创建索引-程序员宅基地

文章浏览阅读1.8k次。在 solr 3.5 配置及应用(一) 讲过一了 solr 3.5的详细配置,本节我们讲利用solr 的客户端调用solr的应用了!一、利用SolrJ操作solr API 使用SolrJ操作Solr会比利用httpClient来操作Solr要简单。SolrJ是封装了httpClient方法,来操作solr的API的。SolrJ底层还是通过使用httpClient中的方法来完_java 利用solr搜索引擎客户端如何创建索引

sent2vec-程序员宅基地

文章浏览阅读1k次。环境配置EmbedRank在标准数据集上实现了比基于图形的最先进系统更高的F分数,适用于实时处理大量Web数据。利用EmbedRank,我们还为新短语引入了基于嵌入的最大边际相关性(MMR),从而显式地增加了所选关键词的覆盖率和多样性。一项包括200多张选票的用户研究表明,虽然减少短语的语义重叠不会导致F分的增加,但我们的高度多样性选择是人类更喜欢的。保证了关键词的两个最具挑战性的性质:由候选短语与整个文档的嵌入距离获得的信息性;由候选短语之间的距离表示的多样性。文章目录环境配置相关信息装置本_sent2vec

Pycharm使用技巧(转载)-程序员宅基地

文章浏览阅读305次。Pycharm使用技巧(转载)转载自:http://www.cnblogs.com/cloudtj/articles/5980666.htmlpycharm使用技巧https://python.freelycode.com/contribution/detail/29https://python.freelycode.com/contribution/detail..._pycharm映射的web路径是指什么