修改Linux内核版本(已编译多内核的情况下)

来源:互联网 发布:日本一线男明星知乎 编辑:程序博客网 时间:2024/06/06 13:57

很久没上CSDN了,最近开始在做RAID测试和调优相关的工作~

 

 

对于已编译了多个内核版本的情况下,修改Linux默认启动的内核方法如下:

①编辑grub.conf文件:

    vi /etc/grub.conf

②修改"default="后面的数值,改为需要启动的内核编号(下面会依次列有编译成功的每个内核版本,编号从0开始),例如"default=0"

③最后再重启系统即可进入我们选择的内核版本。

 

 

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 CentOS (2.6.29.6)
        root (hd0,0)
        kernel /vmlinuz-2.6.29.6 ro root=LABEL=/1
        initrd /initrd-2.6.29.6.img
title CentOS (2.6.29.6rc1)
        root (hd0,0)
        kernel /vmlinuz-2.6.29.6rc1 ro root=LABEL=/1
        initrd /initrd-2.6.29.6rc1.img
title CentOS (2.6.32.27)
        root (hd0,0)
        kernel /vmlinuz-2.6.32.27 ro root=LABEL=/1
        initrd /initrd-2.6.32.27.img
title CentOS (2.6.test)
        root (hd0,0)
        kernel /vmlinuz-2.6.29testtest ro root=LABEL=/1
        initrd /initrd-2.6.29testtest.img
title CentOS (2.6.34.7)
        root (hd0,0)
        kernel /vmlinuz-2.6.34.7 ro root=LABEL=/1
        initrd /initrd-2.6.34.7.img
title CentOS (2.6.35.9)
        root (hd0,0)
        kernel /vmlinuz-2.6.35.9 ro root=LABEL=/1
        initrd /initrd-2.6.35.9.img
title CentOS (2.6.36.4)
        root (hd0,0)
        kernel /vmlinuz-2.6.36.4 ro root=LABEL=/1
        initrd /initrd-2.6.36.4.img
title CentOS (2.6.38.8)
        root (hd0,0)
        kernel /vmlinuz-2.6.38.8 ro root=LABEL=/1
        initrd /initrd-2.6.38.8.img
title CentOS (2.6.18-238.el5)
        root (hd0,0)
        kernel /vmlinuz-2.6.18-238.el5 ro root=LABEL=/1
        initrd /initrd-2.6.18-238.el5.img
原创粉丝点击