ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 手动创建系统启动镜像文件:initrd.img

手动创建系统启动镜像文件:initrd.img

原创 Linux操作系统 作者:panpong 时间:2014-08-20 11:02:38 0 删除 编辑

手动创建系统启动镜像文件:initrd.img

有时候为了能让某些模块提前加载,修改系统启动引导文件可能是唯一方法;下面是从网上摘录的提前加载multipath所需模块并提前启动multipath的过程;大体上分四步;

步骤一:创建新的启动文件

mkinitrd --with=scsi_dh_rdac --with=dm-mod --with=dm-multipath --with=dm-round-robin initrd-`uname -r`.img `uname -r`

 

步骤二:抽取这些文件

Extract the initrd image to a temp directory

 

#mkdir temp

#cd temp

#gzip -dc ../initrdmp.gz | cpio -id

 

步骤三:修改部分内容

Copy multipath.conf to the initrd image

 

#cp /etc/multipath.conf temp/etc/

 

步骤四:重新打包文件

Repackage the initrd image

 

#find ./ | cpio -H newc -o > ../initrdmp

#gzip initrdmp

#cp initrdmp.gz /boot/

 

要想在系统启动时自动选择引导文件,还需要修改grub.conf文件;

[root@racdb ~]# vi /boot/grub/grub.conf

# grub.conf generated by anaconda

#

# Note that you do not have to rerun grub after making changes to this file

# NOTICE:  You have a /boot partition.  This means that

#          all kernel and initrd paths are relative to /boot/, eg.

#          root (hd0,0)

#          kernel /vmlinuz-version ro root=/dev/sda3

#          initrd /initrd-version.img

#boot=/dev/sda

default=0

timeout=5

splashimage=(hd0,0)/grub/splash.xpm.gz

hiddenmenu

title Red Hat Enterprise Linux AS (2.6.9-78.ELsmp)

        root (hd0,0)

        kernel /vmlinuz-2.6.9-78.ELsmp ro root=LABEL=/ rhgb quiet clock=pit nosmp noapic nolapic

        initrd /initrd-2.6.9-78.ELsmp.img

title Red Hat Enterprise Linux AS-up (2.6.9-78.EL)

        root (hd0,0)

        kernel /vmlinuz-2.6.9-78.EL ro root=LABEL=/ rhgb quiet

        initrd /initrd-2.6.9-78.EL.img

修改第一部分的红色部分为新生成的启动镜像文件名称,将新生成的启动镜像文件复制到/boot下;

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/16976507/viewspace-1254493/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
数据库工程师,熟悉Oracle,Postgresql,MySQL等主流关系型数据库运维,调优,一直活跃在运维一线。了解Python,Django,简单自动化运维系统开发。

注册时间:2009-03-06

  • 博文量
    142
  • 访问量
    392347