Installation and use of Grub && use grub to modify kernel boot parameters

Source: Internet
Author: User
Tags mkdir naming convention

Installing and using Grub

To begin to explore the subtleties of GRUB, you first need to download, compile, and install it. But don't be afraid--it's not going to change your boot record--we're just going to compile and install grub, just like any other program, where we can create a grub boot disk. Please don't worry; I'll let you know before you modify the boot process.

The grub installation process is not much different from the normal software installation process and can be installed on its own

Use of Grub


1 Format a partition:

sudo mke2fs/dev/fd0
2) Mount Partition
sudo mount/dev/fd0/mnt/floppy

3 Create directories and copy files
sudo mkdir/mnt/floppy/boot
sudo mkdir/mnt/floppy/boot/grub
sudo cp/usr/share/grub/i386-pc/stage1/mnt/ Floppy/boot/grub
sudo cp/usr/share/grub/i386-pc/stage2/mnt/floppy/boot/grub

Guide Disk production:
4) Guide Plate Making
grub> root (fd0)//where to find the Stage1 and Stage2 file
grub> Setup (fd0)//where to install the boot loader
  grub> quit

Related issues:
5) Grub naming convention

So far, you may be a bit confused because GRUB uses a different hard disk/partition naming convention than the naming convention used by Linux. In Linux, the fifth partition of the first hard disk is called "Hda5." and GRUB calls this Partition "(hd0,4)." GRUB's numbers for hard disks and partitions are calculated from 0. In addition, the hard disk and partitions are separated by commas, and the entire expression is enclosed in parentheses. Now, come back and take a look at the GRUB hints and find out if you want to boot the Linux hard drive Hda5, you should enter root (hd0,4). If you already understand the GRUB hard drive/partition naming, you may want to adjust the current root command line so that it points to the partition that holds the Linux kernel. Complete the command in the following format, and then press Enter:

grub> Root (hd0,4) (hit Enter)
filesystem type is ReiserFS, partition type 0x83

7) about Setup (hd0)
If you create a boot disk using FAT instead of the ext2 file system, GRUB can work. Yes, it works because GRUB installs stage1.5 that matches the root file system type when you enter Fd0. Even if there is no room to install Stage1.5,grub can still be loaded into the stage2 by going back to a more primitive list of blocks.

Grub Install: Install grub to your device

8) Using GRUB Search and recovery system

The kernel required for backup to start:
sudo mount/dev/fd0/mnt/floppy
sudo cp/path/to/bzimage/mnt/floppy/boot
sudo umount/dev/fd0
Booting with the kernel
grub> root (fd0)
grub> kernel/boot/bzimage root=/dev/hda5 (Will/dev/hda5 change Chengxiang the partition name to boot)
grub> boot

9) Grub Config
Need to update grub.cfg file with Update-grub

Grub-install: Install grub to the appropriate device (note: device, not partition)
10 using GRUB to modify kernel boot parameters
What startup parameters are in the kernel:
Can find the parameter in the kernel source tree on branch "Docutation/kernel-parameter"
How to modify kernel boot parameters:
Can add a parameter and its value in the file grub.cfg such as mem=2g

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: 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.