centos使用grub管理启动的相关内容

发布时间:2021-01-13编辑:脚本学堂
一、更改GRUB 1.当Ubuntu更新新的kernel后,GRUB会自动加上新的kernel开机选项,导致开机选项越来越多,想将不必要的开机选项刪除.

一、更改grub
1.当Ubuntu更新新的kernel后,GRUB会自动加上新的kernel开机选项,导致开机选项越来越多,想将不必要的开机选项刪除.
2.centos GRUB预设开机为Ubuntu,你可以想将预设开机改成Windows.
3.修改预设CentOS GRUB等待时間.
4.预设不显示GRUB menu,直接進入Windows.

二、设置
开啟CentOS GRUB开机选项档 gedit /boot/grub/menu.lst

1.当Ubuntu更新新的kernel后,CentOS GRUB会自动加上新的kernel开机选项,导致开机选项越来越多,想将不必要的开机选项刪除.
以下为我所要的开机选项,不需要者可自行刪除之
## ## End Default Options ##
title        Ubuntu, kernel 2.6.20-16-generic
root        (hd0,6)
kernel        /boot/vmlinuz-2.6.20-16-generic root=UUID=b923ef76-3246-411c-8095-7bca666b13a5 ro quiet splash
initrd        /boot/initrd.img-2.6.20-16-generic
quiet
savedefault
title        Ubuntu, kernel 2.6.20-16-generic (recovery mode)
root        (hd0,6)
kernel        /boot/vmlinuz-2.6.20-16-generic root=UUID=b923ef76-3246-411c-8095-7bca666b13a5 ro single
initrd        /boot/initrd.img-2.6.20-16-generic

# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/sda1
title        Microsoft Windows XP Professional
root        (hd0,0)
savedefault
makeactive
chainloader    +1

2.CentOS GRUB预设开机为Ubuntu,你可以想将预设开机改成Windows.
## default num
# Set the default entry to the entry number NUM. Numbering starts from 0, and
# the entry number 0 is the default if the command is not used.
#
# You can specify 'saved' instead of a number. In this case, the default entry
# is the entry saved with the command 'savedefault'.
# WARNING: If you are using dmraid do not change this entry to 'saved' or your
# array will desync and will not let you boot your system.
default        2
预设default为 0,表示开机用Ubuntu开机,因为在我的电脑Windows为第三個选项,故default为2

3.修改预设CentOS GRUB等待时间.
## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).
timeout        3
预设为10秒钟,我改成等待3秒钟

4.不显示CentOS GRUB menu,直接進入Windows.
## hiddenmenu
# Hides the menu by default (press ESC to see the menu)
hiddenmenu
预设会显示GRUB menu,若你不想显示menu,要当按下ESC才显示,请将hiddenmenu前的#拿掉