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

手动创建系统启动镜像文件: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博客 ” ,链接:http://blog.itpub.net/16976507/viewspace-1254493/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/16976507/viewspace-1254493/

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值