您的位置:首页 > 运维架构 > Linux

(原創)如何修改GURB的開機選項? (OS) (Linux) (Ubuntu) (CentOS)

2007-10-20 23:29 579 查看
Abstract
GRUB負責管理啟動Linux還是Windows,該如何修改GRUB開機選項呢?

Introduction

為什麼需要更改GRUB呢?
1.當Ubuntu更新新的kernel後,GRUB會自動加上新的kernel開機選項,導致開機選項越來越多,想將不必要的開機選項刪除.
2.GRUB預設開機為Ubuntu,你可以想將預設開機改成Windows.
3.修改預設GRUB等待時間.
4.預設不顯示GRUB menu,直接進入Windows.

假如你有以上需求,就得手動修改GRUB開機選項.

Solution
開啟GRUB開機選項檔

sudo gedit /boot/grub/menu.lst

Q1.當Ubuntu更新新的kernel後,GRUB會自動加上新的kernel開機選項,導致開機選項越來越多,想將不必要的開機選項刪除.

A1.以下為我所要的開機選項,不需要者可自行刪除之

## ## 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

Q2.GRUB預設開機為Ubuntu,你可以想將預設開機改成Windows.
A2.修改

## 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

Q3.修改預設GRUB等待時間.
A3.修改

## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).
timeout 3

預設為10秒鐘,我改成等待3秒鐘

Q4.預設不顯示GRUB menu,直接進入Windows.

## hiddenmenu
# Hides the menu by default (press ESC to see the menu)
hiddenmenu

預設會顯示GRUB menu,若你不想顯示menu,要當按下ESC才顯示,請將hiddenmenu前的#拿掉
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐