How to implement dual-system guidance in Linux GRUB

Source: Internet
Author: User

According to Seqic, after installing the Linux and Windows systems, I do not know how to start Windows again (because the system uses the Linux boot program ). Generally, this is because GRUB is not configured properly during Linux installation.

Seqic uses Fedora 12. I do not know whether GRUB is not configured by default in this release or GRUB is not configured in a single system. I did not encounter the GRUB configuration interface when installing Fedora 12.

What is GRUB?

Before configuring GRUB for the system, you should first understand GRUB better. The following is an excerpt from Wikipedia:

"GRUB is short for gnu grub and is a multi-system boot program from the GNU project. It allows you to have multiple operating systems in the computer at the same time, and select the operating system you want to run when the computer starts.

GRUB is very lightweight. It supports multiple executable formats. In addition to operating systems that support multiple boot, it also supports operating systems that do not support multiple boot through the chain startup function, such as Windows and OS/2. GRUB supports all Unix file systems, Windows FAT and NTFS file systems, and LBA. GRUB allows users to view the content of files in the supported file systems ."

To put it simply, using GRUB for multi-system boot means editing grub. conf configuration file, so that a multi-operating system selection menu will appear when the system starts, select Linux to start Linux, select Windows to start Windows, the same is true for other systems: D

"The absolute path of the grub. conf configuration file is/boot/grub. conf. You need the root permission to read and edit the file ."

GRUB configuration file

GRUB is the most important multi-system boot program in Linux. It can be used to create a multi-system boot menu for operating systems such as Unix, Linux, Windows, OS/2, and boot these operating systems.

GRUB's performance and behavior control are mainly implemented by editing grub. the conf configuration file is implemented. To better customize the boot menu later, we first use the following simple example to understand grub. the options in the conf configuration file and their functions.

 
 
  1. #boot=/dev/sda  
  2. default=0 
  3. timeout=0 
  4. splashimage=(hd0,0)/grub/splash.xpm.gz  
  5. hiddenmenu  
  6.  
  7. title Fedora (2.6.32.9-67.fc12.i686.PAE)  
  8.         root (hd0,0)  
  9.         kernel /vmlinuz-2.6.32.9-67.fc12.i686.PAE ro root=/  
  10.         initrd /initramfs-2.6.32.9-67.fc12.i686.PAE.img  
  11.  
  12. title Windows 7  
  13. ...  
  14.  

Note:

Default-default menu entries. In this example, the first entry Fedora (2.6.32.9-67. fc12.i686. PAE) is guided by default ). If you change the default value to 1, Windows 7 is guided by default.

Timeout-automatically selects the time displayed in the default pre-boot menu. In this example, if you do not select the operating system within 30 seconds, the first entry (default 0) is guided by default)

Splashimage-specify the interface style of the GRUB boot menu. (Hd0, 0)/grub/splash.xpm.gz indicates that the splash.xpm.gz file under the grub directory is used as the interface style in the first partition (hd0, 0) of the first hard disk. Generally, you do not need to change this configuration: D

Hiddenmenu-hide the GRUB boot menu. Delete this entry if you do not want to display the GRUB boot menu at startup.

System boot entry

Title-the name of the boot entry. You can change the operating system name by yourself, such as "Fedora 12", "Fedora", or "MyLinux. The title is displayed in the GRUB boot menu.

Root-disk partition of the operating system kernel and boot file. (Hd0, 0) indicates the first partition of the first hard disk, (hd0, 2) indicates the first partition of the first hard disk, and so on.

Kernel-parameters used by the system kernel and boot command.

Initrd-System Boot Program

The files specified in kernel and initrd are all relative to the hard disk partition set in root. For example, (hd0, 0) in this example is the/boot partition on the machine, the location of the kernel is actually/boot/vmlinuz-2.6.32.9-67.fc12.i686.PAE

Use GRUB to Boot Windows

Unlike Unix and Linux, Windows is an operating system that does not support multi-boot. simply use the kernel and init options in the grub. conf configuration file to Boot Windows. To be able to Boot Windows through GRUB, you need to use the chain-load startup function of GRUB.

Reminder: the root permission is required for viewing and editing/boot/grub. conf, And you are advised to back up the file before editing grub. conf.

Use the cp command to back up the configuration file.

 
 
  1. ~]# cp /boot/grub/grub.conf /boot/grub/grub.conf.bak  
  2.  

General

To use the GRUB chain boot function to guide Windows, you generally only need to add the following content to the grub. conf configuration file.

 
 
  1. title Windows 7  
  2. rootnoverify hd(0,0)  
  3. makeactive  
  4. chainloader +1  

Multiple Hard Disks

If your machine has more than two hard disks and the Windows operating system is installed on the second hard disk, you also need to add the map command in the configuration, they are used to change the ing between two hard disks.

 
 
  1. title Windows 7  
  2. map (hd0) (hd1)  
  3. map (hd1) (hd0)  
  4. rootnoverify hd(0,0)  
  5. makeactive  
  6. chainloader +1  
  7.  

Multiple Primary partitions

Another problem that may occur when you use GRUB to Boot Windows is that multiple Windows operating systems are installed on the same disk, so that there will be multiple primary partitions on the hard disk. To enable GRUB to properly boot a Windows operating system, you need to hide unnecessary primary partitions for GRUB. If Windows XP is installed on the first partition hd () and Windows 7 is installed on the second partition hd (), and you want to Boot Windows 7, the following configuration should be used:

 
 
  1. title Windows 7  
  2. unhide hd(0,1)  
  3. hide hd(0,0)  
  4. rootnoverify hd(0,1)  
  5. makeactive  
  6. chainloader +1  
  7.  

Generally, most users are in the first case. You only need a few simple configurations to implement Windows boot.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.